Package util
Class State
java.lang.Object
util.State
Defines the abstract state of a Deterministic Finite State Automaton (DFSA).
It is recommended that the set of states defining a DFSA are defined as static classes
within a container class for proper encapsulation.
- Author:
- Krish Pillai
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleaninthashCode()booleanIndicates is this is a final state.booleanIndicates if this is an initial stateabstract voidmanage()The method that will be invoked when a state change occurs.voidIdentifies this state as the final state.voidIdentifies this state as the initial state.toString()String representation of the State.
-
Constructor Details
-
State
State constructor takes a label. The label is used for checking congruence of state objects.- Parameters:
name- String defining the name of the state e.g. {S0, S1, S2, ...}
-
-
Method Details
-
setInitialState
public void setInitialState()Identifies this state as the initial state. There can be only one initial state. -
setFinalState
public void setFinalState()Identifies this state as the final state. There can be a set of final states. -
isInitialState
public boolean isInitialState()Indicates if this is an initial state- Returns:
- true or false
-
isFinalState
public boolean isFinalState()Indicates is this is a final state.- Returns:
- true or false
-
manage
public abstract void manage()The method that will be invoked when a state change occurs. This method should be overridden by the concrete state class. -
toString
String representation of the State. Only the name field is considered. -
hashCode
public int hashCode() -
equals
-