Package org.apache.lucene.util
Class LongsRef
- java.lang.Object
-
- org.apache.lucene.util.LongsRef
-
- All Implemented Interfaces:
Cloneable,Comparable<LongsRef>
public final class LongsRef extends Object implements Comparable<LongsRef>, Cloneable
Represents long[], as a slice (offset + length) into an existing long[]. Thelongsmember should never be null; useEMPTY_LONGSif necessary.- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
-
Field Summary
Fields Modifier and Type Field Description static long[]EMPTY_LONGSAn empty long array for convenienceintlengthLength of used longs.long[]longsThe contents of the LongsRef.intoffsetOffset of first valid long.
-
Constructor Summary
Constructors Constructor Description LongsRef()Create a LongsRef withEMPTY_LONGSLongsRef(int capacity)Create a LongsRef pointing to a new array of sizecapacity.LongsRef(long[] longs, int offset, int length)This instance will directly reference longs w/o making a copy.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description LongsRefclone()Returns a shallow clone of this instance (the underlying longs are not copied and will be shared by both the returned object and this object.intcompareTo(LongsRef other)Signed int order comparisonstatic LongsRefdeepCopyOf(LongsRef other)Creates a new LongsRef that points to a copy of the longs fromotherbooleanequals(Object other)inthashCode()booleanisValid()Performs internal consistency checks.booleanlongsEquals(LongsRef other)StringtoString()
-
-
-
Constructor Detail
-
LongsRef
public LongsRef()
Create a LongsRef withEMPTY_LONGS
-
LongsRef
public LongsRef(int capacity)
Create a LongsRef pointing to a new array of sizecapacity. Offset and length will both be zero.
-
LongsRef
public LongsRef(long[] longs, int offset, int length)This instance will directly reference longs w/o making a copy. longs should not be null
-
-
Method Detail
-
clone
public LongsRef clone()
Returns a shallow clone of this instance (the underlying longs are not copied and will be shared by both the returned object and this object.- Overrides:
clonein classObject- See Also:
deepCopyOf(org.apache.lucene.util.LongsRef)
-
longsEquals
public boolean longsEquals(LongsRef other)
-
compareTo
public int compareTo(LongsRef other)
Signed int order comparison- Specified by:
compareToin interfaceComparable<LongsRef>
-
deepCopyOf
public static LongsRef deepCopyOf(LongsRef other)
Creates a new LongsRef that points to a copy of the longs fromotherThe 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)
-
-