All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class javaParse.State

java.lang.Object
   |
   +----javaParse.State

public class State
extends Object
implements BinaryPredicate
This class implements a state of a machine. The painting of a state is done in the Desktop class.

See Also:
Desktop

Variable Index

 o id
 o isFinal
 o label
 o stateList
 o transitions

Constructor Index

 o State()
Construct a new, uninitialized, state.
 o State(int, boolean, int, int)
Constructs a new State with the specified label, isFinal flag, and position.
 o State(int, boolean, Point)
Constructs a new State with the specified label, isFinal flag, and position.
 o State(State)
copy constructor

Method Index

 o compareLabel(State)
Compares the label of this State with that of the passed State.
 o execute(Object, Object)
used for sorting the vectors of States with the JGL VectorArray Sorting
 o getTokenizedLabel()
returns a tokenised version of the Dfa label stored in a Vector of Strings
 o labelToStateList(Desktop)
turns the label into a list of the corresponding States in the passed nfa
 o paint(Graphics, boolean)
Paints a state.
 o paintDfaLabel(Graphics, State)
Paints the label of a State in DFA mode.
 o paintInitial(Graphics, Desktop)
Paints the triangle that represents the initial state.
 o processKey(int, KeyEvent)
handles keyEvents on StateDfalabels for the Desktop
 o setLabel(Vector)
sets the label to the String corresponding to the Vector of Strings passed
 o stateListToLabel()
turns a list of States in the corresponding nfa into a String and stores it as the label

Variables

 o id
 public int id
 o isFinal
 public boolean isFinal
 o transitions
 public Vector transitions
 o stateList
 public Vector stateList
 o label
 public String label

Constructors

 o State
 public State(int id,
              boolean isFinal,
              Point p)
Constructs a new State with the specified label, isFinal flag, and position.

 o State
 public State(int id,
              boolean isFinal,
              int x,
              int y)
Constructs a new State with the specified label, isFinal flag, and position.

 o State
 public State()
Construct a new, uninitialized, state. Used when reading a machine from a file.

 o State
 public State(State aState)
copy constructor

Methods

 o execute
 public boolean execute(Object a,
                        Object b)
used for sorting the vectors of States with the JGL VectorArray Sorting

 o getTokenizedLabel
 public Vector getTokenizedLabel()
returns a tokenised version of the Dfa label stored in a Vector of Strings

 o setLabel
 public void setLabel(Vector aVector)
sets the label to the String corresponding to the Vector of Strings passed

 o labelToStateList
 public int labelToStateList(Desktop nfa)
turns the label into a list of the corresponding States in the passed nfa

Returns:
the integer corresponding to any nonexisting states in the nfa. or -1 if the label is the empty String or -2 if the operation succeeded
 o stateListToLabel
 public void stateListToLabel()
turns a list of States in the corresponding nfa into a String and stores it as the label

 o compareLabel
 public boolean compareLabel(State aState)
Compares the label of this State with that of the passed State. Precondition: both States already have properly set (and sorted) stateLists.

Returns:
true if the two Labels are the same
 o paint
 public void paint(Graphics g,
                   boolean showDfaLabels)
Paints a state.

 o paintDfaLabel
 public void paintDfaLabel(Graphics g,
                           State selectedDfaState)
Paints the label of a State in DFA mode.

 o paintInitial
 public void paintInitial(Graphics g,
                          Desktop d)
Paints the triangle that represents the initial state.

 o processKey
 public boolean processKey(int key,
                           KeyEvent e)
handles keyEvents on StateDfalabels for the Desktop


All Packages  Class Hierarchy  This Package  Previous  Next  Index