com.evelopers.unimod.runtime.interpretation
Class InterpretationEventProcessor

java.lang.Object
  extended bycom.evelopers.unimod.runtime.AbstractEventProcessor
      extended bycom.evelopers.unimod.runtime.interpretation.InterpretationEventProcessor
All Implemented Interfaces:
EventProcessor

class InterpretationEventProcessor
extends AbstractEventProcessor

Abstract low-level event processor implementation.

Concrete implementation responsible for realization of state machine runtime sematic such as selection of transition for event, processing input and output actions and so on.

Pattern used: Template Method


Constructor Summary
InterpretationEventProcessor(Model model)
          Creates processor
 
Method Summary
 ModelStructure getModelStructure()
          Returns the structure of the model.
protected  StateMachineConfig process(Event event, StateMachineContext context, StateMachinePath path, StateMachineConfig config)
          Processes given event using state machine instance defined by the given config.
protected  StateMachineConfig transiteToStableState(StateMachineContext context, StateMachinePath path, StateMachineConfig config)
          Transites from initial state config to stable state.
 
Methods inherited from class com.evelopers.unimod.runtime.AbstractEventProcessor
addEventProcessorListener, addExceptionHandler, configExists, disposeConfig, fireAfterInputActionExecution, fireAfterOnEnterActionExecution, fireAfterOutputActionExecution, fireAfterSubmachineExecution, fireBeforeInputActionExecution, fireBeforeOnEnterActionExecution, fireBeforeOutputActionExecution, fireBeforeSubmachineExecution, fireComeToState, fireCompositeTargetState, fireEventProcessingFinished, fireEventProcessingStarted, fireEventSkipped, fireException, fireStateMachineCameToFinalState, fireTransitionCandidate, fireTransitionFound, fireTransitionNotFound, fireTransitionsOfSuperstate, getControlledObjectsMap, initConfig, isFinalConfig, isTopConfig, loadConfig, process, process, removeEventProcessorListener, removeExceptionHandler, setControlledObjectsMap, storeConfig
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InterpretationEventProcessor

public InterpretationEventProcessor(Model model)
Creates processor

Parameters:
model - automata model
Method Detail

getModelStructure

public ModelStructure getModelStructure()
Description copied from class: AbstractEventProcessor
Returns the structure of the model.

Specified by:
getModelStructure in interface EventProcessor
Specified by:
getModelStructure in class AbstractEventProcessor
Returns:
the structure of the model

transiteToStableState

protected StateMachineConfig transiteToStableState(StateMachineContext context,
                                                   StateMachinePath path,
                                                   StateMachineConfig config)
                                            throws com.evelopers.common.exception.SystemException
Description copied from class: AbstractEventProcessor
Transites from initial state config to stable state. This method should:
  1. Get transition from current initial state
  2. Transite using this transition
  3. If target state is composite then
    1. AbstractEventProcessor.fireCompositeTargetState(com.evelopers.unimod.runtime.context.StateMachineContext, com.evelopers.unimod.runtime.StateMachinePath, java.lang.String)
    2. Get initial state from the composite state
    3. AbstractEventProcessor.fireComeToState(com.evelopers.unimod.runtime.context.StateMachineContext, com.evelopers.unimod.runtime.StateMachinePath, java.lang.String) for new initial state
    4. Repeat AbstractEventProcessor.transiteToStableState(com.evelopers.unimod.runtime.context.StateMachineContext, com.evelopers.unimod.runtime.StateMachinePath, com.evelopers.unimod.runtime.StateMachineConfig) with new initial state

Specified by:
transiteToStableState in class AbstractEventProcessor
Parameters:
context - state machine context of the event
path - path that defines the state machine instance
config - initial state to transite from
Returns:
stable state reached from the given initial
Throws:
com.evelopers.common.exception.SystemException

process

protected StateMachineConfig process(Event event,
                                     StateMachineContext context,
                                     StateMachinePath path,
                                     StateMachineConfig config)
                              throws com.evelopers.common.exception.SystemException
Description copied from class: AbstractEventProcessor
Processes given event using state machine instance defined by the given config.

Implementation of this method depends on approach. For instance it may be an interpretator of the in-memory state machine model or a precompiled switch-operator.

Implementations of this method should fire event processing events during execution.

Specified by:
process in class AbstractEventProcessor
Parameters:
event - triggered event to process
context - state machine context of the event
path - path to state machine instance
config - state machine config that defines the state machine instance
Returns:
state machine config after event processing
Throws:
com.evelopers.common.exception.SystemException - if some input or output action throws an exception. This exception will be handled by added ExceptionHandlers
See Also:
AbstractEventProcessor.addExceptionHandler(ExceptionHandler), AbstractEventProcessor.removeExceptionHandler(ExceptionHandler), AbstractEventProcessor.addEventProcessorListener(EventProcessorListener), AbstractEventProcessor.removeEventProcessorListener(EventProcessorListener)