hmi.elckerlyc.interrupt
Class InterruptPlanner

java.lang.Object
  extended by hmi.elckerlyc.AbstractPlanner
      extended by hmi.elckerlyc.interrupt.InterruptPlanner
All Implemented Interfaces:
Planner

public class InterruptPlanner
extends AbstractPlanner


Field Summary
private  InterruptPlayer player
           
private  BMLScheduler scheduler
           
 
Constructor Summary
InterruptPlanner(InterruptPlayer p)
          Should call setScheduler before actual use
InterruptPlanner(InterruptPlayer p, BMLScheduler s)
           
 
Method Summary
 List<SyncAndTimePeg> addBehaviour(BMLBlockPeg bbPeg, Behaviour b, List<TimePegAndConstraint> sac, PlanUnit planElement)
          Adds a behavior to the plan.
 void addExceptionListener(BMLExceptionListener war)
           
 void clearAll(double time)
          Removes all behaviors from the plan
 InterruptPlayer getInterruptPlayer()
           
 Set<String> getInvalidBehaviours()
          Checks if the behavior plan is still consistent (e.g. after modifying the timing of some TimePegs).
 Player getPlayer()
          Returns the Player for this planner. useful for, e.g., resetting the player of any planner (see BMLRealizer.reset).
 List<Class<? extends Behaviour>> getSupportedBehaviours()
           
 List<Class<? extends Behaviour>> getSupportedDescriptionExtensions()
           
 void interruptBehaviour(String behaviourId, String bmlId, double globalTime)
          Interrupts the behavior, sending the appropiate feedback callbacks if the behavior was running, just removes it otherwise.
 void removeAllExceptionListeners()
           
 void removeBehaviour(String behaviourId, String bmlId)
          Removes behavior with behaviourId and bmlId from the plan Callback behavior is unspecified
 void reset()
          Resets the player, that is: stops running behavior and returns the player to its startup state (default pose etc) This does not clear any behaviours from the plans.
 InterruptUnit resolveSynchs(BMLBlockPeg bbPeg, Behaviour b, List<TimePegAndConstraint> sac)
          Resolves TimePegs for behavior b, given some known time pegs and constraints
 void setParameterValue(String behId, String bmlId, String paramId, float value)
           
 void setParameterValue(String behId, String bmlId, String paramId, String value)
           
 void setScheduler(BMLScheduler s)
           
private  void validateSacs(Behaviour b, List<TimePegAndConstraint> sac)
           
 
Methods inherited from class hmi.elckerlyc.AbstractPlanner
addFeedbackListener, getBehaviours, getEndTime, getFeedbackListeners, interruptBehaviourBlock, removeAllFeedbackListeners, removeFeedbackListener, setBMLBlockState, shutdown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

scheduler

private BMLScheduler scheduler

player

private final InterruptPlayer player
Constructor Detail

InterruptPlanner

public InterruptPlanner(InterruptPlayer p,
                        BMLScheduler s)

InterruptPlanner

public InterruptPlanner(InterruptPlayer p)
Should call setScheduler before actual use

Method Detail

setScheduler

public void setScheduler(BMLScheduler s)

getInterruptPlayer

public InterruptPlayer getInterruptPlayer()

addBehaviour

public List<SyncAndTimePeg> addBehaviour(BMLBlockPeg bbPeg,
                                         Behaviour b,
                                         List<TimePegAndConstraint> sac,
                                         PlanUnit planElement)
                                  throws BehaviourPlanningException
Description copied from interface: Planner
Adds a behavior to the plan. All timepegs in sac must be resolved.

planElement - planElement obtained from resolveSynchs, null to create a new planElement
Returns:
a list of all syncs of the behavior and their linked TimePegs
Throws:
BehaviourPlanningException - if no behavior satisfying sac can be constructed

validateSacs

private void validateSacs(Behaviour b,
                          List<TimePegAndConstraint> sac)
                   throws BehaviourPlanningException
Throws:
BehaviourPlanningException

resolveSynchs

public InterruptUnit resolveSynchs(BMLBlockPeg bbPeg,
                                   Behaviour b,
                                   List<TimePegAndConstraint> sac)
                            throws BehaviourPlanningException
Description copied from interface: Planner
Resolves TimePegs for behavior b, given some known time pegs and constraints

b - the behavior
sac - the provided time pegs and constraints, missing constraints are filled out by this method
Returns:
the object to be placed in the plan (a TimedMotionUnit, SpeechUnit, ...)
Throws:
BehaviourPlanningException - if no behavior satisfying sac can be constructed

addExceptionListener

public void addExceptionListener(BMLExceptionListener war)

clearAll

public void clearAll(double time)
Description copied from interface: Planner
Removes all behaviors from the plan


getInvalidBehaviours

public Set<String> getInvalidBehaviours()
Description copied from interface: Planner
Checks if the behavior plan is still consistent (e.g. after modifying the timing of some TimePegs). Returns id's of behaviors with invalid timing


getPlayer

public Player getPlayer()
Description copied from interface: Planner
Returns the Player for this planner. useful for, e.g., resetting the player of any planner (see BMLRealizer.reset).


getSupportedBehaviours

public List<Class<? extends Behaviour>> getSupportedBehaviours()

getSupportedDescriptionExtensions

public List<Class<? extends Behaviour>> getSupportedDescriptionExtensions()

removeAllExceptionListeners

public void removeAllExceptionListeners()

removeBehaviour

public void removeBehaviour(String behaviourId,
                            String bmlId)
Description copied from interface: Planner
Removes behavior with behaviourId and bmlId from the plan Callback behavior is unspecified


interruptBehaviour

public void interruptBehaviour(String behaviourId,
                               String bmlId,
                               double globalTime)
Description copied from interface: Planner
Interrupts the behavior, sending the appropiate feedback callbacks if the behavior was running, just removes it otherwise.


reset

public void reset()
Description copied from interface: Planner
Resets the player, that is: stops running behavior and returns the player to its startup state (default pose etc) This does not clear any behaviours from the plans.


setParameterValue

public void setParameterValue(String behId,
                              String bmlId,
                              String paramId,
                              float value)

setParameterValue

public void setParameterValue(String behId,
                              String bmlId,
                              String paramId,
                              String value)