52 #ifndef Patternist_XsdStateMachine_H 53 #define Patternist_XsdStateMachine_H 57 #include <QtCore/QHash> 58 #include <QtCore/QSet> 59 #include <QtCore/QTextStream> 75 template <
typename TransitionType>
143 bool proceed(TransitionType transition);
159 template <
typename InputType>
165 template <
typename InputType>
238 while (!workStates.
isEmpty()) {
241 const StateId state = workStates.
takeFirst();
246 for (
int i = 0; i < targetStates.
count(); ++i) {
255 workStates.
append(targetStates.
at(i));
274 QSetIterator<StateId>
it(states);
275 while (it.hasNext()) {
276 const StateId state = it.next();
285 for (
int i = 0; i < targetStates.
size(); ++i)
XsdStateMachine< TransitionType > toDFA() const
#define QT_END_NAMESPACE
This macro expands to.
void addTransition(StateId start, TransitionType transition, StateId end)
#define it(className, varName)
int count(const T &t) const
Returns the number of occurrences of value in the vector.
QHash< StateId, QHash< TransitionType, QVector< StateId > > > m_transitions
The QString class provides a Unicode character string.
Any state that is not start or end state.
const T value(const Key &key) const
Returns the value associated with the key.
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
TransitionType m_lastTransition
void append(const T &t)
Inserts value at the end of the list.
#define QT_BEGIN_NAMESPACE
This macro expands to.
QString transitionTypeToString(TransitionType type) const
bool contains(const T &value) const
T takeFirst()
Removes the first item in the list and returns it.
QList< T > toList() const
QHash< StateId, StateType > states() const
The namespace for the internal API of QtXmlPatterns.
const_iterator insert(const T &value)
bool outputGraph(QIODevice *device, const QString &graphName) const
The state the machine will start with, can be end state as well.
const T & at(int i) const
Returns the item at index position i in the vector.
QHash< StateId, QVector< StateId > > m_epsilonTransitions
StateId dfaStateForNfaState(QSet< StateId > nfaState, QList< QPair< QSet< StateId >, StateId > > &stateTable, XsdStateMachine< TransitionType > &dfa) const
QHash< StateId, StateType > m_states
QHash< StateId, QHash< TransitionType, QVector< StateId > > > transitions() const
void addEpsilonTransition(StateId start, StateId end)
bool proceed(TransitionType transition)
QSet< StateId > move(const QSet< StateId > &states, TransitionType input) const
StateId startState() const
A state machine used for evaluation.
The state the machine will start with.
Any state where the machine is allowed to stop.
QList< TransitionType > possibleTransitions() const
static const KeyPair *const end
The QIODevice class is the base interface class of all I/O devices in Qt.
QSet< StateId > epsilonClosure(const QSet< StateId > &input) const
int size() const
Returns the number of items in the vector.
bool inputEqualsTransition(InputType input, TransitionType transition) const
TransitionType lastTransition() const
StateId addState(StateType type)
The QList class is a template class that provides lists.