|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.saxonica.fsa.AutomatonState
public abstract class AutomatonState
Defines a state of a finite state machine used when validating an instance against a complex type. 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 FiniteStateMachine object, which is itself a property of the UserComplexType against which validation is being performed.
This class is designed for internal use only.
Field Summary | |
---|---|
static Edge[] |
EMPTY_EDGE_ARRAY
|
protected Edge[] |
wildcardEdges
|
Constructor Summary | |
---|---|
AutomatonState(FiniteStateMachine machine)
Create a new state |
Method Summary | |
---|---|
void |
addSpecificTransition(Edge edge,
SchemaCompiler compiler)
Add a specific transition from this state to another state. |
void |
addWildcardTransition(SchemaCompiler compiler,
Edge transition)
Add a wildcard transition from this state to another state. |
void |
display(HashMap map)
Display the finite state machine reachable from this state. |
void |
displayLambdaTransitions()
Display the lambda transitions available from this state |
void |
displayState()
Display the finite state machine reachable from this state. |
Iterator<Edge> |
getEdges()
Get an iterator over all the transitions (edges) allowed from this state |
Edge |
getMaxTransition()
Get the transition to be used when the maxOccurs value is reached for a counting state. |
int |
getStateNumber()
Get the state number |
Edge |
getTransition(int token,
Configuration config)
Find the edge representing the transition from this state to another state, that is triggered by a given input token |
Edge[] |
getWildcardEdges()
Get an iterator over the wildcard transitions (edges) allowed from this state. |
boolean |
isConditionallyFinalState()
Test whether this state is a final state assuming the counter has reached its minimum value |
boolean |
isFinalState()
Test whether this state is a final state |
CharSequence |
listAllowedElements()
List the allowed elements in this state as a string, for use in error messages |
boolean |
requiresCounter()
Ask whether this is a counting state |
void |
serialize(SchemaModelSerializer serializer)
Serialize this state as part of the serialization of a schema component model |
void |
setFinalState(boolean finalState)
Set this state to be (or not to be) a final state |
void |
setLimits(int min,
int max)
Set the counter limits |
void |
setMaxTransition(Edge edge)
A counting state may have a special Edge that is used when the maxOccurs value is reached. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Edge[] wildcardEdges
public static final Edge[] EMPTY_EDGE_ARRAY
Constructor Detail |
---|
public AutomatonState(FiniteStateMachine machine)
machine
- the finite state machine to which this State belongsMethod Detail |
---|
public boolean isFinalState()
isFinalState
in interface State
public boolean isConditionallyFinalState()
public void setFinalState(boolean finalState)
finalState
- true if this state is finalpublic int getStateNumber()
public void addSpecificTransition(Edge edge, SchemaCompiler compiler) throws SchemaException
edge
- the transition to be addedcompiler
-
SchemaException
- if there are two transitions for the same element
declaration, that is, if the content model is ambiguouspublic void addWildcardTransition(SchemaCompiler compiler, Edge transition) throws SchemaException
compiler
- transition
- the edge representing the transition
SchemaException
public void setLimits(int min, int max)
min
- the minimum number of occurrences of counting edges before a non-counting edge is usedmax
- the maximum number of occurrences of counting edges before a non-counting edge is used;
the value -1 means unboundedpublic boolean requiresCounter()
public Edge getTransition(int token, Configuration config)
getTransition
in interface State
token
- the input token, specifically the fingerprint of an element nameconfig
- the Saxon Configuration
public CharSequence listAllowedElements()
listAllowedElements
in interface State
public Edge[] getWildcardEdges()
getWildcardEdges
in interface State
Edge
objects.public Iterator<Edge> getEdges()
getEdges
in interface State
Edge
objects.public void display(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.public void displayState()
public void displayLambdaTransitions()
public void setMaxTransition(Edge edge)
public Edge getMaxTransition()
public void serialize(SchemaModelSerializer serializer) throws XPathException
serializer
- used to output the model
XPathException
- if any failure occurs
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |