|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Objectcom.saxonica.fsa.FiniteStateMachine
public class FiniteStateMachine
Class representing a finite state machine, as a collection of states with transitions between them
| Constructor Summary | |
|---|---|
FiniteStateMachine(boolean determinized)
Create a finite state machine |
|
| Method Summary | |
|---|---|
void |
allocateStateNumber(AutomatonState state)
Allocate a unique number to a state, and index the state from the FSM |
static NonDeterminizedState |
compileParticle(SchemaCompiler compiler,
Particle particle,
NonDeterminizedState endState,
UserComplexType subjectType,
FiniteStateMachine machine)
Static method to translate a particle to a Finite State Automaton, returning the start state of the FSA. |
static FiniteStateMachine |
determinize(FiniteStateMachine nfsa)
Determinize the finite state machine: that is, ensure that there are no ambiguous transitions from this state. |
void |
display()
Display the finite state machine. |
AutomatonState |
getInitialState()
Get the initial state of this finite state machine |
int |
getNumberOfStates()
Determine the number of states in this finite state machine |
AutomatonState |
getState(int number)
Get the state with a given unique state number |
void |
serialize(SchemaModelSerializer serializer)
Output a reppresentation of this finite state machine |
void |
setInitialState(AutomatonState initialState)
Set the initial state of this finite state machine |
static String |
subsumesMachine(FiniteStateMachine base,
FiniteStateMachine sub,
SchemaCompiler compiler)
Test whether one finite state machine subsumes another FSM: that is, whether for each path through the second FSM, there is a corresponding path through the first FSM. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FiniteStateMachine(boolean determinized)
determinized - true if this machine is determinized| Method Detail |
|---|
public void allocateStateNumber(AutomatonState state)
state - the state whose number is to be allocatedpublic int getNumberOfStates()
public AutomatonState getInitialState()
public void setInitialState(AutomatonState initialState)
initialState - the initial statepublic AutomatonState getState(int number)
number - the number of the state
public static NonDeterminizedState compileParticle(SchemaCompiler compiler,
Particle particle,
NonDeterminizedState endState,
UserComplexType subjectType,
FiniteStateMachine machine)
throws SchemaException,
UnresolvedReferenceException
compiler - user for error reportingparticle - 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 belongsmachine - the finite state machine to which the state belongs
SchemaException
UnresolvedReferenceExceptionpublic void display()
public static String subsumesMachine(FiniteStateMachine base,
FiniteStateMachine sub,
SchemaCompiler compiler)
base - the first FSM (representing the base type)sub - the other FSM (representing the type that is derived by restriction, validly or otherwise)compiler - used for error reporting
public static FiniteStateMachine determinize(FiniteStateMachine nfsa)
throws SchemaException
This is a revised implementation, based more closely on Aho and Ullman p93, to try to eliminate the rare problems that occur when a state has two transitions for the same symbol. (Given UPA, this should occur only with nested loops, e.g. (a{10,11}){1,3} which allows a sequence of 10, 20, 30, 11, 22, or 33 a's.)
nfsa - the finite state machine to be determinized
SchemaException
public void serialize(SchemaModelSerializer serializer)
throws XPathException
serializer - the schema model serializer to which this representation is to be written
XPathException - if any error occurs during serialization
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||