Package pyxb :: Package utils :: Module fac :: Class State |
[hide private]
[frames] | no frames]

# type State

source code

    object --+
             |
            State

A thin wrapper around an object reference.

The state of the automaton corresponds to a position, or marked symbol, in the term tree. Because the same symbol may appear at multiple locations in the tree, and the distinction between these positions is critical, a State wrapper is provided to maintain distinct values.

Instance Methods | [hide private]
__init__(self, symbol, is_initial, final_update=None, is_unordered_catenation=False) Create a FAC state. | source code
__get_automaton(self) Link to the Automaton to which the state belongs. | source code
_set_automaton(self, automaton) Method invoked during automaton construction to set state owner. | source code
__get_symbol(self) Application-specific metadata identifying the symbol. | source code
__get_isUnorderedCatenation(self) Indicate whether the state has subautomata for unordered catenation. | source code
__get_subAutomata(self) A sequence of sub-automata supporting internal state transitions. | source code
_set_subAutomata(self, *automata) | source code
__get_isInitial(self) `True` iff this state may be the first state the automaton enters. | source code
__get_automatonEntryTransitions(self) Return the set of initial transitions allowing entry to the automata through this state. | source code
__get_finalUpdate(self) Return the update instructions that must be satisfied for this to be a final state. | source code
subAutomataInitialTransitions(self, sub_automata=None) Return the set of candidate transitions to enter a sub-automaton of this state. | source code
isAccepting(self, counter_values) `True` iff this state is an accepting state for the automaton. | source code
__get_transitionSet(self) Definitions of viable transitions from this state. | source code
_set_transitionSet(self, transition_set) Method invoked during automaton construction to set the legal transitions from the state. | source code
match(self, symbol) Return `True` iff the symbol matches for this state. | source code
__str__(self) | source code
_facText(self) | source code

Class Variables | [hide private]
| __automaton = `None`
| __symbol = `None`
| __isUnorderedCatenation = `None`
| __subAutomata = `None`
| __isInitial = `None`
| __automatonEntryTransitions = `None`
| __finalUpdate = `None`
| __transitionSet = `None`

Properties | [hide private]
| automaton Link to the Automaton to which the state belongs.
| symbol Application-specific metadata identifying the symbol.
| isUnorderedCatenation Indicate whether the state has subautomata for unordered catenation.
| subAutomata A sequence of sub-automata supporting internal state transitions.
| isInitial `True` iff this state may be the first state the automaton enters.
| automatonEntryTransitions Return the set of initial transitions allowing entry to the automata through this state.
| finalUpdate Return the update instructions that must be satisfied for this to be a final state.
| transitionSet Definitions of viable transitions from this state.

Method Details | [hide private]

### __init__(self, symbol, is_initial, final_update=None, is_unordered_catenation=False) (Constructor) | source code
Create a FAC state. Parameters: `symbol` - The symbol associated with the state. Normally initialized from the Symbol.metadata value. The state may be entered if, among other conditions, the match routine accepts the proposed input as being consistent with this value. `is_initial` - `True` iff this state may serve as the first state of the automaton. `final_update` - `None` if this state is not an accepting state of the automaton; otherwise a set of UpdateInstruction values that must be satisfied by the counter values in a configuration as a further restriction of acceptance. `is_unordered_catenation` - `True` if this state has subautomata that must be matched to execute the unordered catenation of an All node; `False` if this is a regular symbol. Overrides: object.__init__

### __get_symbol(self) | source code
Application-specific metadata identifying the symbol. See also match.

### __get_isUnorderedCatenation(self) | source code
Indicate whether the state has subautomata for unordered catenation. To reduce state explosion due to non-determinism, such a state executes internal transitions in subautomata until all terms have matched or a failure is discovered.

### __get_subAutomata(self) | source code
A sequence of sub-automata supporting internal state transitions. This will return `None` unless isUnorderedCatenation is `True`.

### __get_automatonEntryTransitions(self) | source code
Return the set of initial transitions allowing entry to the automata through this state. These are structurally-permitted transitions only, and must be filtered based on the symbol that might trigger the transition. The results are not filtered based on counter value, since this value is used to determine how the containing automaton might be entered. Consequently the return value is the empty set unless this is an initial state. The returned set is closed under entry to sub-automata, i.e. it is guaranteed that each transition includes a consuming state even if it requires a multi-element chain of transitions into subautomata to reach one.

### subAutomataInitialTransitions(self, sub_automata=None) | source code
Return the set of candidate transitions to enter a sub-automaton of this state. Parameters: `sub_automata` - A subset of the sub-automata of this state which should contribute to the result. If `None`, all sub-automata are used. Returns: A pair `(nullable, transitions)` where `nullable` is `True` iff there is at least one sub-automaton that is in an accepting state on entry, and `transitions` is a list of Transition instances describing how to reach some state in a sub-automaton via a consumed symbol.

### isAccepting(self, counter_values) | source code
`True` iff this state is an accepting state for the automaton. Parameters: `counter_values` - Counter values that further validate whether the requirements of the automaton have been met. Returns: `True` if this is an accepting state and the counter values relevant at it are satisfied.

### __get_transitionSet(self) | source code
Definitions of viable transitions from this state. The transition set of a state is a set of Transition nodes identifying a state reachable in a single step from this state, and a set of counter updates that must apply if the transition is taken. These transitions may not in themselves consume a symbol. For example, if the destination state represents a match of an unordered catenation of terms, then secondary processing must be done to traverse into the automata for those terms and identify transitions that include a symbol consumption. Note: Although conceptually the viable transitions are a set, this implementation maintains them in a list so that order is preserved when automata processing becomes non-deterministic. PyXB is careful to build the transition list so that the states are attempted in the order in which they appear in the schema that define the automata.

### _set_transitionSet(self, transition_set) | source code
Method invoked during automaton construction to set the legal transitions from the state. The set of transitions cannot be defined until all states that appear in it are available, so the creation of the automaton requires that the association of the transition set be delayed. (Though described as a set, the transitions are a list where order reflects priority.) Parameters: `transition_set` - a list of pairs where the first member is the destination State and the second member is the set of UpdateInstructions that apply when the automaton transitions to the destination state.

### match(self, symbol) | source code
Return `True` iff the symbol matches for this state. This may be overridden by subclasses when matching by equivalence does not work. Alternatively, if the symbol stored in this node is a subclass of SymbolMatch_mixin, then its match method will be used. Otherwise `symbol` matches only if it is equal to the symbol of this state. Parameters: `symbol` - A candidate symbol corresponding to the expression symbol for this state. Returns: `True` iff `symbol` is a match for this state.

### __str__(self) (Informal representation operator) | source code
Overrides: object.__str__ (inherited documentation)

Property Details | [hide private]

### automaton Link to the Automaton to which the state belongs. Get Method: __get_automaton(self) - Link to the Automaton to which the state belongs.

### symbol Application-specific metadata identifying the symbol. See also match. Get Method: __get_symbol(self) - Application-specific metadata identifying the symbol.

### isUnorderedCatenation Indicate whether the state has subautomata for unordered catenation. To reduce state explosion due to non-determinism, such a state executes internal transitions in subautomata until all terms have matched or a failure is discovered. Get Method: __get_isUnorderedCatenation(self) - Indicate whether the state has subautomata for unordered catenation.

### subAutomata A sequence of sub-automata supporting internal state transitions. This will return `None` unless isUnorderedCatenation is `True`. Get Method: __get_subAutomata(self) - A sequence of sub-automata supporting internal state transitions.

### isInitial `True` iff this state may be the first state the automaton enters. Get Method: __get_isInitial(self) - `True` iff this state may be the first state the automaton enters.

### automatonEntryTransitions Return the set of initial transitions allowing entry to the automata through this state. These are structurally-permitted transitions only, and must be filtered based on the symbol that might trigger the transition. The results are not filtered based on counter value, since this value is used to determine how the containing automaton might be entered. Consequently the return value is the empty set unless this is an initial state. The returned set is closed under entry to sub-automata, i.e. it is guaranteed that each transition includes a consuming state even if it requires a multi-element chain of transitions into subautomata to reach one. Get Method: __get_automatonEntryTransitions(self) - Return the set of initial transitions allowing entry to the automata through this state.

### finalUpdate Return the update instructions that must be satisfied for this to be a final state. Get Method: __get_finalUpdate(self) - Return the update instructions that must be satisfied for this to be a final state.

### transitionSet Definitions of viable transitions from this state. The transition set of a state is a set of Transition nodes identifying a state reachable in a single step from this state, and a set of counter updates that must apply if the transition is taken. These transitions may not in themselves consume a symbol. For example, if the destination state represents a match of an unordered catenation of terms, then secondary processing must be done to traverse into the automata for those terms and identify transitions that include a symbol consumption. Get Method: __get_transitionSet(self) - Definitions of viable transitions from this state. Note: Although conceptually the viable transitions are a set, this implementation maintains them in a list so that order is preserved when automata processing becomes non-deterministic. PyXB is careful to build the transition list so that the states are attempted in the order in which they appear in the schema that define the automata.