|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.saxonica.schema.AutomatonState
Defines a state of a finite state machine used when validating an instance against a complex type. There is no object (other than the UserComplexType object) that represents the entire finite state machine. Each State knows about the possible transitions to other states, and knows whether it is a final state. The initial state is referenced from the UserComplexType object against which validation is being performed.
This class is designed for internal use only.
Nested Class Summary | |
static class |
AutomatonState.Edge
Internal class to represent the data associated with a transition: the element that triggers the transition, and the new state that results from the transition. |
Field Summary | |
static AutomatonState.Edge[] |
EMPTY_EDGE_ARRAY
|
Constructor Summary | |
AutomatonState()
Create a new state |
Method Summary | |
void |
addLambdaTransition(AutomatonState newState)
Add a lambda transition from this state to another state. |
void |
addWildcardTransition(AutomatonState.Edge transition)
Add a wildcard transition from this state to another state. |
static AutomatonState |
compileParticle(Particle particle,
AutomatonState endState,
UserComplexType subjectType)
Static method to translate a particle to a Finite State Automaton, returning the start state of the FSA. |
void |
determinize()
Determinize the tree: that is, ensure that there are no ambiguous transitions from this state. |
void |
display(java.util.HashMap map)
Display the finite state machine reachable from this state. |
java.util.Iterator |
getEdges()
Get an iterator over all the transitions (edges) allowed from this state |
AutomatonState.Edge |
getTransition(int token,
NamePool pool)
Find the edge representing the transition from this state to another state, that is triggered by a given input token |
AutomatonState.Edge[] |
getWildcardEdges()
Get an iterator over the wildcard transitions (edges) allowed from this state. |
boolean |
isFinalState()
Test whether this state is a final state |
java.lang.CharSequence |
listAllowedElements()
List the allowed elements in this state as a string, for use in error messages |
void |
setFinalState(boolean finalState)
Set this state to be (or not to be) a final state |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final AutomatonState.Edge[] EMPTY_EDGE_ARRAY
Constructor Detail |
public AutomatonState()
Method Detail |
public static AutomatonState compileParticle(Particle particle, AutomatonState endState, UserComplexType subjectType) throws SchemaException, UnresolvedReferenceException
particle
- the particle to be compiled, which is either an ElementDeclaration,
a WildCard, a choice, or a sequenceendState
- the State representing the final state of the automatonsubjectType
- the complex type to which this particle belongs
SchemaException
UnresolvedReferenceException
public boolean isFinalState()
public void setFinalState(boolean finalState)
finalState
- true if this state is finalpublic void addLambdaTransition(AutomatonState newState)
newState
- the state that results from this eventpublic void addWildcardTransition(AutomatonState.Edge transition) throws SchemaException
transition
- the edge representing the transition
SchemaException
public void determinize() throws SchemaException
SchemaException
- if while determinizing the finite state machine
it is found to contain non-deterministic transitions.public AutomatonState.Edge getTransition(int token, NamePool pool)
token
- the input token, specifically the fingerprint of an element name
public java.lang.CharSequence listAllowedElements()
public AutomatonState.Edge[] getWildcardEdges()
AutomatonState.Edge
objects.public java.util.Iterator getEdges()
AutomatonState.Edge
objects.public void display(java.util.HashMap map)
map
- a Hashmap mapping states already processed to the integer values used to represent that state.
The method should be called initially with an empty map.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |