modelling
Class ActToSatisfaction

java.lang.Object
  extended bysema.Agent.Action
      extended bymodelling.ActToSatisfaction

public class ActToSatisfaction
extends Agent.Action

A generalist Action which try to satisfy a satisfator using an action. When it has succed, it stops the action and starts the futur before ending. If paused, it also pauses its changFor action. Every given action can be null, it means it does nothing.


Constructor Summary
ActToSatisfaction(Agent a, Agent.Action action, Satisfactor endCondition)
           
ActToSatisfaction(Agent a, Agent.Action action, Satisfactor endCondition, Agent.Action succes)
           
ActToSatisfaction(Agent a, Agent.Action action, Satisfactor endCondition, Agent.Action succes, Agent.Action failure)
           
ActToSatisfaction(Agent a, Agent.Action action, Satisfactor endCondition, float verifyDelay)
           
ActToSatisfaction(Agent a, Agent.Action action, Satisfactor endCondition, float verifyDelay, Agent.Action succes)
           
ActToSatisfaction(Agent a, Agent.Action action, Satisfactor endCondition, float verifyDelay, Agent.Action succes, Agent.Action failure)
          Constructs the action.
ActToSatisfaction(Agent a, Satisfactor endCondition)
           
ActToSatisfaction(Agent a, Satisfactor endCondition, float verifyDelay)
           
 
Method Summary
 void close()
          Closing method, always executed as the last code of an action that has begun.
 float firstStep()
          Called at the begin of the action.
 float step()
          Body of the action.
 void whenEnd()
          Called when a negative value has been returned by one of the step methods.
 void whenPaused()
          Called when the action is paused.
 
Methods inherited from class sema.Agent.Action
hasBegun, isDisabled, isPaused, pause, pause, resume, resumedStep, start, start, stop, whenRefused, whenStartInPause, whenStopped
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActToSatisfaction

public ActToSatisfaction(Agent a,
                         Satisfactor endCondition)
See Also:
ActToSatisfaction(sema.Agent a, sema.Agent.Action action, modelling.Satisfactor endCondition, float verifyDelay, sema.Agent.Action succes, sema.Agent.Action failure)

ActToSatisfaction

public ActToSatisfaction(Agent a,
                         Satisfactor endCondition,
                         float verifyDelay)
See Also:
ActToSatisfaction(sema.Agent a, sema.Agent.Action action, modelling.Satisfactor endCondition, float verifyDelay, sema.Agent.Action succes, sema.Agent.Action failure)

ActToSatisfaction

public ActToSatisfaction(Agent a,
                         Agent.Action action,
                         Satisfactor endCondition)
See Also:
ActToSatisfaction(sema.Agent a, sema.Agent.Action action, modelling.Satisfactor endCondition, float verifyDelay, sema.Agent.Action succes, sema.Agent.Action failure)

ActToSatisfaction

public ActToSatisfaction(Agent a,
                         Agent.Action action,
                         Satisfactor endCondition,
                         float verifyDelay)
See Also:
ActToSatisfaction(sema.Agent a, sema.Agent.Action action, modelling.Satisfactor endCondition, float verifyDelay, sema.Agent.Action succes, sema.Agent.Action failure)

ActToSatisfaction

public ActToSatisfaction(Agent a,
                         Agent.Action action,
                         Satisfactor endCondition,
                         Agent.Action succes)
See Also:
ActToSatisfaction(sema.Agent a, sema.Agent.Action action, modelling.Satisfactor endCondition, float verifyDelay, sema.Agent.Action succes, sema.Agent.Action failure)

ActToSatisfaction

public ActToSatisfaction(Agent a,
                         Agent.Action action,
                         Satisfactor endCondition,
                         float verifyDelay,
                         Agent.Action succes)
See Also:
ActToSatisfaction(sema.Agent a, sema.Agent.Action action, modelling.Satisfactor endCondition, float verifyDelay, sema.Agent.Action succes, sema.Agent.Action failure)

ActToSatisfaction

public ActToSatisfaction(Agent a,
                         Agent.Action action,
                         Satisfactor endCondition,
                         Agent.Action succes,
                         Agent.Action failure)
See Also:
ActToSatisfaction(sema.Agent a, sema.Agent.Action action, modelling.Satisfactor endCondition, float verifyDelay, sema.Agent.Action succes, sema.Agent.Action failure)

ActToSatisfaction

public ActToSatisfaction(Agent a,
                         Agent.Action action,
                         Satisfactor endCondition,
                         float verifyDelay,
                         Agent.Action succes,
                         Agent.Action failure)
Constructs the action.

Parameters:
a - the agent to which this action will register.
action - the action to execute when waiting for the endCondition to be satisfiyed.
endCondition - the condition saying whether we reach our goal
verifyDelay - the delay of refresshing of the stat of the condition : every verifydelay secondes we call the isSatisfied of the endCondition.
succes - the action to execute when we succed to satisfy the endCondition
failure - the action to execute when we don't succed to satisfy the endCondition
Method Detail

firstStep

public float firstStep()
Description copied from class: Agent.Action
Called at the begin of the action. By default, calls Agent.Action.step().

Overrides:
firstStep in class Agent.Action

step

public float step()
Description copied from class: Agent.Action
Body of the action. This is the main code to execute. The value returned is the time (in simulated units) to wait before the next call to the body. A negative value means that the action must end. The main idea of this function is that its execution is intended to be spread on a time that should be coherent with the simulation.

Typically, a moving agent that is walking would make a step towards a direction then another, and theses steps would be differents calls to step(). Internal variables should be stocked in the action to allow a good step by step execution.

Overrides:
step in class Agent.Action

whenPaused

public void whenPaused()
Description copied from class: Agent.Action
Called when the action is paused. By default, it does nothing.

Overrides:
whenPaused in class Agent.Action

whenEnd

public void whenEnd()
Description copied from class: Agent.Action
Called when a negative value has been returned by one of the step methods. This is the normal end of the action, that will generally mean that the goal has been reeached.

Overrides:
whenEnd in class Agent.Action

close

public void close()
Description copied from class: Agent.Action
Closing method, always executed as the last code of an action that has begun.

Overrides:
close in class Agent.Action