|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.saxonica.schema.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<AutomatonState,Integer> map)
Display the finite state machine reachable from this state. |
void |
displayLambdaTransitions()
Display the lambda transitions available from this state |
void |
displayState(PrintStream err)
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,
UserComplexType type)
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 belongs| Method Detail |
|---|
public boolean isFinalState()
isFinalState in interface Statepublic 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 - the schema compiler
SchemaException - if there are two transitions for the same element
declaration, that is, if the content model is ambiguous
public void addWildcardTransition(SchemaCompiler compiler,
Edge transition)
throws SchemaException
compiler - the schema compilertransition - the edge representing the transition
SchemaException - if the transition cannot be added because
it would generate an inconsistency
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,
UserComplexType type)
getTransition in interface Statetoken - the input token, specifically the fingerprint of an element nametype - the complex type we are validating against
public CharSequence listAllowedElements()
listAllowedElements in interface Statepublic Edge[] getWildcardEdges()
getWildcardEdges in interface StateEdge objects.public Iterator<Edge> getEdges()
getEdges in interface StateEdge objects.public void display(HashMap<AutomatonState,Integer> 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(PrintStream err)
err - the output destination destinationpublic void displayLambdaTransitions()
public void setMaxTransition(Edge edge)
edge - the transition to be used when the maxOccurs value is reachedpublic 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 | ||||||||