Package com.graphhopper.storage
Class IntsRef
java.lang.Object
com.graphhopper.storage.IntsRef
- All Implemented Interfaces:
Comparable<IntsRef>
Idea and most of the code is from Lucene. But the variables are final, except for the array content.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Signed int order comparisonstatic IntsRef
deepCopyOf
(IntsRef other) Creates a new IntsRef that points to a copy of the ints fromother
boolean
int
hashCode()
boolean
intsEquals
(IntsRef other) boolean
isEmpty()
boolean
isValid()
Performs internal consistency checks.toString()
-
Field Details
-
EMPTY
An IntsRef with an array of size 0. -
ints
public final int[] intsThe contents of the IntsRef. Cannot benull
. -
offset
public final int offsetOffset of first valid integer. -
length
public final int lengthLength of used ints.
-
-
Constructor Details
-
IntsRef
public IntsRef(int capacity) Create a IntsRef pointing to a new int array of sizecapacity
leading to capacity*32 bits. Offset will be zero and length will be the capacity. -
IntsRef
public IntsRef(int[] ints, int offset, int length) This instance will directly reference ints w/o making a copy. ints should not be null.
-
-
Method Details
-
hashCode
public int hashCode() -
equals
-
intsEquals
-
compareTo
Signed int order comparison- Specified by:
compareTo
in interfaceComparable<IntsRef>
-
deepCopyOf
Creates a new IntsRef that points to a copy of the ints fromother
The returned IntsRef will have a length of other.length and an offset of zero.
-
isValid
public boolean isValid()Performs internal consistency checks. Always returns true (or throws IllegalStateException) -
toString
-
isEmpty
public boolean isEmpty()
-