Classes | Public Types | Public Slots | Signals | Public Member Functions | Protected Slots | Protected Member Functions | Private Types | Private Attributes

AutomataWorkSimulator Class Reference

Main simulation class, implements simulation logic. More...

#include <automataWorkSimulator.h>

Collaboration diagram for AutomataWorkSimulator:

List of all members.

Classes

struct  Configuration
 helper struct for storing configurations More...

Public Types

typedef QList< ConfigurationTConfigurationList

Public Slots

void generateSlideshow ()
 processes all steps of simulation and stores it to slideshow
void pause ()
 stops automatic simulation
void play ()
 runs automatic simulation
void reset ()
 resets state of simulation
void run ()
 runs simulation dialog
bool setInput (const QString &text)
 sets input string, if it's correctly defined
void stepBackward ()
 reverts last step
void stepForward ()
 process single step

Signals

void finished ()
 signal emited when simulation ends
void setStatesMarked (QList< State * >, bool)
 signal catched by editor

Public Member Functions

 AutomataWorkSimulator (Editor *editor, QUndoStack &undoStack, const QSharedPointer< AutomatonImpl > &automaton)
 ~AutomataWorkSimulator ()
TConfigurationList getConfigurations () const
int getPos () const
 returns current position in input string
bool hasStateAfter () const
 determines, if it's possible to process next step
bool hasStateBefore () const
 determines, if it's possible to do step back
bool isPlaying () const
 determines, if automatic simulation is running
bool isSet () const
 determines, if input is set correctly

Protected Slots

void animate ()
 processes single step of animation (called by timer)
void animSpeedChanged (double)
void dialogClosed ()
void processStep ()
 processes single step of simulation
void stepSpeedChanged (double)
void useAnimChanged (int)

Protected Member Functions

bool animateMove ()
void doAnimation (const QList< QPainterPath > &paths)
bool getFileName (QString &fileName, bool &latexHeader)
void refreshPlayingStatus ()
QList< QPainterPath > revertPaths (const QList< QPainterPath > &paths) const
void saveInputState (QTextStream &out)
void setActiveStatesMarked (bool)

Private Types

enum  EAnimateState {
  eMoving,
  eStopped
}

Private Attributes

StateImpl::TStateList m_activeStates
bool m_activeStatesAreMarked
QVector< StateImpl::TStateListm_activeStatesMemory
QVector< QList< QPainterPath > > m_animationPathMemory
float m_animationSpeed
EAnimateState m_animationState
QScopedPointer< QTimer > m_animationTimer
QSharedPointer< AutomatonImplm_automaton
int m_backSteps
 step back uses undoStack, so when then is steping forward required again, only redo is done
TConfigurationList m_configurationList
QScopedPointer< SimulationDialogm_dialog
Editorm_editor
int m_inputIndex
 position in input stringList
StringProcessor::TCharacterList m_inputList
QList< SimulationMarker * > m_markers
int m_pathCount
bool m_playing
QScopedPointer< QTimer > m_simulationTimer
Configuration::EStatus m_status
QUndoStack & m_undoStack
int m_undoStackStartIdx
bool m_useAnimations

Detailed Description

Main simulation class, implements simulation logic.

Definition at line 20 of file automataWorkSimulator.h.


Member Typedef Documentation

Definition at line 49 of file automataWorkSimulator.h.


Member Enumeration Documentation

Enumerator:
eMoving 
eStopped 

Definition at line 116 of file automataWorkSimulator.h.


Constructor & Destructor Documentation

AutomataWorkSimulator::AutomataWorkSimulator ( Editor editor,
QUndoStack &  undoStack,
const QSharedPointer< AutomatonImpl > &  automaton 
)
AutomataWorkSimulator::~AutomataWorkSimulator (  ) 

Definition at line 143 of file automataWorkSimulator.cpp.

References DBGLOG, and m_markers.


Member Function Documentation

void AutomataWorkSimulator::animate (  )  [protected, slot]

processes single step of animation (called by timer)

Definition at line 350 of file automataWorkSimulator.cpp.

References animateMove(), DBGLOG_ANIM, eMoving, eStopped, m_animationState, m_animationTimer, m_editor, and Editor::update().

Referenced by AutomataWorkSimulator(), and doAnimation().

Here is the call graph for this function:

Here is the caller graph for this function:

bool AutomataWorkSimulator::animateMove (  )  [protected]

Definition at line 367 of file automataWorkSimulator.cpp.

References DBGLOG_ANIM, DBGPAR, m_markers, and m_pathCount.

Referenced by animate().

Here is the caller graph for this function:

void AutomataWorkSimulator::animSpeedChanged ( double  val  )  [protected, slot]

Definition at line 488 of file automataWorkSimulator.cpp.

References m_animationSpeed.

Referenced by AutomataWorkSimulator().

Here is the caller graph for this function:

void AutomataWorkSimulator::dialogClosed (  )  [protected, slot]

Definition at line 498 of file automataWorkSimulator.cpp.

References finished(), m_activeStatesAreMarked, m_undoStack, m_undoStackStartIdx, and setActiveStatesMarked().

Referenced by AutomataWorkSimulator().

Here is the call graph for this function:

Here is the caller graph for this function:

void AutomataWorkSimulator::doAnimation ( const QList< QPainterPath > &  paths  )  [protected]

Definition at line 315 of file automataWorkSimulator.cpp.

References animate(), ANIMATION_FRAME_TIME, m_animationSpeed, m_animationState, m_animationTimer, m_editor, m_markers, m_pathCount, and m_useAnimations.

Referenced by processStep(), and stepBackward().

Here is the call graph for this function:

Here is the caller graph for this function:

void AutomataWorkSimulator::finished (  )  [signal]

signal emited when simulation ends

Definition at line 122 of file moc_automataWorkSimulator.cpp.

Referenced by dialogClosed().

Here is the caller graph for this function:

void AutomataWorkSimulator::generateSlideshow (  )  [slot]
AutomataWorkSimulator::TConfigurationList AutomataWorkSimulator::getConfigurations (  )  const

Definition at line 187 of file automataWorkSimulator.cpp.

References m_configurationList, and m_inputIndex.

Referenced by SimulationDialog::updateState().

Here is the caller graph for this function:

bool AutomataWorkSimulator::getFileName ( QString &  fileName,
bool &  latexHeader 
) [protected]

Definition at line 521 of file automataWorkSimulator.cpp.

References appendFilenameSuffix(), m_dialog, and RELLOG.

Referenced by generateSlideshow().

Here is the call graph for this function:

Here is the caller graph for this function:

int AutomataWorkSimulator::getPos (  )  const

returns current position in input string

Definition at line 178 of file automataWorkSimulator.cpp.

References m_dialog, m_inputIndex, and m_inputList.

Referenced by SimulationDialog::updateState().

Here is the caller graph for this function:

bool AutomataWorkSimulator::hasStateAfter (  )  const

determines, if it's possible to process next step

Definition at line 159 of file automataWorkSimulator.cpp.

References AutomataWorkSimulator::Configuration::eError, m_backSteps, m_inputIndex, m_inputList, and m_status.

Referenced by generateSlideshow(), and SimulationDialog::updateState().

Here is the caller graph for this function:

bool AutomataWorkSimulator::hasStateBefore (  )  const

determines, if it's possible to do step back

Definition at line 154 of file automataWorkSimulator.cpp.

References m_inputIndex.

Referenced by SimulationDialog::updateState().

Here is the caller graph for this function:

bool AutomataWorkSimulator::isPlaying (  )  const

determines, if automatic simulation is running

Definition at line 167 of file automataWorkSimulator.cpp.

References m_playing, and m_simulationTimer.

Referenced by stepBackward(), stepForward(), and SimulationDialog::updateState().

Here is the caller graph for this function:

bool AutomataWorkSimulator::isSet (  )  const

determines, if input is set correctly

Definition at line 173 of file automataWorkSimulator.cpp.

References m_inputList.

Referenced by SimulationDialog::play(), SimulationDialog::set(), SimulationDialog::stepForward(), and SimulationDialog::updateState().

Here is the caller graph for this function:

void AutomataWorkSimulator::pause (  )  [slot]

stops automatic simulation

Definition at line 273 of file automataWorkSimulator.cpp.

References m_dialog, m_playing, and m_simulationTimer.

Referenced by stepBackward(), and stepForward().

Here is the caller graph for this function:

void AutomataWorkSimulator::play (  )  [slot]

runs automatic simulation

Definition at line 260 of file automataWorkSimulator.cpp.

References m_animationTimer, m_dialog, m_playing, m_simulationTimer, and processStep().

Referenced by SimulationDialog::play().

Here is the call graph for this function:

Here is the caller graph for this function:

void AutomataWorkSimulator::processStep (  )  [protected, slot]
void AutomataWorkSimulator::refreshPlayingStatus (  )  [protected]

Definition at line 380 of file automataWorkSimulator.cpp.

References m_inputIndex, m_inputList, m_playing, and m_simulationTimer.

Referenced by processStep().

Here is the caller graph for this function:

void AutomataWorkSimulator::reset (  )  [slot]

resets state of simulation

Definition at line 284 of file automataWorkSimulator.cpp.

References m_activeStates, m_activeStatesAreMarked, m_activeStatesMemory, m_animationPathMemory, m_animationTimer, m_automaton, m_backSteps, m_configurationList, m_dialog, m_inputIndex, m_inputList, m_playing, m_simulationTimer, m_status, m_undoStack, m_undoStackStartIdx, and setActiveStatesMarked().

Referenced by generateSlideshow(), and run().

Here is the call graph for this function:

Here is the caller graph for this function:

QList< QPainterPath > AutomataWorkSimulator::revertPaths ( const QList< QPainterPath > &  paths  )  const [protected]

Definition at line 509 of file automataWorkSimulator.cpp.

Referenced by stepBackward().

Here is the caller graph for this function:

void AutomataWorkSimulator::run (  )  [slot]

runs simulation dialog

Definition at line 192 of file automataWorkSimulator.cpp.

References m_dialog, and reset().

Referenced by Editor::simulateAutomatonWork().

Here is the call graph for this function:

Here is the caller graph for this function:

void AutomataWorkSimulator::saveInputState ( QTextStream &  out  )  [protected]

Definition at line 617 of file automataWorkSimulator.cpp.

References StringProcessor::CharacterInfo::character, DBGLOG, DBGPAR, Editor::getGridRect(), StringProcessor::isSpecialSymbol(), m_editor, m_inputIndex, and m_inputList.

Referenced by generateSlideshow().

Here is the call graph for this function:

Here is the caller graph for this function:

void AutomataWorkSimulator::setActiveStatesMarked ( bool  marked  )  [protected]

Definition at line 465 of file automataWorkSimulator.cpp.

References m_activeStates, m_activeStatesAreMarked, m_editor, setStatesMarked(), and Editor::update().

Referenced by dialogClosed(), processStep(), and reset().

Here is the call graph for this function:

Here is the caller graph for this function:

bool AutomataWorkSimulator::setInput ( const QString &  text  )  [slot]

sets input string, if it's correctly defined

Definition at line 198 of file automataWorkSimulator.cpp.

References StringProcessor::CharacterInfo::character, StringProcessor::computeCharacterList(), AutomataCreator::defaultEpsilonSymbList, AutomataWorkSimulator::Configuration::eAccepted, m_automaton, m_configurationList, m_dialog, m_inputList, and StringProcessor::parseSymbols().

Referenced by generateSlideshow(), and SimulationDialog::setInput().

Here is the call graph for this function:

Here is the caller graph for this function:

void AutomataWorkSimulator::setStatesMarked ( QList< State * >  _t1,
bool  _t2 
) [signal]

signal catched by editor

See also:
Editor::setStatesMarked()

Definition at line 128 of file moc_automataWorkSimulator.cpp.

Referenced by setActiveStatesMarked().

Here is the caller graph for this function:

void AutomataWorkSimulator::stepBackward (  )  [slot]
void AutomataWorkSimulator::stepForward (  )  [slot]

process single step

Definition at line 225 of file automataWorkSimulator.cpp.

References isPlaying(), m_animationTimer, pause(), and processStep().

Referenced by SimulationDialog::stepForward().

Here is the call graph for this function:

Here is the caller graph for this function:

void AutomataWorkSimulator::stepSpeedChanged ( double  val  )  [protected, slot]

Definition at line 483 of file automataWorkSimulator.cpp.

References m_simulationTimer.

Referenced by AutomataWorkSimulator().

Here is the caller graph for this function:

void AutomataWorkSimulator::useAnimChanged ( int  state  )  [protected, slot]

Definition at line 493 of file automataWorkSimulator.cpp.

References m_useAnimations.

Referenced by AutomataWorkSimulator().

Here is the caller graph for this function:


Member Data Documentation

Definition at line 110 of file automataWorkSimulator.h.

Referenced by processStep(), reset(), setActiveStatesMarked(), and stepBackward().

Definition at line 111 of file automataWorkSimulator.h.

Referenced by dialogClosed(), reset(), and setActiveStatesMarked().

Definition at line 124 of file automataWorkSimulator.h.

Referenced by processStep(), reset(), and stepBackward().

QVector<QList<QPainterPath> > AutomataWorkSimulator::m_animationPathMemory [private]

Definition at line 125 of file automataWorkSimulator.h.

Referenced by processStep(), reset(), and stepBackward().

Definition at line 121 of file automataWorkSimulator.h.

Referenced by animSpeedChanged(), and doAnimation().

Definition at line 118 of file automataWorkSimulator.h.

Referenced by animate(), and doAnimation().

QScopedPointer<QTimer> AutomataWorkSimulator::m_animationTimer [private]

Definition at line 100 of file automataWorkSimulator.h.

Referenced by processStep(), reset(), and setInput().

step back uses undoStack, so when then is steping forward required again, only redo is done

Definition at line 108 of file automataWorkSimulator.h.

Referenced by hasStateAfter(), processStep(), reset(), and stepBackward().

Definition at line 123 of file automataWorkSimulator.h.

Referenced by getConfigurations(), processStep(), reset(), and setInput().

Definition at line 101 of file automataWorkSimulator.h.

Referenced by animateMove(), doAnimation(), and ~AutomataWorkSimulator().

Definition at line 120 of file automataWorkSimulator.h.

Referenced by animateMove(), and doAnimation().

Definition at line 114 of file automataWorkSimulator.h.

Referenced by isPlaying(), pause(), play(), refreshPlayingStatus(), and reset().

QScopedPointer<QTimer> AutomataWorkSimulator::m_simulationTimer [private]

Definition at line 102 of file automataWorkSimulator.h.

Referenced by hasStateAfter(), processStep(), and reset().

QUndoStack& AutomataWorkSimulator::m_undoStack [private]

Definition at line 97 of file automataWorkSimulator.h.

Referenced by dialogClosed(), and reset().

Definition at line 98 of file automataWorkSimulator.h.

Referenced by AutomataWorkSimulator(), dialogClosed(), and reset().


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