Package com.github.oeuvres.alix.util
Class LongTuple
java.lang.Object
com.github.oeuvres.alix.util.LongTuple
- All Implemented Interfaces:
Comparable<LongTuple>
A fixed list of longs, useful in arrays to be sorted.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintbooleanlongget(int index) LikeList.get(int), returns the element at the specified position in this list.inthashCode()intsize()LikeList.size(), returns the number of elements in this list.long[]toArray()LikeList.toArray(), returns an array containing all of the elements in this list in proper sequence (from first to last element).long[]toArray(long[] dest) Fill the provided array with sorted values, or create new if null provided.toString()
-
Field Details
-
data
protected final long[] dataInternal data -
size
protected final int sizeSize of tuple -
hashCache
protected int hashCacheCache an hash code -
hashOK
protected boolean hashOKShould be rehashed -
murmur
Hash code producer
-
-
Constructor Details
-
LongTuple
public LongTuple(int size) Constructor setting the size.- Parameters:
size- number of long in this tuple.
-
LongTuple
public LongTuple(long a, long b) Build a pair.- Parameters:
a- first element of the pair.b- second element of the pair.
-
LongTuple
public LongTuple(long a, long b, long c) Build a 3-tuple.- Parameters:
a- first element of the triplet.b- second element of the triplet.c- third element of the triplet.
-
-
Method Details
-
compareTo
- Specified by:
compareToin interfaceComparable<LongTuple>
-
equals
-
get
public long get(int index) LikeList.get(int), returns the element at the specified position in this list.- Parameters:
index- position of the element to return.- Returns:
- The element at the specified position in this list.
-
hashCode
public int hashCode() -
toArray
public long[] toArray()LikeList.toArray(), returns an array containing all of the elements in this list in proper sequence (from first to last element).- Returns:
- An array containing all of the elements in this list in proper sequence.
-
toArray
public long[] toArray(long[] dest) Fill the provided array with sorted values, or create new if null provided. If the list fits in the specified array, it is returned therein, without modification of further positions. If the array provided is smaller than list content, it is filled up to its length.- Parameters:
dest- array to fill in, up to dest.length.- Returns:
- same array.
-
toString
-
size
public int size()LikeList.size(), returns the number of elements in this list.- Returns:
- The number of elements in this list.
-