Implements IAutomaton, provides some methods for giving private implementations. More...
#include <automataCreator.h>
Public Types | |
typedef QList< QSharedPointer < AutomatonImpl > > | TAutomatonList |
Public Member Functions | |
AutomatonImpl (const ITransition::TCharSet &alphabet, const QString &alphabetSymbol, const QString &epsilonSymbol) | |
~AutomatonImpl () | |
virtual void | addLists (const StateImpl::TStateList &states, const TransitionImpl::TTransitionList &transitions) |
virtual bool | addState (const QSharedPointer< StateImpl > &state) |
virtual bool | addTransition (const QSharedPointer< TransitionImpl > &tr) |
virtual bool | allowRedundantTransitions () const |
QSharedPointer< TransitionImpl > | createAndAddPrivateTransition (const QString &source, const QString &dest, const ITransition::TCharSet &characters, Transition *graphicsTransition) |
QSharedPointer< TransitionImpl > | createPrivateTransition (const QString &source, const QString &dest, const ITransition::TCharSet &characters, const TransitionImpl::TTransitionList &transitions, bool &created, Transition *graphicsTransition) |
virtual QSharedPointer< IState > | createState (const QString &name, const QString &label, bool initial, bool final) |
Creates and adds state to automaton (returns NULL if failed). | |
virtual QSharedPointer < ITransition > | createTransition (const QString &source, const QString &dest, const ITransition::TCharSet &characters) |
virtual IState::TIStateList | getActiveStates () const |
Returns currently active states. | |
virtual QStringList | getActiveStatesNames () const |
Returns active states names in QStringList. | |
virtual ITransition::TCharSet | getAlphabet () const |
virtual QString | getAlphabetSymbol () const |
virtual QString | getEpsilonSymbol () const |
virtual IState::TIStateList | getFinalStates () const |
virtual IState::TIStateList | getInitialStates () const |
virtual IAutomaton::TPositioningMap | getPositioningMap () const |
Returns positioning map. | |
StateImpl::TStateList | getPrivateActiveStates () const |
StateImpl::TStateList | getPrivateFinalStates () const |
StateImpl::TStateList | getPrivateInitialStates () const |
QSharedPointer< StateImpl > | getPrivateState (const QString &name) const |
StateImpl::TStateList | getPrivateStates () const |
TransitionImpl::TTransitionList | getPrivateTransitions () const |
virtual QStringList | getProcessedString () const |
Returns currently accepted string (nothing after reset()). | |
virtual QSharedPointer< IState > | getState (const QString &name) const |
virtual IState::TIStateNameList | getStateNameList () const |
virtual IState::TIStateList | getStates () const |
virtual ITransition::TITransitionList | getTransitions () const |
virtual ITransition::TCharSet | getTransitionSymbols (const QString &source, const QString &dest) const |
virtual QSharedPointer < ITransitionTable > | getTransitionTable () const |
virtual bool | hasEpsilonTransitions () const |
virtual bool | hasMultipleInitials () const |
virtual bool | hasPositions () const |
virtual bool | hasState (const QString &name) const |
virtual bool | isConfigurationAccepted () const |
Returns true if current configuration is ACCEPTed. | |
virtual bool | isDeterministic () const |
virtual bool | processCharacter (const QString &character) |
Process input character. | |
IState::TIStateNameSet | processCharacterWithInfo (const QString &character, QList< QPainterPath > &paths) |
virtual bool | removeState (const QSharedPointer< IState > &state) |
virtual bool | removeState (const QString &stateName) |
virtual bool | removeTransition (const QSharedPointer< TransitionImpl > &tr) |
virtual bool | removeTransition (const QSharedPointer< ITransition > &tr) |
virtual bool | renameState (const QSharedPointer< IState > &state, const QString &newName) |
Renames state and effects changed on transitions. | |
virtual void | reset () |
virtual void | setAllowRedundantTransitions (bool allow) |
Takes effect only for newly added transitions, if needed, call immediately when construct automaton. | |
virtual void | setAlphabet (const ITransition::TCharSet &alphabet) |
virtual void | setAlphabetSymbol (const QString &alphabetSymbol) |
virtual void | setEpsilonSymbol (const QString &epsilonSymbol) |
virtual void | setPositioningMap (const IAutomaton::TPositioningMap &map) |
Sets map with positions of states. | |
Protected Member Functions | |
QSharedPointer< TransitionImpl > | createCharactersTransitionIfNotExists (const QString &source, const QString &dest, ITransition::TCharSet &characters, const TransitionImpl::TTransitionList &transitions, bool &created, Transition *graphicsTransition=NULL) |
QSharedPointer< TransitionImpl > | createEpsilonTransitionIfNotExists (const QString &source, const QString &dest, const QString &epsilonSymbol, const TransitionImpl::TTransitionList &transitions, bool &created, Transition *graphicsTransition=NULL) |
QSharedPointer< TransitionImpl > | createPrivateTransitionIfNotExists (const QString &source, const QString &dest, const ITransition::TCharSet &characters, const TransitionImpl::TTransitionList &transitions, bool &created, Transition *graphicsTransition=NULL) |
QSharedPointer< TransitionImpl > | createPrivateTransitionInternal (const QString &source, const QString &dest, const ITransition::TCharSet &characters, bool &created) |
Called from IAutomaton::createTransition. | |
Private Member Functions | |
void | fillRowData (const QSharedPointer< IState > &state, ITTRow &row) const |
helper function for creating transition table's rows | |
Private Attributes | |
StateImpl::TStateList | m_activeStates |
bool | m_allowRenundancies |
ITransition::TCharSet | m_alphabet |
QString | m_alphabetSymbol |
QString | m_epsilonSymbol |
IAutomaton::TPositioningMap | m_positioningMap |
QStringList | m_processedString |
StateImpl::TStateMap | m_stateMap |
TransitionImpl::TTransitionList | m_transitions |
Implements IAutomaton, provides some methods for giving private implementations.
Definition at line 133 of file automataCreator.h.
typedef QList<QSharedPointer<AutomatonImpl> > AutomatonImpl::TAutomatonList |
Definition at line 139 of file automataCreator.h.
AutomatonImpl::AutomatonImpl | ( | const ITransition::TCharSet & | alphabet, | |
const QString & | alphabetSymbol, | |||
const QString & | epsilonSymbol | |||
) |
Definition at line 500 of file automataCreator.cpp.
References m_positioningMap.
AutomatonImpl::~AutomatonImpl | ( | ) |
Definition at line 508 of file automataCreator.cpp.
References DBGLOG_AC.
void AutomatonImpl::addLists | ( | const StateImpl::TStateList & | states, | |
const TransitionImpl::TTransitionList & | transitions | |||
) | [virtual] |
Definition at line 984 of file automataCreator.cpp.
References m_stateMap, and m_transitions.
bool AutomatonImpl::addState | ( | const QSharedPointer< StateImpl > & | state | ) | [virtual] |
Definition at line 862 of file automataCreator.cpp.
References m_stateMap.
Referenced by createState().
bool AutomatonImpl::addTransition | ( | const QSharedPointer< TransitionImpl > & | tr | ) | [virtual] |
Definition at line 967 of file automataCreator.cpp.
References m_stateMap, and m_transitions.
Referenced by createTransition().
virtual bool AutomatonImpl::allowRedundantTransitions | ( | ) | const [inline, virtual] |
If returns true, no transitions with the same characters between the same states are allowed. In that case, automaton automatically merges created transitions in the way, that there can be maximally two transition's instances for each pair of states in automaton. One of them is reserved for epsilon transition, the second is for other characters.
Implements IAutomaton.
Definition at line 202 of file automataCreator.h.
References m_allowRenundancies.
Referenced by createTransition().
QSharedPointer< TransitionImpl > AutomatonImpl::createAndAddPrivateTransition | ( | const QString & | source, | |
const QString & | dest, | |||
const ITransition::TCharSet & | characters, | |||
Transition * | graphicsTransition | |||
) |
Creates new transition and add it to automaton. Keeps consistency witch redundant transitions handling.
Definition at line 592 of file automataCreator.cpp.
QSharedPointer< TransitionImpl > AutomatonImpl::createCharactersTransitionIfNotExists | ( | const QString & | source, | |
const QString & | dest, | |||
ITransition::TCharSet & | characters, | |||
const TransitionImpl::TTransitionList & | transitions, | |||
bool & | created, | |||
Transition * | graphicsTransition = NULL | |||
) | [protected] |
Definition at line 671 of file automataCreator.cpp.
QSharedPointer< TransitionImpl > AutomatonImpl::createEpsilonTransitionIfNotExists | ( | const QString & | source, | |
const QString & | dest, | |||
const QString & | epsilonSymbol, | |||
const TransitionImpl::TTransitionList & | transitions, | |||
bool & | created, | |||
Transition * | graphicsTransition = NULL | |||
) | [protected] |
Definition at line 652 of file automataCreator.cpp.
QSharedPointer< TransitionImpl > AutomatonImpl::createPrivateTransition | ( | const QString & | source, | |
const QString & | dest, | |||
const ITransition::TCharSet & | characters, | |||
const TransitionImpl::TTransitionList & | transitions, | |||
bool & | created, | |||
Transition * | graphicsTransition | |||
) |
Creates new transition, doesn't add it! It has to be done manually if created is true. This method keeps consistency with redundant transitions handling.
Definition at line 610 of file automataCreator.cpp.
QSharedPointer< TransitionImpl > AutomatonImpl::createPrivateTransitionIfNotExists | ( | const QString & | source, | |
const QString & | dest, | |||
const ITransition::TCharSet & | characters, | |||
const TransitionImpl::TTransitionList & | transitions, | |||
bool & | created, | |||
Transition * | graphicsTransition = NULL | |||
) | [protected] |
Definition at line 629 of file automataCreator.cpp.
References RELLOG.
QSharedPointer< TransitionImpl > AutomatonImpl::createPrivateTransitionInternal | ( | const QString & | source, | |
const QString & | dest, | |||
const ITransition::TCharSet & | characters, | |||
bool & | created | |||
) | [protected] |
Called from IAutomaton::createTransition.
Definition at line 583 of file automataCreator.cpp.
Referenced by createTransition().
QSharedPointer< IState > AutomatonImpl::createState | ( | const QString & | name, | |
const QString & | label, | |||
bool | initial, | |||
bool | final | |||
) | [virtual] |
Creates and adds state to automaton (returns NULL if failed).
Implements IAutomaton.
Definition at line 513 of file automataCreator.cpp.
References addState(), and m_stateMap.
QSharedPointer< ITransition > AutomatonImpl::createTransition | ( | const QString & | source, | |
const QString & | dest, | |||
const ITransition::TCharSet & | characters | |||
) | [virtual] |
Creates and adds transition to automaton (returns NULL if failed). If transitions with same parameters currently exists, is silently returned as if it has been already created.
Implements IAutomaton.
Definition at line 532 of file automataCreator.cpp.
References addTransition(), allowRedundantTransitions(), createPrivateTransitionInternal(), getEpsilonSymbol(), and m_stateMap.
void AutomatonImpl::fillRowData | ( | const QSharedPointer< IState > & | state, | |
ITTRow & | row | |||
) | const [private] |
helper function for creating transition table's rows
Definition at line 1154 of file automataCreator.cpp.
Referenced by getTransitionTable().
IState::TIStateList AutomatonImpl::getActiveStates | ( | ) | const [virtual] |
Returns currently active states.
Implements IAutomaton.
Definition at line 1102 of file automataCreator.cpp.
References getPrivateActiveStates().
QStringList AutomatonImpl::getActiveStatesNames | ( | ) | const [virtual] |
Returns active states names in QStringList.
Implements IAutomaton.
Definition at line 1107 of file automataCreator.cpp.
References m_activeStates.
ITransition::TCharSet AutomatonImpl::getAlphabet | ( | ) | const [virtual] |
QString AutomatonImpl::getAlphabetSymbol | ( | ) | const [virtual] |
Implements IAutomaton.
Definition at line 852 of file automataCreator.cpp.
References m_alphabetSymbol.
QString AutomatonImpl::getEpsilonSymbol | ( | ) | const [virtual] |
Implements IAutomaton.
Definition at line 857 of file automataCreator.cpp.
References m_epsilonSymbol.
Referenced by createTransition().
IState::TIStateList AutomatonImpl::getFinalStates | ( | ) | const [virtual] |
Implements IAutomaton.
Definition at line 705 of file automataCreator.cpp.
References getPrivateStates().
IState::TIStateList AutomatonImpl::getInitialStates | ( | ) | const [virtual] |
Implements IAutomaton.
Definition at line 691 of file automataCreator.cpp.
References getPrivateStates().
Referenced by getTransitionTable(), and hasMultipleInitials().
IAutomaton::TPositioningMap AutomatonImpl::getPositioningMap | ( | ) | const [virtual] |
Returns positioning map.
Implements IAutomaton.
Definition at line 757 of file automataCreator.cpp.
References m_positioningMap.
StateImpl::TStateList AutomatonImpl::getPrivateActiveStates | ( | ) | const |
Definition at line 1119 of file automataCreator.cpp.
References m_activeStates.
Referenced by getActiveStates().
StateImpl::TStateList AutomatonImpl::getPrivateFinalStates | ( | ) | const |
Definition at line 743 of file automataCreator.cpp.
References getPrivateStates().
StateImpl::TStateList AutomatonImpl::getPrivateInitialStates | ( | ) | const |
Definition at line 729 of file automataCreator.cpp.
References getPrivateStates().
Referenced by reset().
QSharedPointer< StateImpl > AutomatonImpl::getPrivateState | ( | const QString & | name | ) | const |
Definition at line 874 of file automataCreator.cpp.
References m_stateMap.
Referenced by getState(), processCharacter(), and renameState().
StateImpl::TStateList AutomatonImpl::getPrivateStates | ( | ) | const |
Definition at line 724 of file automataCreator.cpp.
References m_stateMap.
Referenced by getFinalStates(), getInitialStates(), getPrivateFinalStates(), getPrivateInitialStates(), and getStates().
TransitionImpl::TTransitionList AutomatonImpl::getPrivateTransitions | ( | ) | const |
Definition at line 772 of file automataCreator.cpp.
References m_transitions.
QStringList AutomatonImpl::getProcessedString | ( | ) | const [virtual] |
Returns currently accepted string (nothing after reset()).
Implements IAutomaton.
Definition at line 1124 of file automataCreator.cpp.
References m_processedString.
QSharedPointer< IState > AutomatonImpl::getState | ( | const QString & | name | ) | const [virtual] |
Implements IAutomaton.
Definition at line 884 of file automataCreator.cpp.
References getPrivateState().
Referenced by getTransitionSymbols(), and getTransitionTable().
IState::TIStateNameList AutomatonImpl::getStateNameList | ( | ) | const [virtual] |
IState::TIStateList AutomatonImpl::getStates | ( | ) | const [virtual] |
Implements IAutomaton.
Definition at line 686 of file automataCreator.cpp.
References getPrivateStates().
ITransition::TITransitionList AutomatonImpl::getTransitions | ( | ) | const [virtual] |
Implements IAutomaton.
Definition at line 767 of file automataCreator.cpp.
References m_transitions.
ITransition::TCharSet AutomatonImpl::getTransitionSymbols | ( | const QString & | source, | |
const QString & | dest | |||
) | const [virtual] |
Implements IAutomaton.
Definition at line 1034 of file automataCreator.cpp.
References getState(), and hasState().
QSharedPointer< ITransitionTable > AutomatonImpl::getTransitionTable | ( | ) | const [virtual] |
Implements IAutomaton.
Definition at line 777 of file automataCreator.cpp.
References fillRowData(), getInitialStates(), getState(), and m_stateMap.
bool AutomatonImpl::hasEpsilonTransitions | ( | ) | const [virtual] |
Implements IAutomaton.
Definition at line 1000 of file automataCreator.cpp.
References m_epsilonSymbol, and m_transitions.
Referenced by isDeterministic().
bool AutomatonImpl::hasMultipleInitials | ( | ) | const [virtual] |
Implements IAutomaton.
Definition at line 995 of file automataCreator.cpp.
References getInitialStates().
Referenced by isDeterministic().
virtual bool AutomatonImpl::hasPositions | ( | ) | const [inline, virtual] |
Implements IAutomaton.
Definition at line 162 of file automataCreator.h.
References m_positioningMap.
bool AutomatonImpl::hasState | ( | const QString & | name | ) | const [virtual] |
Implements IAutomaton.
Definition at line 1029 of file automataCreator.cpp.
References m_stateMap.
Referenced by getTransitionSymbols().
bool AutomatonImpl::isConfigurationAccepted | ( | ) | const [virtual] |
Returns true if current configuration is ACCEPTed.
Implements IAutomaton.
Definition at line 1092 of file automataCreator.cpp.
References m_activeStates.
bool AutomatonImpl::isDeterministic | ( | ) | const [virtual] |
Implements IAutomaton.
Definition at line 1011 of file automataCreator.cpp.
References hasEpsilonTransitions(), hasMultipleInitials(), m_alphabet, and m_stateMap.
bool AutomatonImpl::processCharacter | ( | const QString & | character | ) | [virtual] |
Process input character.
Implements IAutomaton.
Definition at line 1070 of file automataCreator.cpp.
References getPrivateState(), m_activeStates, and m_processedString.
IState::TIStateNameSet AutomatonImpl::processCharacterWithInfo | ( | const QString & | character, | |
QList< QPainterPath > & | paths | |||
) |
Definition at line 1130 of file automataCreator.cpp.
bool AutomatonImpl::removeState | ( | const QSharedPointer< IState > & | state | ) | [virtual] |
Implements IAutomaton.
Definition at line 889 of file automataCreator.cpp.
bool AutomatonImpl::removeState | ( | const QString & | stateName | ) | [virtual] |
Implements IAutomaton.
Definition at line 894 of file automataCreator.cpp.
References m_stateMap, and removeTransition().
bool AutomatonImpl::removeTransition | ( | const QSharedPointer< TransitionImpl > & | tr | ) | [virtual] |
Definition at line 942 of file automataCreator.cpp.
References m_stateMap, m_transitions, and RELLOG.
Referenced by removeState().
bool AutomatonImpl::removeTransition | ( | const QSharedPointer< ITransition > & | tr | ) | [virtual] |
Implements IAutomaton.
Definition at line 957 of file automataCreator.cpp.
bool AutomatonImpl::renameState | ( | const QSharedPointer< IState > & | state, | |
const QString & | newName | |||
) | [virtual] |
Renames state and effects changed on transitions.
Implements IAutomaton.
Definition at line 923 of file automataCreator.cpp.
References getPrivateState(), and m_stateMap.
void AutomatonImpl::reset | ( | ) | [virtual] |
Implements IAutomaton.
Definition at line 1064 of file automataCreator.cpp.
References getPrivateInitialStates(), m_activeStates, and m_processedString.
void AutomatonImpl::setAllowRedundantTransitions | ( | bool | allow | ) | [virtual] |
Takes effect only for newly added transitions, if needed, call immediately when construct automaton.
Implements IAutomaton.
Definition at line 1052 of file automataCreator.cpp.
References DBGPAR, m_allowRenundancies, m_transitions, and RELLOG.
void AutomatonImpl::setAlphabet | ( | const ITransition::TCharSet & | alphabet | ) | [virtual] |
void AutomatonImpl::setAlphabetSymbol | ( | const QString & | alphabetSymbol | ) | [virtual] |
Implements IAutomaton.
Definition at line 837 of file automataCreator.cpp.
References m_alphabetSymbol.
void AutomatonImpl::setEpsilonSymbol | ( | const QString & | epsilonSymbol | ) | [virtual] |
Implements IAutomaton.
Definition at line 842 of file automataCreator.cpp.
References m_epsilonSymbol.
void AutomatonImpl::setPositioningMap | ( | const IAutomaton::TPositioningMap & | map | ) | [virtual] |
Sets map with positions of states.
Implements IAutomaton.
Definition at line 762 of file automataCreator.cpp.
References m_positioningMap.
Definition at line 255 of file automataCreator.h.
Referenced by getActiveStatesNames(), getPrivateActiveStates(), isConfigurationAccepted(), processCharacter(), and reset().
bool AutomatonImpl::m_allowRenundancies [private] |
Definition at line 258 of file automataCreator.h.
Referenced by allowRedundantTransitions(), and setAllowRedundantTransitions().
Definition at line 251 of file automataCreator.h.
Referenced by getAlphabet(), isDeterministic(), and setAlphabet().
QString AutomatonImpl::m_alphabetSymbol [private] |
Definition at line 252 of file automataCreator.h.
Referenced by getAlphabetSymbol(), and setAlphabetSymbol().
QString AutomatonImpl::m_epsilonSymbol [private] |
Definition at line 253 of file automataCreator.h.
Referenced by getEpsilonSymbol(), hasEpsilonTransitions(), and setEpsilonSymbol().
Definition at line 247 of file automataCreator.h.
Referenced by AutomatonImpl(), getPositioningMap(), hasPositions(), and setPositioningMap().
QStringList AutomatonImpl::m_processedString [private] |
Definition at line 256 of file automataCreator.h.
Referenced by getProcessedString(), processCharacter(), and reset().
Definition at line 246 of file automataCreator.h.
Referenced by addLists(), addState(), addTransition(), createState(), createTransition(), getPrivateState(), getPrivateStates(), getStateNameList(), getTransitionTable(), hasState(), isDeterministic(), removeState(), removeTransition(), and renameState().
Definition at line 249 of file automataCreator.h.
Referenced by addLists(), addTransition(), getPrivateTransitions(), getTransitions(), hasEpsilonTransitions(), removeTransition(), and setAllowRedundantTransitions().