jade.core.behaviours
Class Behaviour.RunnableChangedEvent

java.lang.Object
  |
  +--jade.core.behaviours.Behaviour.RunnableChangedEvent

protected class Behaviour.RunnableChangedEvent
extends java.lang.Object
implements java.io.Serializable

Event class for notifying blocked and restarted behaviours. This class is used to notify interested behaviours when a Behaviour changes its runnable state. It may be sent to behaviour's parent (upward notification or to behaviour's children (downward notification).

See Also:
Serialized Form

Constructor Summary
protected Behaviour.RunnableChangedEvent()
           
 
Method Summary
 Behaviour getSource()
          Read event source.
 void init(boolean b, int d)
          Re-init event content.
 boolean isRunnable()
          Check whether the event is runnable.
 boolean isUpwards()
          Check which direction this event is travelling.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Behaviour.RunnableChangedEvent

protected Behaviour.RunnableChangedEvent()
Method Detail

init

public void init(boolean b,
                 int d)
Re-init event content. This method can be used to rewrite an existing event with new data (much cheaper than making a new object).
Parameters:
b - A boolean flag; when false it means that a behaviour passed from Ready to Blocked state. When true it means that a behaviour passed from Blocked to Ready (this flag is the truth value of the predicate 'The behaviour has now become runnable'.
d - A notification direction: when direction is NOTIFY_UP, the event travels upwards the behaviour containment hierarchy; when it is NOTIFY_DOWN, the event travels downwards.

getSource

public Behaviour getSource()
Read event source.
Returns:
The Behaviour object which generated this event.

isRunnable

public boolean isRunnable()
Check whether the event is runnable.
Returns:
true when the behaviour generating this event has become Ready, false when it has become Blocked.

isUpwards

public boolean isUpwards()
Check which direction this event is travelling.
Returns:
true when the event is a notification going from a child behaviour to its parent; false otherwise.