Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

AutomatonImpl Class Reference

Implements IAutomaton, provides some methods for giving private implementations. More...

#include <automataCreator.h>

Inheritance diagram for AutomatonImpl:
Collaboration diagram for AutomatonImpl:

List of all members.

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< TransitionImplcreateAndAddPrivateTransition (const QString &source, const QString &dest, const ITransition::TCharSet &characters, Transition *graphicsTransition)
QSharedPointer< TransitionImplcreatePrivateTransition (const QString &source, const QString &dest, const ITransition::TCharSet &characters, const TransitionImpl::TTransitionList &transitions, bool &created, Transition *graphicsTransition)
virtual QSharedPointer< IStatecreateState (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< StateImplgetPrivateState (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< IStategetState (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< TransitionImplcreateCharactersTransitionIfNotExists (const QString &source, const QString &dest, ITransition::TCharSet &characters, const TransitionImpl::TTransitionList &transitions, bool &created, Transition *graphicsTransition=NULL)
QSharedPointer< TransitionImplcreateEpsilonTransitionIfNotExists (const QString &source, const QString &dest, const QString &epsilonSymbol, const TransitionImpl::TTransitionList &transitions, bool &created, Transition *graphicsTransition=NULL)
QSharedPointer< TransitionImplcreatePrivateTransitionIfNotExists (const QString &source, const QString &dest, const ITransition::TCharSet &characters, const TransitionImpl::TTransitionList &transitions, bool &created, Transition *graphicsTransition=NULL)
QSharedPointer< TransitionImplcreatePrivateTransitionInternal (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

Detailed Description

Implements IAutomaton, provides some methods for giving private implementations.

Definition at line 133 of file automataCreator.h.


Member Typedef Documentation

typedef QList<QSharedPointer<AutomatonImpl> > AutomatonImpl::TAutomatonList

Definition at line 139 of file automataCreator.h.


Constructor & Destructor Documentation

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.


Member Function Documentation

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().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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.

See also:
allowRedundantTransitions, createTransition, createPrivateTransition

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.

See also:
allowRedundantTransitions, createTransition

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().

Here is the caller graph for this function:

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.

Here is the call graph for this function:

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.

See also:
allowRedundantTransitions

Implements IAutomaton.

Definition at line 532 of file automataCreator.cpp.

References addTransition(), allowRedundantTransitions(), createPrivateTransitionInternal(), getEpsilonSymbol(), and m_stateMap.

Here is the call graph for this function:

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().

Here is the caller graph for this function:

IState::TIStateList AutomatonImpl::getActiveStates (  )  const [virtual]

Returns currently active states.

Implements IAutomaton.

Definition at line 1102 of file automataCreator.cpp.

References getPrivateActiveStates().

Here is the call graph for this function:

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]

Implements IAutomaton.

Definition at line 847 of file automataCreator.cpp.

References m_alphabet.

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().

Here is the caller graph for this function:

IState::TIStateList AutomatonImpl::getFinalStates (  )  const [virtual]

Implements IAutomaton.

Definition at line 705 of file automataCreator.cpp.

References getPrivateStates().

Here is the call graph for this function:

IState::TIStateList AutomatonImpl::getInitialStates (  )  const [virtual]

Implements IAutomaton.

Definition at line 691 of file automataCreator.cpp.

References getPrivateStates().

Referenced by getTransitionTable(), and hasMultipleInitials().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

StateImpl::TStateList AutomatonImpl::getPrivateFinalStates (  )  const

Definition at line 743 of file automataCreator.cpp.

References getPrivateStates().

Here is the call graph for this function:

StateImpl::TStateList AutomatonImpl::getPrivateInitialStates (  )  const

Definition at line 729 of file automataCreator.cpp.

References getPrivateStates().

Referenced by reset().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

StateImpl::TStateList AutomatonImpl::getPrivateStates (  )  const

Definition at line 724 of file automataCreator.cpp.

References m_stateMap.

Referenced by getFinalStates(), getInitialStates(), getPrivateFinalStates(), getPrivateInitialStates(), and getStates().

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

IState::TIStateNameList AutomatonImpl::getStateNameList (  )  const [virtual]

Implements IAutomaton.

Definition at line 719 of file automataCreator.cpp.

References m_stateMap.

IState::TIStateList AutomatonImpl::getStates (  )  const [virtual]

Implements IAutomaton.

Definition at line 686 of file automataCreator.cpp.

References getPrivateStates().

Here is the call graph for this function:

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().

Here is the call graph for this function:

QSharedPointer< ITransitionTable > AutomatonImpl::getTransitionTable (  )  const [virtual]

Implements IAutomaton.

Definition at line 777 of file automataCreator.cpp.

References fillRowData(), getInitialStates(), getState(), and m_stateMap.

Here is the call graph for this function:

bool AutomatonImpl::hasEpsilonTransitions (  )  const [virtual]

Implements IAutomaton.

Definition at line 1000 of file automataCreator.cpp.

References m_epsilonSymbol, and m_transitions.

Referenced by isDeterministic().

Here is the caller graph for this function:

bool AutomatonImpl::hasMultipleInitials (  )  const [virtual]

Implements IAutomaton.

Definition at line 995 of file automataCreator.cpp.

References getInitialStates().

Referenced by isDeterministic().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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.

Here is the call graph for this function:

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.

Here is the call graph for this function:

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().

Here is the call graph for this function:

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().

Here is the caller graph for this function:

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.

Here is the call graph for this function:

void AutomatonImpl::reset (  )  [virtual]

Implements IAutomaton.

Definition at line 1064 of file automataCreator.cpp.

References getPrivateInitialStates(), m_activeStates, and m_processedString.

Here is the call graph for this function:

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]

Implements IAutomaton.

Definition at line 832 of file automataCreator.cpp.

References m_alphabet.

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.


Member Data Documentation

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().

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().

QStringList AutomatonImpl::m_processedString [private]

Definition at line 256 of file automataCreator.h.

Referenced by getProcessedString(), processCharacter(), and reset().


The documentation for this class was generated from the following files: