Package org.apache.lucene.util
Class IntsRef
- java.lang.Object
 - 
- org.apache.lucene.util.IntsRef
 
 
- 
- All Implemented Interfaces:
 java.lang.Cloneable,java.lang.Comparable<IntsRef>
public final class IntsRef extends java.lang.Object implements java.lang.Comparable<IntsRef>, java.lang.Cloneable
Represents int[], as a slice (offset + length) into an existing int[]. Theintsmember should never be null; useEMPTY_INTSif necessary. 
- 
- 
Field Summary
Fields Modifier and Type Field Description static int[]EMPTY_INTSAn empty integer array for convenienceint[]intsThe contents of the IntsRef.intlengthLength of used ints.intoffsetOffset of first valid integer. 
- 
Constructor Summary
Constructors Constructor Description IntsRef()Create a IntsRef withEMPTY_INTSIntsRef(int capacity)Create a IntsRef pointing to a new array of sizecapacity.IntsRef(int[] ints, int offset, int length)This instance will directly reference ints w/o making a copy. 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description IntsRefclone()Returns a shallow clone of this instance (the underlying ints are not copied and will be shared by both the returned object and this object.intcompareTo(IntsRef other)Signed int order comparisonvoidcopyInts(IntsRef other)static IntsRefdeepCopyOf(IntsRef other)Creates a new IntsRef that points to a copy of the ints fromotherbooleanequals(java.lang.Object other)voidgrow(int newLength)Used to grow the reference array.inthashCode()booleanintsEquals(IntsRef other)booleanisValid()Performs internal consistency checks.java.lang.StringtoString() 
 - 
 
- 
- 
Constructor Detail
- 
IntsRef
public IntsRef()
Create a IntsRef withEMPTY_INTS 
- 
IntsRef
public IntsRef(int capacity)
Create a IntsRef pointing to a new array of sizecapacity. Offset and length will both be zero. 
- 
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 Detail
- 
clone
public IntsRef clone()
Returns a shallow clone of this instance (the underlying ints are not copied and will be shared by both the returned object and this object. 
- 
hashCode
public int hashCode()
- Overrides:
 hashCodein classjava.lang.Object
 
- 
equals
public boolean equals(java.lang.Object other)
- Overrides:
 equalsin classjava.lang.Object
 
- 
intsEquals
public boolean intsEquals(IntsRef other)
 
- 
compareTo
public int compareTo(IntsRef other)
Signed int order comparison- Specified by:
 compareToin interfacejava.lang.Comparable<IntsRef>
 
- 
copyInts
public void copyInts(IntsRef other)
 
- 
grow
public void grow(int newLength)
Used to grow the reference array. In general this should not be used as it does not take the offset into account. 
- 
toString
public java.lang.String toString()
- Overrides:
 toStringin classjava.lang.Object
 
- 
deepCopyOf
public static IntsRef deepCopyOf(IntsRef other)
Creates a new IntsRef that points to a copy of the ints 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) 
 - 
 
 -