Class SequentialBehaviour

  • All Implemented Interfaces:
    Serializable, Serializable

    public class SequentialBehaviour
    extends SerialBehaviour
    Composite behaviour with sequential children scheduling. It is a CompositeBehaviour that executes its children behaviours in sequential order, and terminates when its last child has ended.
    Version:
    $Date$ $Revision$
    Author:
    Giovanni Rimassa - Universita` di Parma, Giovanni Caire - Telecom Italia Lab
    See Also:
    Serialized Form
    • Constructor Detail

      • SequentialBehaviour

        public SequentialBehaviour()
        Default constructor. It does not set the owner agent for this behaviour.
      • SequentialBehaviour

        public SequentialBehaviour​(Agent a)
        This constructor sets the owner agent for this behaviour.
        Parameters:
        a - The agent this behaviour belongs to.
    • Method Detail

      • scheduleNext

        protected void scheduleNext​(boolean currentDone,
                                    int currentResult)
        Sequential policy for children scheduling. This method schedules children behaviours one at a time, in a FIFO fashion.
        Specified by:
        scheduleNext in class CompositeBehaviour
        Parameters:
        currentDone - a flag indicating whether the just executed child has completed or not.
        currentResult - the termination value (as returned by onEnd()) of the just executed child in the case this child has completed (otherwise this parameter is meaningless)
        See Also:
        CompositeBehaviour.scheduleNext(boolean, int)
      • checkTermination

        protected boolean checkTermination​(boolean currentDone,
                                           int currentResult)
        Check whether this SequentialBehaviour must terminate.
        Specified by:
        checkTermination in class CompositeBehaviour
        Parameters:
        currentDone - a flag indicating whether the just executed child has completed or not.
        currentResult - the termination value (as returned by onEnd()) of the just executed child in the case this child has completed (otherwise this parameter is meaningless)
        Returns:
        true when the last child has terminated. false otherwise
        See Also:
        CompositeBehaviour.checkTermination(boolean, int)
      • addSubBehaviour

        public void addSubBehaviour​(Behaviour b)
        Add a sub behaviour to this SequentialBehaviour
      • removeSubBehaviour

        public void removeSubBehaviour​(Behaviour b)
        Remove a sub behaviour from this SequentialBehaviour
      • reset

        public void reset()
        Description copied from class: CompositeBehaviour
        Puts a CompositeBehaviour back in initial state. The internal state is cleaned up and reset() is recursively called for each child behaviour.
        Overrides:
        reset in class CompositeBehaviour
      • skipNext

        public void skipNext()