it.amattioli.workstate.core
Class Transition

Show UML class diagram
java.lang.Object
  extended by it.amattioli.workstate.core.Transition
Direct Known Subclasses:
ExternalTransition, InternalTransition

public abstract class Transition
extends Object

A transition allows state changes when an event is received.


Constructor Summary
Transition(MetaEvent event, MetaState start, MetaState end, TransitionAction action, Guard guard)
           
 
Method Summary
protected  void doAction(Event event, RealState currentState)
           
 boolean equals(Object o)
           
protected  MetaState getEndState()
           
 MetaEvent getEvent()
           
static Comparator<Transition> getGuardPriorityComparator()
          Return a Comparator instance that allows the ordering of a list of transitions based on the guard priority (high priority first).
protected  MetaState getStartState()
           
 boolean hasSameTrigger(Transition transition)
          Check if the given transition has the same trigger of this one.
 boolean isAction(TransitionAction action)
           
 boolean isEndState(MetaState state)
           
 boolean isEvent(MetaEvent event)
           
 boolean isGuard(Guard guard)
           
 boolean isStartState(MetaState state)
           
 boolean isTriggeredBy(Event event, State state)
          Check if this transition is triggered by a given Event when the machine is in a giben State.
abstract  void perform(Event event, State currentState)
          Perform this transition.
 String toString()
           
protected  void undoAction(Event event, RealState currentState)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Transition

public Transition(MetaEvent event,
                  MetaState start,
                  MetaState end,
                  TransitionAction action,
                  Guard guard)
Method Detail

getEvent

public MetaEvent getEvent()

isEvent

public boolean isEvent(MetaEvent event)

isAction

public boolean isAction(TransitionAction action)

isGuard

public boolean isGuard(Guard guard)

getStartState

protected MetaState getStartState()

isStartState

public boolean isStartState(MetaState state)

getEndState

protected MetaState getEndState()

isEndState

public boolean isEndState(MetaState state)

hasSameTrigger

public boolean hasSameTrigger(Transition transition)
Check if the given transition has the same trigger of this one. To have the same trigger to transitions must be triggered by the same MetaEvent and must have the same Guard.


isTriggeredBy

public boolean isTriggeredBy(Event event,
                             State state)
Check if this transition is triggered by a given Event when the machine is in a giben State. The following will be checked:

Parameters:
event - the received event
state - the current state
Returns:
true if this transition is triggered, false otherwise

doAction

protected void doAction(Event event,
                        RealState currentState)
                 throws WorkflowException
Throws:
WorkflowException

undoAction

protected void undoAction(Event event,
                          RealState currentState)

perform

public abstract void perform(Event event,
                             State currentState)
                      throws WorkflowException
Perform this transition.

Throws:
WorkflowException

getGuardPriorityComparator

public static Comparator<Transition> getGuardPriorityComparator()
Return a Comparator instance that allows the ordering of a list of transitions based on the guard priority (high priority first).


equals

public boolean equals(Object o)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2011. All Rights Reserved.