hmi.elckerlyc.planunit
Class PlanPlayer

java.lang.Object
  extended by hmi.elckerlyc.planunit.PlanPlayer

@ThreadSafe
public final class PlanPlayer
extends Object

Generic PlanUnit player. Plays the correct PlanUnit at time t, taking into account replacement groups etc. PlanUnits used in the PlanPlayer should have non-blocking play and start functions.

Author:
Herwin Possible design extension:
We could template the PlanUnit, so that the PlanPlayer can only handle one sub type of PlanUnit to prevent (for example) sticking TimedFaceUnits and TimedMotionUnits in one plan. This could also be used to get PlanUnits of the template type and to throw/catch more specialized, templated, PlayExceptions. I don't think direct access to a PlanUnit through some getter is a good idea though, so templating currently isn't really necessary. For thread safety, delegation or templating is the preffered way to extend this class.

Field Summary
private static org.slf4j.Logger logger
           
private  List<PlanUnit> planUnits
           
private  List<PlanUnit> playingPlanUnits
           
 
Constructor Summary
PlanPlayer()
           
 
Method Summary
 void addPlanUnit(PlanUnit pu)
           
 void clearAll(double time)
           
 Set<String> getBehaviours(String bmlId)
           
 double getEndTime(String behId, String bmlId)
           
 Set<String> getInvalidBehaviors()
           
 int getNumberOfPlanUnits()
           
private  PlanUnit getPlanUnit(String id, String bmlId)
          Gets the first planunit corresponding with id:bmlId (there could be more if they are subPlanUnits
 void interruptBehaviourBlock(String bmlId, double time)
           
 void interruptPlanUnit(String id, String bmlId, double globalTime)
           
 void play(double t)
           
 void play(double t, PUExceptionCallback puWc)
           
 void removePlanUnits(Collection<PlanUnit> puRemove, double time)
           
 void reset()
           
 void setBMLBlockState(String bmlId, PlanUnitState state)
           
 void setParameterValue(String behId, String bmlId, String paramId, float value)
           
 void setParameterValue(String behId, String bmlId, String paramId, String value)
           
private  boolean updatePlayingPU(PlanUnit pu, PUExceptionCallback puWc, double t)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

planUnits

private List<PlanUnit> planUnits

playingPlanUnits

private List<PlanUnit> playingPlanUnits

logger

private static final org.slf4j.Logger logger
Constructor Detail

PlanPlayer

public PlanPlayer()
Method Detail

play

public void play(double t)

updatePlayingPU

private boolean updatePlayingPU(PlanUnit pu,
                                PUExceptionCallback puWc,
                                double t)

play

public void play(double t,
                 PUExceptionCallback puWc)

getInvalidBehaviors

public Set<String> getInvalidBehaviors()

addPlanUnit

public void addPlanUnit(PlanUnit pu)

removePlanUnits

public void removePlanUnits(Collection<PlanUnit> puRemove,
                            double time)

interruptPlanUnit

public void interruptPlanUnit(String id,
                              String bmlId,
                              double globalTime)

setBMLBlockState

public void setBMLBlockState(String bmlId,
                             PlanUnitState state)

getNumberOfPlanUnits

public int getNumberOfPlanUnits()

getPlanUnit

private PlanUnit getPlanUnit(String id,
                             String bmlId)
Gets the first planunit corresponding with id:bmlId (there could be more if they are subPlanUnits


reset

public void reset()

clearAll

public void clearAll(double time)

getBehaviours

public Set<String> getBehaviours(String bmlId)

getEndTime

public double getEndTime(String behId,
                         String bmlId)

interruptBehaviourBlock

public void interruptBehaviourBlock(String bmlId,
                                    double time)

setParameterValue

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

setParameterValue

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