Package org.apache.lucene.util.automaton
Class StateSet
- java.lang.Object
-
- org.apache.lucene.util.automaton.IntSet
-
- org.apache.lucene.util.automaton.StateSet
-
final class StateSet extends IntSet
A thin wrapper ofIntIntHashMapMaps from state in integer representation to its reference count Whenever the count of a state is 0, that state will be removed from the set
-
-
Field Summary
Fields Modifier and Type Field Description private int[]arrayCacheprivate booleanarrayUpdatedprivate longhashCodeprivate booleanhashUpdatedprivate IntIntHashMapinner
-
Constructor Summary
Constructors Constructor Description StateSet(int capacity)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voiddecr(int state)Decrease the reference count of the state, if the count down to 0, remove the state from this set(package private) FrozenIntSetfreeze(int state)Create a snapshot of this int set associated with a given state.(package private) int[]getArray()Return an array representation of this int set's values.(package private) voidincr(int state)Add the state into this set, if it is already there, increase its reference count by 1private voidkeyChanged()(package private) longlongHashCode()(package private) intsize()Guaranteed to be less than or equal to the length of the array returned byIntSet.getArray().
-
-
-
Field Detail
-
inner
private final IntIntHashMap inner
-
hashCode
private long hashCode
-
hashUpdated
private boolean hashUpdated
-
arrayUpdated
private boolean arrayUpdated
-
arrayCache
private int[] arrayCache
-
-
Method Detail
-
incr
void incr(int state)
Add the state into this set, if it is already there, increase its reference count by 1- Parameters:
state- an integer representing this state
-
decr
void decr(int state)
Decrease the reference count of the state, if the count down to 0, remove the state from this set- Parameters:
state- an integer representing this state
-
freeze
FrozenIntSet freeze(int state)
Create a snapshot of this int set associated with a given state. The snapshot will not retain any frequency information about the elements of this set, only existence.- Parameters:
state- the state to associate with the frozen set.- Returns:
- A new FrozenIntSet with the same values as this set.
-
keyChanged
private void keyChanged()
-
getArray
int[] getArray()
Description copied from class:IntSetReturn an array representation of this int set's values. Values are valid for indices [0,IntSet.size()). If this is a mutable int set, then changes to the set are not guaranteed to be visible in this array.- Specified by:
getArrayin classIntSet- Returns:
- an array containing the values for this set, guaranteed to be at least
IntSet.size()elements
-
size
int size()
Description copied from class:IntSetGuaranteed to be less than or equal to the length of the array returned byIntSet.getArray().
-
longHashCode
long longHashCode()
- Specified by:
longHashCodein classIntSet
-
-