Class Behaviour.RunnableChangedEvent

  • All Implemented Interfaces:
    Serializable, Serializable
    Enclosing class:
    Behaviour

    protected class Behaviour.RunnableChangedEvent
    extends Object
    implements 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 Detail

      • RunnableChangedEvent

        protected 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.