Package jflex
Class StateSet
java.lang.Object
jflex.StateSet
A set of NFA states (= integers).
Very similar to java.util.BitSet, but is faster and doesn't crash
- Version:
- JFlex 1.7.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
add.void
addState
(int state) addState.void
clear()
clear.complement
(StateSet set) Returns the set of elements that contained are in the specified set but are not contained in this set.boolean
containsElements.boolean
containsSet
(StateSet set) containsSet.copy()
copy.void
Copy specified StateSet into this.boolean
int
Returns one element of the set and removes it.int
hashCode()
hashCode.boolean
isElement
(int state) isElement.void
remove
(int state) remove.private void
resize
(int size) private int
size2nbits
(int size) states()
states.toString()
toString.
-
Field Details
-
DEBUG
private final boolean DEBUG- See Also:
-
EMPTY
ConstantEMPTY
-
BITS
static final int BITS- See Also:
-
MASK
static final int MASK- See Also:
-
bits
long[] bits
-
-
Constructor Details
-
StateSet
public StateSet()Constructor for StateSet. -
StateSet
public StateSet(int size) Constructor for StateSet.- Parameters:
size
- a int.
-
StateSet
public StateSet(int size, int state) Constructor for StateSet.- Parameters:
size
- a int.state
- a int.
-
StateSet
Constructor for StateSet.- Parameters:
set
- aStateSet
object.
-
-
Method Details
-
addState
public void addState(int state) addState.- Parameters:
state
- a int.
-
size2nbits
private int size2nbits(int size) -
resize
private void resize(int size) -
clear
public void clear()clear. -
isElement
public boolean isElement(int state) isElement.- Parameters:
state
- a int.- Returns:
- a boolean.
-
getAndRemoveElement
public int getAndRemoveElement()Returns one element of the set and removes it.Precondition: the set is not empty.
- Returns:
- a int.
-
remove
public void remove(int state) remove.- Parameters:
state
- a int.
-
complement
Returns the set of elements that contained are in the specified set but are not contained in this set. -
add
add.- Parameters:
set
- aStateSet
object.
-
containsSet
containsSet.- Parameters:
set
- aStateSet
object.- Returns:
- a boolean.
-
equals
-
hashCode
public int hashCode()hashCode. -
states
states.- Returns:
- a
StateSetEnumerator
object.
-
containsElements
public boolean containsElements()containsElements.- Returns:
- a boolean.
-
copy
copy.- Returns:
- a
StateSet
object.
-
copy
Copy specified StateSet into this.- Parameters:
set
- the state set to copy.
-
toString
toString.
-