jade.core.behaviours
Class DistilledStateChartTransition

java.lang.Object
  extended by jade.core.behaviours.DistilledStateChartTransition
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
DistilledStateChartPerformativeTransition, DistilledStateChartTemplateTransition

public class DistilledStateChartTransition
extends java.lang.Object
implements java.io.Serializable

DistilledStateChartTransition: basic transition class.

Author:
G. Fortino, F. Rango
See Also:
Serialized Form

Field Summary
static int DEEP_HISTORY
          Indicates that the transition uses deep history for its target state
static int NO_HISTORY
          Indicates that the transition doesn't use history for its target state
static int SHALLOW_HISTORY
          Indicates that the transition uses shallow history for its target state
 
Constructor Summary
DistilledStateChartTransition()
          Default constructor.
DistilledStateChartTransition(java.lang.String aName, jade.core.behaviours.Behaviour tgt)
          Default constructor.
DistilledStateChartTransition(java.lang.String aName, jade.core.behaviours.Behaviour tgt, int history)
          Constructor that sets also the history.
 
Method Summary
 void action(jade.lang.acl.ACLMessage msg)
          This method is invoked when a transition is firing.
 int getHistory()
          Return the history type.
 jade.core.behaviours.Behaviour getTarget()
          Return the behaviour that is assigned as the target of the transition.
 java.lang.String getTransitionName()
          Return the name of the transition.
 void setHistory(int history)
          Set the history type.
 void setTarget(jade.core.behaviours.Behaviour aTarget)
          Set the target state.
 void setTransitionName(java.lang.String n)
          Set the name of the transition.
 boolean trigger(jade.core.behaviours.Behaviour source, jade.lang.acl.ACLMessage msg)
          This method is used to test if the transition can fire.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_HISTORY

public static final int NO_HISTORY
Indicates that the transition doesn't use history for its target state

See Also:
Constant Field Values

SHALLOW_HISTORY

public static final int SHALLOW_HISTORY
Indicates that the transition uses shallow history for its target state

See Also:
Constant Field Values

DEEP_HISTORY

public static final int DEEP_HISTORY
Indicates that the transition uses deep history for its target state

See Also:
Constant Field Values
Constructor Detail

DistilledStateChartTransition

public DistilledStateChartTransition()
Default constructor. Source, target, and name must be set manually.


DistilledStateChartTransition

public DistilledStateChartTransition(java.lang.String aName,
                                     jade.core.behaviours.Behaviour tgt)
Default constructor. The code requires that the behaviour that you are adding has already been added as a state in the parent DistilledStateChartBehaviour. It will throw a runtime exception if you have not done this.

Parameters:
aName - a String name of the transition
tgt - the target behaviour
Throws:
java.lang.RuntimeException - if we are adding a behaviour that has not already been assigned to a DSC.

DistilledStateChartTransition

public DistilledStateChartTransition(java.lang.String aName,
                                     jade.core.behaviours.Behaviour tgt,
                                     int history)
Constructor that sets also the history.

Parameters:
aName - a string name of the transition
tgt - the target behaviour
history - history type to use for target state
Throws:
java.lang.RuntimeException - if we are adding a behaviour that has not already been assigned to a DSC or if we set shallow or deep history and target state isn't a DistilledStateChartBehaviour
Method Detail

action

public void action(jade.lang.acl.ACLMessage msg)
This method is invoked when a transition is firing. Usually this method will be overridden.

Parameters:
msg - the ACLMessage that caused the transition to fire.

trigger

public boolean trigger(jade.core.behaviours.Behaviour source,
                       jade.lang.acl.ACLMessage msg)
This method is used to test if the transition can fire. Naturally, this method is normally overridden.

Parameters:
source - The behaviour that is the source of the transition.
msg - the ACLMessage to test. The msg could be a DistilledStateChartEvent object.
Returns:
true if we are to trigger on the message, false otherwise.

getTransitionName

public java.lang.String getTransitionName()
Return the name of the transition.

Returns:
the name.

setTransitionName

public void setTransitionName(java.lang.String n)
Set the name of the transition.

Parameters:
n - the name of the transition.

getTarget

public jade.core.behaviours.Behaviour getTarget()
Return the behaviour that is assigned as the target of the transition.

Returns:
the target behaviour.

setTarget

public void setTarget(jade.core.behaviours.Behaviour aTarget)
Set the target state.

Parameters:
aTarget - the target state.
Throws:
java.lang.RuntimeException - if we are adding a behaviour that has not already been assigned to a DSC or if we set shallow or deep history and target state isn't a DistilledStateChartBehaviour.

getHistory

public int getHistory()
Return the history type.

Returns:
The history type.

setHistory

public void setHistory(int history)
Set the history type.

Parameters:
history - The history type.