vs.worldagent
Class BasicOperatorScheduler

java.lang.Object
  extended by vs.worldagent.BasicOperatorScheduler
All Implemented Interfaces:
IAgentModule, IOperatorScheduler

public class BasicOperatorScheduler
extends java.lang.Object
implements IOperatorScheduler

Implements a basic version of the ActionScheduler interface.

Author:
swartjes Created on 15-jul-2005
See Also:
IOperatorScheduler

Constructor Summary
BasicOperatorScheduler(IWorldAgent owner)
          Constructor
 
Method Summary
 void abort(ScheduledOperator sa)
          Aborts a scheduled operator
 int calcDuration(Operator theOperator)
          Calculates the duration of given Action in a certain knowledge context
 int calcInterruptableDuration(Operator theOperator)
          Calculates the interruptableDuration of given Operator in a certain knowledge context
 void clearOperatorResults()
          Clears the history of scheduled actions
 IWorldAgent getAgent()
          To get the Agent
 java.util.List<ScheduledOperator> getOperatorResults()
          Returns the history of scheduled actions, including their state (like aborted or finished)
 java.util.List<ScheduledOperator> getScheduledOperators()
          Returns the list of scheduled actions
 void pulse()
          Increases the time step and handles everything that has to be done in response to it
 boolean schedule(Operator newOperator)
          Schedules an operator
 java.lang.String toString()
           
 void unschedule(ScheduledOperator sa)
          Removes a scheduled operator
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BasicOperatorScheduler

public BasicOperatorScheduler(IWorldAgent owner)
Constructor

Parameters:
owner - the Agent that owns this ActionScheduler
Method Detail

abort

public void abort(ScheduledOperator sa)
Description copied from interface: IOperatorScheduler
Aborts a scheduled operator

Specified by:
abort in interface IOperatorScheduler
Parameters:
sa - the scheduled operator to abort

calcDuration

public int calcDuration(Operator theOperator)
Description copied from interface: IOperatorScheduler
Calculates the duration of given Action in a certain knowledge context

Specified by:
calcDuration in interface IOperatorScheduler
Parameters:
theOperator - the operator to work with
Returns:
the duration in timesteps

calcInterruptableDuration

public int calcInterruptableDuration(Operator theOperator)
Description copied from interface: IOperatorScheduler
Calculates the interruptableDuration of given Operator in a certain knowledge context

Specified by:
calcInterruptableDuration in interface IOperatorScheduler
Parameters:
theOperator - the Operator to work with
Returns:
the interruptableDuration in timesteps

clearOperatorResults

public void clearOperatorResults()
Description copied from interface: IOperatorScheduler
Clears the history of scheduled actions

Specified by:
clearOperatorResults in interface IOperatorScheduler

getAgent

public IWorldAgent getAgent()
Description copied from interface: IAgentModule
To get the Agent

Specified by:
getAgent in interface IAgentModule
Returns:
an Agent that owns this module

getOperatorResults

public java.util.List<ScheduledOperator> getOperatorResults()
Description copied from interface: IOperatorScheduler
Returns the history of scheduled actions, including their state (like aborted or finished)

Specified by:
getOperatorResults in interface IOperatorScheduler
Returns:
a List of previously scheduled actions

getScheduledOperators

public java.util.List<ScheduledOperator> getScheduledOperators()
Description copied from interface: IOperatorScheduler
Returns the list of scheduled actions

Specified by:
getScheduledOperators in interface IOperatorScheduler

pulse

public void pulse()
Description copied from interface: IOperatorScheduler
Increases the time step and handles everything that has to be done in response to it

Specified by:
pulse in interface IOperatorScheduler

schedule

public boolean schedule(Operator newOperator)
Description copied from interface: IOperatorScheduler
Schedules an operator

Specified by:
schedule in interface IOperatorScheduler
Parameters:
newOperator - the operator to schedule
Returns:
true if operator was succesfully scheduled and false otherwise

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
String representation

unschedule

public void unschedule(ScheduledOperator sa)
Description copied from interface: IOperatorScheduler
Removes a scheduled operator

Specified by:
unschedule in interface IOperatorScheduler
Parameters:
sa - the scheduled operator to remove