com.googlecode.jinahya.util.fsm
Class SwitchTask

java.lang.Object
  extended by com.googlecode.jinahya.util.fsm.Task
      extended by com.googlecode.jinahya.util.fsm.SwitchTask
Direct Known Subclasses:
SimpleTask

public abstract class SwitchTask
extends Task

Task for switching conditions.

Author:
Jin Kwon

Constructor Summary
SwitchTask(String id, TransitionMatcher[] onMatchers, TransitionMatcher[] offMatchers)
          Creates a new instance.
 
Method Summary
 void perform(TransitionContext context)
          Perform desired actions for given transition.
protected abstract  void performOff(TransitionContext context)
          Performs for switching off.
protected abstract  void performOn(TransitionContext context)
          Performs for switching on.
 void prepare(TransitionContext context)
           
protected abstract  void prepareOff(TransitionContext context)
          Prepares for switching off.
protected abstract  void prepareOn(TransitionContext context)
          Prepares for switching on.
 
Methods inherited from class com.googlecode.jinahya.util.fsm.Task
getId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SwitchTask

public SwitchTask(String id,
                  TransitionMatcher[] onMatchers,
                  TransitionMatcher[] offMatchers)
Creates a new instance.

Parameters:
id - task id
onMatchers - matchers for switching on; none null; none empty
offMatchers - matchers for switching off; none null; none empty
Method Detail

prepare

public void prepare(TransitionContext context)
             throws FSMException
Specified by:
prepare in class Task
Throws:
FSMException

prepareOn

protected abstract void prepareOn(TransitionContext context)
                           throws FSMException
Prepares for switching on.

Parameters:
context - context
Throws:
FSMException - if an error occurs.

prepareOff

protected abstract void prepareOff(TransitionContext context)
                            throws FSMException
Prepares for switching off.

Parameters:
context - context
Throws:
FSMException - if an error occurs.

perform

public void perform(TransitionContext context)
             throws FSMException
Description copied from class: Task
Perform desired actions for given transition.

Specified by:
perform in class Task
Parameters:
context - transition context
Throws:
FSMException - if an error occurs.

performOn

protected abstract void performOn(TransitionContext context)
                           throws FSMException
Performs for switching on.

Parameters:
context - context
Throws:
FSMException - if an error occurs.

performOff

protected abstract void performOff(TransitionContext context)
                            throws FSMException
Performs for switching off.

Parameters:
context - context
Throws:
FSMException - if an error occurs.


Copyright © 2011. All Rights Reserved.