## com.saxonica.fsa
Class AutomatonState

    java.lang.Object
      com.saxonica.fsa.AutomatonState

Direct Known Subclasses:
  DeterminizedState, NonDeterminizedState

    public abstract class AutomatonState

extends Object

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`

Constructor Summary
`AutomatonState(FiniteStateMachine machine)` Create a new state

Method Summary
`void` `addWildcardTransition(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()`
`void` `displayState()` Display the finite state machine reachable from this state.
`Iterator` `getEdges()` Get an iterator over all the transitions (edges) allowed from this state
`Edge` `getSpecificTransition(int token)` Get a specific transition if there is one
`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
`Edge[]` `getWildcardEdges()` Get an iterator over the wildcard transitions (edges) allowed from this state.
`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
`void` `setFinalState(boolean finalState)` Set this state to be (or not to be) a final state

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### EMPTY_EDGE_ARRAY

    public static final Edge[] EMPTY_EDGE_ARRAY

Constructor Detail

### AutomatonState

    public AutomatonState(FiniteStateMachine machine)

  Create a new state

  Parameters:
    `machine` -

Method Detail

### isFinalState

    public boolean isFinalState()

  Test whether this state is a final state

  Returns:
    true if this is a final state

### setFinalState

    public void setFinalState(boolean finalState)

  Set this state to be (or not to be) a final state

  Parameters:
    `finalState` - true if this state is final

### addWildcardTransition

    public void addWildcardTransition(Edge transition)
                               throws SchemaException

  Add a wildcard transition from this state to another state.

  Parameters:
    `transition` - the edge representing the transition
  Throws:
    `SchemaException`

### getTransition

    public 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

  Parameters:
    `token` - the input token, specifically the fingerprint of an element name
  Returns:
    the new State of the finite state machine, or null if this token is not accepted when in this State (which implies a validation error).

### getSpecificTransition

    public Edge getSpecificTransition(int token)

  Get a specific transition if there is one

### listAllowedElements

    public CharSequence listAllowedElements()

  List the allowed elements in this state as a string, for use in error messages

  Returns:
    the list of permitted elements as a string containing comma-separated element names

### getWildcardEdges

    public Edge[] getWildcardEdges()

  Get an iterator over the wildcard transitions (edges) allowed from this state.

  Returns:
    an Iterator over the edges that represent element wildcards. The objects returned by this Iterator are `Edge` objects.

### getEdges

    public Iterator getEdges()

  Get an iterator over all the transitions (edges) allowed from this state

  Returns:
    an Iterator over all the edges from this state. The objects returned by this Iterator are `Edge` objects.

### display

    public void display(HashMap map)

  Display the finite state machine reachable from this state. This is a diagnostic method for internal use. Output is written to System.err. At present, wildcard transitions are not shown.

  Parameters:
    `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.

### displayState

    public void displayState()

  Display the finite state machine reachable from this state. This is a diagnostic method for internal use. Output is written to System.err. At present, wildcard transitions are not shown.

### displayLambdaTransitions

    public void displayLambdaTransitions()

Copyright (C) Michael H. Kay. All rights reserved.