|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.sf.vex.dom.DFAState
Represents a state in a deterministic finite automaton (DFA). A DFA can be thought of as a directed graph, where each arc in the graph represents a transition on an input symbol to a new state (i.e. a node in the graph.) The DFA has a start state and one or more accepting states. The DFA represents a grammar. If a sequence of input symbols drives the DFA from the start state to one of the accepting states, the sequence is a valid sentence in the grammar represented by the DFA.
Within VEX, we use a DFA to validate the sequence of children of a given element. A DFA is constructed for each element declaration in the DTD.
Constructor Summary | |
DFAState()
Class constructor. |
Method Summary | |
void |
addTransition(java.lang.Object symbol,
DFAState target)
Adds an outgoing transition to the state. |
DFAState |
getNextState(java.lang.Object symbol)
Returns the next state given the given input symbol, or null if there are no outgoing transitions corresponding to the given symbol. |
DFAState |
getState(java.util.List sequence)
Return the state obtained by traversing the given list of symbols. |
java.util.Set |
getValidSymbols()
Returns the set of symbols that are valid for this state. |
boolean |
isAccepting()
Returns true if this is an accepting state of the DFA. |
void |
setAccepting(boolean accepting)
Sets the value of the accepting property. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DFAState()
Method Detail |
public DFAState getState(java.util.List sequence)
sequence
- Sequence of symbols to use.public void addTransition(java.lang.Object symbol, DFAState target)
symbol
- Symbol that initiates the transition.target
- State to which the transition leads.public java.util.Set getValidSymbols()
public boolean isAccepting()
public DFAState getNextState(java.lang.Object symbol)
symbol
- input symbolpublic void setAccepting(boolean accepting)
accepting
- true if this an accepting state of the DFA.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |