![]() |
Qt 4.8
|
A state machine used for evaluation. More...
#include <qxsdstatemachine_p.h>
Public Types | |
| typedef qint32 | StateId |
| enum | StateType { StartState, StartEndState, InternalState, EndState } |
Public Functions | |
| void | addEpsilonTransition (StateId start, StateId end) |
| StateId | addState (StateType type) |
| void | addTransition (StateId start, TransitionType transition, StateId end) |
| void | clear () |
| bool | inEndState () const |
| template<> | |
| bool | inputEqualsTransition (QXmlName name, XsdTerm::Ptr term) const |
| template<typename InputType > | |
| bool | inputEqualsTransition (InputType input, TransitionType transition) const |
| template<typename InputType > | |
| bool | inputEqualsTransition (InputType input, TransitionType transition) const |
| TransitionType | lastTransition () const |
| bool | outputGraph (QIODevice *device, const QString &graphName) const |
| QList< TransitionType > | possibleTransitions () const |
| template<typename TransitionType > | |
| bool | proceed (TransitionType transition) |
| bool | proceed (TransitionType transition) |
| template<typename InputType > | |
| bool | proceed (InputType input) |
| template<typename InputType > | |
| bool | proceed (InputType input) |
| void | reset () |
| StateId | startState () const |
| QHash< StateId, StateType > | states () const |
| XsdStateMachine< TransitionType > | toDFA () const |
| QHash< StateId, QHash< TransitionType, QVector< StateId > > > | transitions () const |
| template<> | |
| QString | transitionTypeToString (XsdTerm::Ptr term) const |
| QString | transitionTypeToString (TransitionType type) const |
| XsdStateMachine () | |
| XsdStateMachine (const NamePool::Ptr &namePool) | |
Private Functions | |
| StateId | dfaStateForNfaState (QSet< StateId > nfaState, QList< QPair< QSet< StateId >, StateId > > &stateTable, XsdStateMachine< TransitionType > &dfa) const |
| QSet< StateId > | epsilonClosure (const QSet< StateId > &input) const |
| QSet< StateId > | move (const QSet< StateId > &states, TransitionType input) const |
Properties | |
| qint32 | m_counter |
| StateId | m_currentState |
| QHash< StateId, QVector< StateId > > | m_epsilonTransitions |
| TransitionType | m_lastTransition |
| NamePool::Ptr | m_namePool |
| QHash< StateId, StateType > | m_states |
| QHash< StateId, QHash< TransitionType, QVector< StateId > > > | m_transitions |
A state machine used for evaluation.
Definition at line 76 of file qxsdstatemachine_p.h.
| typedef qint32 QPatternist::XsdStateMachine< TransitionType >::StateId |
Definition at line 79 of file qxsdstatemachine_p.h.
| enum QPatternist::XsdStateMachine::StateType |
Describes the type of state.
Definition at line 84 of file qxsdstatemachine_p.h.
| QPatternist::XsdStateMachine< TransitionType >::XsdStateMachine | ( | ) |
| QPatternist::XsdStateMachine< TransitionType >::XsdStateMachine | ( | const NamePool::Ptr & | namePool | ) |
Creates a new state machine object.
The name pool to use for accessing object names.
Definition at line 54 of file qxsdstatemachine.cpp.
| void QPatternist::XsdStateMachine< TransitionType >::addEpsilonTransition | ( | StateId | start, |
| StateId | end | ||
| ) |
Adds a new epsilon transition to the state machine.
| start | The start state. |
| end | The end state. |
Definition at line 95 of file qxsdstatemachine.cpp.
| XsdStateMachine< TransitionType >::StateId QPatternist::XsdStateMachine< TransitionType >::addState | ( | StateType | type | ) |
Adds a new state of the given type to the state machine.
Definition at line 61 of file qxsdstatemachine.cpp.
Referenced by QPatternist::XsdStateMachine< XsdSchemaToken::NodeName >::dfaStateForNfaState(), and QPatternist::XsdSchemaParser::setupStateMachines().
| void QPatternist::XsdStateMachine< TransitionType >::addTransition | ( | StateId | start, |
| TransitionType | transition, | ||
| StateId | end | ||
| ) |
Adds a new transition to the state machine.
| start | The start state. |
| transition | The transition to come from the start to the end state. |
| end | The end state. |
Definition at line 86 of file qxsdstatemachine.cpp.
Referenced by QPatternist::XsdSchemaParser::setupStateMachines(), and QPatternist::XsdStateMachine< XsdSchemaToken::NodeName >::toDFA().
| void QPatternist::XsdStateMachine< TransitionType >::clear | ( | void | ) |
Removes all states and transitions from the state machine.
Definition at line 118 of file qxsdstatemachine.cpp.
|
private |
Returns the DFA state for the given nfaStat from the given stateTable. If there is no corresponding DFA state yet, a new one is created.
Definition at line 294 of file qxsdstatemachine.cpp.
Referenced by QPatternist::XsdStateMachine< XsdSchemaToken::NodeName >::transitions().
|
inlineprivate |
Returns the set of all states that can be reached from the set of input states by the epsilon transition.
The implementation is inlined in order to workaround a compiler bug on Symbian/winscw.
Definition at line 230 of file qxsdstatemachine_p.h.
| bool QPatternist::XsdStateMachine< TransitionType >::inEndState | ( | ) | const |
Returns whether the machine is in an allowed end state.
Definition at line 192 of file qxsdstatemachine.cpp.
| bool QPatternist::XsdStateMachine< XsdTerm::Ptr >::inputEqualsTransition< QXmlName > | ( | QXmlName | name, |
| XsdTerm::Ptr | term | ||
| ) | const |
Definition at line 81 of file qxsdvalidatinginstancereader.cpp.
| bool QPatternist::XsdStateMachine< TransitionType >::inputEqualsTransition | ( | InputType | input, |
| TransitionType | transition | ||
| ) | const |
Returns whether the given input matches the given transition.
Definition at line 187 of file qxsdstatemachine_p.h.
| bool QPatternist::XsdStateMachine< TransitionType >::inputEqualsTransition | ( | InputType | input, |
| TransitionType | transition | ||
| ) | const |
Definition at line 186 of file qxsdstatemachine.cpp.
| TransitionType QPatternist::XsdStateMachine< TransitionType >::lastTransition | ( | ) | const |
Returns the last transition that was taken.
Definition at line 199 of file qxsdstatemachine.cpp.
|
inlineprivate |
Returns the set of all states that can be reached from the set of given states by the given input.
The implementation is inlined in order to workaround a compiler bug on Symbian/winscw.
Definition at line 270 of file qxsdstatemachine_p.h.
| bool QPatternist::XsdStateMachine< TransitionType >::outputGraph | ( | QIODevice * | device, |
| const QString & | graphName | ||
| ) | const |
Outputs the state machine in DOT format to the given output device.
Definition at line 227 of file qxsdstatemachine.cpp.
| QList< TransitionType > QPatternist::XsdStateMachine< TransitionType >::possibleTransitions | ( | ) | const |
Returns the list of transitions that are reachable from the current state.
Definition at line 147 of file qxsdstatemachine.cpp.
| bool QPatternist::XsdStateMachine< TransitionType >::proceed | ( | TransitionType | transition | ) |
Definition at line 128 of file qxsdstatemachine.cpp.
| bool QPatternist::XsdStateMachine< TransitionType >::proceed | ( | TransitionType | transition | ) |
Continues execution of the machine with the given input transition.
true if the transition was successful, false otherwise. Definition at line 129 of file qxsdstatemachine_p.h.
| bool QPatternist::XsdStateMachine< TransitionType >::proceed | ( | InputType | input | ) |
Continues execution of the machine with the given input.
true if the transition was successful, false otherwise. Definition at line 163 of file qxsdstatemachine_p.h.
| bool QPatternist::XsdStateMachine< TransitionType >::proceed | ( | InputType | input | ) |
Definition at line 162 of file qxsdstatemachine.cpp.
| void QPatternist::XsdStateMachine< TransitionType >::reset | ( | ) |
Resets the machine to the start state.
Definition at line 102 of file qxsdstatemachine.cpp.
| XsdStateMachine< TransitionType >::StateId QPatternist::XsdStateMachine< TransitionType >::startState | ( | ) | const |
Returns the start state of the machine.
Definition at line 205 of file qxsdstatemachine.cpp.
Referenced by QPatternist::XsdParticleChecker::subsumes().
| QHash< typename XsdStateMachine< TransitionType >::StateId, typename XsdStateMachine< TransitionType >::StateType > QPatternist::XsdStateMachine< TransitionType >::states | ( | ) | const |
Returns the information of all states of the state machine.
Definition at line 410 of file qxsdstatemachine.cpp.
Referenced by QPatternist::XsdParticleChecker::isUPAConform(), and QPatternist::XsdParticleChecker::subsumes().
| XsdStateMachine< TransitionType > QPatternist::XsdStateMachine< TransitionType >::toDFA | ( | ) | const |
Returns a DFA that is equal to the NFA of the state machine.
Definition at line 339 of file qxsdstatemachine.cpp.
Referenced by QPatternist::XsdValidatingInstanceReader::createAndPushStateMachine(), QPatternist::XsdParticleChecker::isUPAConform(), and QPatternist::XsdParticleChecker::subsumes().
|
inline |
Returns the information of all transitions of the state machine.
The implementation is inlined in order to workaround a compiler bug on Symbian/winscw.
Definition at line 211 of file qxsdstatemachine_p.h.
Referenced by QPatternist::XsdParticleChecker::isUPAConform(), QPatternist::XsdStateMachine< XsdSchemaToken::NodeName >::move(), and QPatternist::XsdParticleChecker::subsumes().
| QString QPatternist::XsdStateMachine< XsdTerm::Ptr >::transitionTypeToString | ( | XsdTerm::Ptr | term | ) | const |
This template specialization is picked up by XsdStateMachine and allows us to print nice edge labels.
Definition at line 64 of file qxsdparticlechecker.cpp.
| QString QPatternist::XsdStateMachine< TransitionType >::transitionTypeToString | ( | TransitionType | type | ) | const |
This method should be redefined by template specialization for every concret TransitionType.
Definition at line 219 of file qxsdstatemachine.cpp.
|
private |
Definition at line 297 of file qxsdstatemachine_p.h.
Referenced by QPatternist::XsdStateMachine< XsdSchemaToken::NodeName >::toDFA().
|
private |
Definition at line 296 of file qxsdstatemachine_p.h.
|
private |
Definition at line 295 of file qxsdstatemachine_p.h.
Referenced by QPatternist::XsdStateMachine< XsdSchemaToken::NodeName >::epsilonClosure().
|
private |
Definition at line 298 of file qxsdstatemachine_p.h.
|
private |
Definition at line 292 of file qxsdstatemachine_p.h.
|
private |
Definition at line 293 of file qxsdstatemachine_p.h.
|
private |
Definition at line 294 of file qxsdstatemachine_p.h.
Referenced by QPatternist::XsdStateMachine< XsdSchemaToken::NodeName >::move(), and QPatternist::XsdStateMachine< XsdSchemaToken::NodeName >::transitions().