public abstract class BasicState<S extends BasicState<S,T>,T extends AbstractTransition<S,T>> extends Object implements AbstractState<S,T>
| Modifier and Type | Field and Description |
|---|---|
protected static short |
FLAG_ANCHORED_FINAL_STATE |
protected static short |
FLAG_ANCHORED_INITIAL_STATE |
protected static short |
FLAG_ANY_FINAL_STATE |
protected static short |
FLAG_ANY_INITIAL_OR_FINAL_STATE |
protected static short |
FLAG_ANY_INITIAL_STATE |
protected static short |
FLAG_UN_ANCHORED_FINAL_STATE |
protected static short |
FLAG_UN_ANCHORED_INITIAL_STATE |
protected static int |
N_FLAGS
Number of flag bits occupied by this class.
|
| Modifier | Constructor and Description |
|---|---|
protected |
BasicState(BasicState<S,T> original) |
protected |
BasicState(int id,
short flags,
T[] emptyTransitions) |
protected |
BasicState(int id,
T[] emptyTransitions) |
| Modifier and Type | Method and Description |
|---|---|
void |
addPredecessor(T predecessor)
Add a predecessor-transition to this state's predecessor array.
|
void |
addPredecessorUnchecked(T predecessor)
Identical to
BasicState.addPredecessor(AbstractTransition), but does not assert that the
predecessor transition's target is this. |
protected abstract T[] |
createTransitionsArray(int length) |
protected boolean |
getFlag(short flag) |
protected short |
getFlags() |
int |
getId()
Unique ID of this state.
|
protected int |
getNPredecessors()
Returns the current value of
nPredecessors set by BasicState.incPredecessors(), which
is not necessarily the final number of predecessors. |
T[] |
getPredecessors() |
T[] |
getPredecessors(boolean forward) |
T[] |
getSuccessors() |
T[] |
getSuccessors(boolean forward) |
boolean |
hasPredecessors() |
boolean |
hasSuccessors() |
protected abstract boolean |
hasTransitionToUnAnchoredFinalState(boolean forward) |
void |
incPredecessors()
Helper for predecessor initialization.
|
boolean |
isAnchoredFinalState()
Anchored final states are implicitly guarded by a
$-PositionAssertion. |
boolean |
isAnchoredFinalState(boolean forward) |
boolean |
isAnchoredInitialState()
Anchored final states are implicitly guarded by a
^-PositionAssertion. |
boolean |
isAnchoredInitialState(boolean forward) |
boolean |
isDead(boolean forward)
Returns
true iff this state is non-final and has no successors/predecessors
(depending on forward other than itself. |
boolean |
isFinalState() |
boolean |
isFinalState(boolean forward) |
boolean |
isInitialState() |
boolean |
isInitialState(boolean forward) |
boolean |
isUnAnchoredFinalState() |
boolean |
isUnAnchoredFinalState(boolean forward) |
boolean |
isUnAnchoredInitialState() |
boolean |
isUnAnchoredInitialState(boolean forward) |
void |
setAnchoredFinalState() |
void |
setAnchoredInitialState() |
protected void |
setFlag(short flag) |
protected void |
setFlag(short flag,
boolean value) |
void |
setPredecessors(T[] predecessors) |
void |
setSuccessors(T[] successors) |
void |
setUnAnchoredFinalState() |
void |
setUnAnchoredInitialState() |
void |
setUnAnchoredInitialState(boolean value) |
protected static final short FLAG_ANCHORED_INITIAL_STATE
protected static final short FLAG_UN_ANCHORED_INITIAL_STATE
protected static final short FLAG_ANCHORED_FINAL_STATE
protected static final short FLAG_UN_ANCHORED_FINAL_STATE
protected static final short FLAG_ANY_INITIAL_STATE
protected static final short FLAG_ANY_FINAL_STATE
protected static final short FLAG_ANY_INITIAL_OR_FINAL_STATE
protected static final int N_FLAGS
byte NEW_FLAG = 1 << N_FLAGS; byte NEW_FLAG2 = 1 << (N_FLAGS + 1) etc.protected BasicState(int id,
T[] emptyTransitions)
id - unique id.emptyTransitions - static final empty array of transitions. This will be shared for all
empty transition arrays.protected BasicState(int id,
short flags,
T[] emptyTransitions)
protected BasicState(BasicState<S,T> original)
public final int getId()
AbstractStategetId in interface AbstractState<S extends BasicState<S,T>,T extends AbstractTransition<S,T>>protected short getFlags()
protected boolean getFlag(short flag)
protected void setFlag(short flag)
protected void setFlag(short flag,
boolean value)
public boolean isInitialState()
public boolean isAnchoredInitialState()
^-PositionAssertion.public void setAnchoredInitialState()
public boolean isUnAnchoredInitialState()
public void setUnAnchoredInitialState()
public void setUnAnchoredInitialState(boolean value)
public boolean isFinalState()
public boolean isAnchoredFinalState()
$-PositionAssertion.public void setAnchoredFinalState()
public boolean isUnAnchoredFinalState()
public void setUnAnchoredFinalState()
public boolean isAnchoredInitialState(boolean forward)
public boolean isUnAnchoredInitialState(boolean forward)
public boolean isInitialState(boolean forward)
public boolean isFinalState(boolean forward)
public boolean isAnchoredFinalState(boolean forward)
public boolean isUnAnchoredFinalState(boolean forward)
protected abstract boolean hasTransitionToUnAnchoredFinalState(boolean forward)
public T[] getSuccessors()
public void setSuccessors(T[] successors)
public T[] getPredecessors()
public void setPredecessors(T[] predecessors)
public T[] getSuccessors(boolean forward)
public T[] getPredecessors(boolean forward)
public boolean hasSuccessors()
public boolean hasPredecessors()
public boolean isDead(boolean forward)
true iff this state is non-final and has no successors/predecessors
(depending on forward other than itself.public void incPredecessors()
public void addPredecessor(T predecessor)
source is the predecessor state, and
target is this. Before calling this method,
the automaton generator must make the total number of predecessors known via
BasicState.incPredecessors().public void addPredecessorUnchecked(T predecessor)
BasicState.addPredecessor(AbstractTransition), but does not assert that the
predecessor transition's target is this.protected int getNPredecessors()
nPredecessors set by BasicState.incPredecessors(), which
is not necessarily the final number of predecessors. Use with caution.protected abstract T[] createTransitionsArray(int length)