public final class Index extends AIndex
| Modifier and Type | Field and Description |
|---|---|
int[] |
data |
| Constructor and Description |
|---|
Index(int length) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
allInRange(int start,
int end)
Checks that all values in this index are within the specified range of
start (inclusive) to end (exclusive)
|
Index |
clone() |
Index |
compose(AIndex a)
Composes this index with a second index, returning a new index.
|
Index |
compose(Index a) |
static Index |
create(AVector v) |
static Index |
createLength(int len) |
boolean |
equals(Index o) |
boolean |
equals(Object o) |
int |
find(int value)
Finds a value in this Index and return's it's position, or -1 if not found
|
int |
get(int i)
Gets the index value at position i
|
int[] |
getData() |
int |
indexPosition(int i)
Looks up an index value in the index, returning its position or -1 if not found
Index must be both sorted and distinct.
|
Index |
invert()
Inverts the permutation represented by this Index
|
boolean |
isDistinctSorted()
Returns true if this index is distinct and sorted (in strictly increasing order)
|
boolean |
isEvenPermutation() |
boolean |
isFullyMutable() |
boolean |
isOddPermutation() |
boolean |
isPermutation()
Returns true if this index represents a permutation of positions 0..length-1
|
boolean |
isSorted()
Returns true if this index is sorted (in increasing order)
|
int |
length()
Returns the length of this index list
|
void |
lookupWith(Index source) |
static Index |
of(int... indexes)
Creates a new Index, using the specified index values
|
void |
permute(Index permutationIndex)
Permutes this vector according to a given permutation index
|
void |
reverse()
Reverses an index
|
int |
seekPosition(int i)
Finds the position a value would take assuming a sorted index.
|
void |
set(int i,
int value) |
void |
sort()
Sorts the Index (in-place)
|
void |
swap(int i,
int j)
Swaps (in-place) the indexes at two positions
|
int |
swapCount()
Counts the number of swaps required to create this permutation
|
int[] |
toArray() |
int |
unsafeGet(int i) |
static Index |
wrap(int[] indexes)
Creates a new Index, wrapping the provided index array
|
public void swap(int i,
int j)
public boolean isDistinctSorted()
AIndexisDistinctSorted in class AIndexpublic boolean isSorted()
AIndexpublic boolean isPermutation()
AIndexisPermutation in class AIndexpublic int swapCount()
public boolean isOddPermutation()
public boolean isEvenPermutation()
public static Index wrap(int[] indexes)
public static Index of(int... indexes)
public static Index createLength(int len)
public int get(int i)
AIndexpublic int unsafeGet(int i)
public int length()
AIndexpublic void permute(Index permutationIndex)
permutationIndex - public boolean equals(Index o)
public int[] getData()
public boolean isFullyMutable()
isFullyMutable in class AIndexpublic void lookupWith(Index source)
public Index compose(AIndex a)
AIndexpublic int indexPosition(int i)
i - public int seekPosition(int i)
i - The position of the value - will point to either the value or the next higher value presentpublic int find(int value)
value - public Index invert()
public boolean allInRange(int start,
int end)
start - end - Copyright © 2013. All Rights Reserved.