hmi.elckerlyc.scheduler
Class BMLBlock

java.lang.Object
  extended by hmi.elckerlyc.scheduler.BMLBlock
All Implemented Interfaces:
BMLExceptionListener, BMLFeedbackListener, BMLListener, BMLWarningListener

public class BMLBlock
extends Object
implements BMLWarningListener, BMLFeedbackListener, BMLExceptionListener

Captures the feedback of behaviors of a BML Block and sends the BML stop feedback when the block is finished. A BML block is finished when:
1. For all behaviors in the block with known end time, the behavior end feedback was sent and time > end time
2. And for all behaviors with unknown end time, feedback was received on all their set sync points (=TimePegs)

Author:
welberge

Field Summary
private  Set<String> appendSet
           
private  ConcurrentHashMap<String,Set<String>> behaviorInfo
           
private  String bmlId
           
private  Set<String> droppedBehaviours
           
private static org.slf4j.Logger logger
           
private  Set<String> onStartSet
           
private  BMLScheduler scheduler
           
private  PlanUnitState state
           
 
Constructor Summary
BMLBlock(String id, BMLScheduler s)
           
BMLBlock(String id, BMLScheduler s, Set<String> appendAfter, Set<String> onStart)
           
 
Method Summary
 void clear()
          Remove from scheduler
 void exception(BMLExceptionFeedback be)
           
 String getBMLId()
           
 Set<String> getOnStartSet()
           
 PlanUnitState getState()
           
private  boolean isFinished(double timeStamp)
           
 void performanceStart(BMLPerformanceStartFeedback psf)
           
 void performanceStop(BMLPerformanceStopFeedback psf)
           
 void setState(PlanUnitState state)
           
 void syncProgress(BMLSyncPointProgressFeedback spp)
           
 void update(Set<String> finishedBMLBlocks, Set<String> allBlocks)
           
(package private)  void updateState(double timeStamp)
           
 void warn(BMLWarningFeedback bw)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bmlId

private final String bmlId

scheduler

private final BMLScheduler scheduler

state

private PlanUnitState state

logger

private static org.slf4j.Logger logger

behaviorInfo

private final ConcurrentHashMap<String,Set<String>> behaviorInfo

appendSet

private final Set<String> appendSet

onStartSet

private final Set<String> onStartSet

droppedBehaviours

private final Set<String> droppedBehaviours
Constructor Detail

BMLBlock

public BMLBlock(String id,
                BMLScheduler s,
                Set<String> appendAfter,
                Set<String> onStart)

BMLBlock

public BMLBlock(String id,
                BMLScheduler s)
Method Detail

getOnStartSet

public Set<String> getOnStartSet()
Returns:
an unmodifiable copy of the onStartSet

clear

public void clear()
Remove from scheduler


update

public void update(Set<String> finishedBMLBlocks,
                   Set<String> allBlocks)

isFinished

private boolean isFinished(double timeStamp)

updateState

void updateState(double timeStamp)

warn

public void warn(BMLWarningFeedback bw)
Specified by:
warn in interface BMLWarningListener

syncProgress

public void syncProgress(BMLSyncPointProgressFeedback spp)
Specified by:
syncProgress in interface BMLFeedbackListener

setState

public void setState(PlanUnitState state)
Parameters:
state - the state to set

getState

public PlanUnitState getState()

exception

public void exception(BMLExceptionFeedback be)
Specified by:
exception in interface BMLExceptionListener

getBMLId

public String getBMLId()
Returns:
the bmlId

performanceStart

public void performanceStart(BMLPerformanceStartFeedback psf)
Specified by:
performanceStart in interface BMLFeedbackListener

performanceStop

public void performanceStop(BMLPerformanceStopFeedback psf)
Specified by:
performanceStop in interface BMLFeedbackListener