public final class Index extends AIndex
| 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)
|
AVector |
asVector() |
Index |
clone() |
Index |
compose(AIndex a)
Composes this index with a second index, returning a new index.
|
Index |
compose(Index a) |
boolean |
containsSorted(int index)
Returns true if the index contains a specific value.
|
static Index |
create(AIndex index) |
static Index |
create(ArrayList<Integer> v)
Creates an Index using the values from the given ArrayList.
|
static Index |
create(AVector v)
Creates an Index using the values from the given AVector.
|
static Index |
create(int[] indices) |
static Index |
create(List<Integer> v)
Creates an Index using the values from the given List.
|
static Index |
createLength(int len)
Create a new zero-filled Index with the specified length
|
static Index |
createSorted(Set<Integer> keySet) |
static Index |
createSorted(SortedSet<Integer> keySet) |
boolean |
equals(Index o) |
boolean |
equals(Object o) |
Index |
exactClone() |
int |
find(int value)
Finds a value in this Index and return's it's position, or -1 if not found
|
int |
findMissing()
Finds the first missing index value, assuming the index is sorted and distinct.
|
int |
get(int i)
Gets the index value at position i
|
int[] |
getData() |
int[] |
getShape() |
Index |
includeSorted(Index ind) |
Index |
includeSorted(Set<Integer> is) |
int |
indexPosition(int x)
Looks up an index value in the index, returning its position or -1 if not found
Index must be both sorted and distinct.
|
Index |
insert(int position,
int value)
Returns a new Index with a value inserted at the specified position
|
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 |
last()
Gets the last index value in this index.
|
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)
Returns the position at which an index value exists or should be inserted at in an index
Index must be both sorted and distinct.
|
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() |
Set<Integer> |
toSet() |
SortedSet<Integer> |
toSortedSet() |
int |
unsafeGet(int i) |
static Index |
wrap(int[] indexes)
Creates a new Index, wrapping the provided index array
|
compareTo, contains, contains, copyTo, equals, hashCode, isDistinct, iterator, maxIndex, minIndex, toIndex, toList, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic static final Index EMPTY
public final int[] data
public static Index create(ArrayList<Integer> v)
v - public static Index create(List<Integer> v)
v - public static Index create(int[] indices)
public static Index create(AVector v)
v - public static Index wrap(int[] indexes)
public static Index of(int... indexes)
public static Index createLength(int len)
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 int get(int i)
AIndexpublic int unsafeGet(int i)
public int length()
AIndexpublic void permute(Index permutationIndex)
permutationIndex - public AVector asVector()
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 x)
indexPosition in class AIndexx - public int seekPosition(int i)
AIndexseekPosition in class AIndexpublic int findMissing()
public boolean containsSorted(int index)
AIndexcontainsSorted in class AIndexpublic Index insert(int position, int value)
public int find(int value)
value - public Index invert()
public boolean allInRange(int start,
int end)
start - end - public int[] getShape()
public Index exactClone()
exactClone in class AIndexCopyright © 2016. All rights reserved.