hmi.elckerlyc.speechengine
Class VerbalPlanPlayer

java.lang.Object
  extended by hmi.elckerlyc.speechengine.VerbalPlanPlayer

public class VerbalPlanPlayer
extends Object

Runs the VerbalPlan. For rapid execution of new speech, the VerbalPlanPlayer always has a thread available in which the plan can be run. Use shutdown to close the VerbalPlanPlayer completely and get rid of this thread. The VerbalPlanPlayer should not be reused after shutdown.

Author:
Herwin

Nested Class Summary
(package private)  class VerbalPlanPlayer.SpeechRunner
           
 
Field Summary
private  boolean doStop
           
private  List<BMLExceptionListener> exceptionListeners
           
private  ExecutorService exec
           
private static org.slf4j.Logger logger
           
private  Future<?> speechRunner
           
private  ArrayList<SpeechUnit> speechUnits
           
private  double time
           
 
Constructor Summary
VerbalPlanPlayer()
           
 
Method Summary
 void addExceptionListener(BMLExceptionListener ws)
           
 void addSpeechUnit(SpeechUnit su)
           
 void clearAll(double time)
           
 void exception(BMLExceptionFeedback e)
           
 Set<String> getBehaviours(String bmlId)
           
 double getEndTime(String behId, String bmlId)
           
 Set<String> getInvalidBehaviors()
           
 int getNumberOfSpeechUnits()
           
private  SpeechUnit getSpeechUnit(String id, String bmlId)
           
 void interruptBehaviourBlock(String bmlId, double time)
           
private  void interruptSpeechUnit(SpeechUnit su, double globalTime)
           
 void interruptSpeechUnit(String id, String bmlId, double globalTime)
           
 void play(double t)
           
 void removeAllWarningListeners()
           
private  void removeSpeechUnits(List<SpeechUnit> suList)
           
 void reset()
           
 void scheduleStop()
           
 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)
           
 void setSpeechParameter(String id, String bmlId, String parameter, float value)
           
 void shutdown()
          Shutdown the VerbalPlanPlayer thread
 void stop()
          Stop playing speech units
private  void suException(SpeechUnit su, String message, double time)
          Callback for behaviors
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

time

private double time

speechUnits

private ArrayList<SpeechUnit> speechUnits

doStop

private boolean doStop

speechRunner

private Future<?> speechRunner

exec

private final ExecutorService exec

logger

private static org.slf4j.Logger logger

exceptionListeners

private List<BMLExceptionListener> exceptionListeners
Constructor Detail

VerbalPlanPlayer

public VerbalPlanPlayer()
Method Detail

setSpeechParameter

public void setSpeechParameter(String id,
                               String bmlId,
                               String parameter,
                               float value)

getSpeechUnit

private SpeechUnit getSpeechUnit(String id,
                                 String bmlId)

addSpeechUnit

public void addSpeechUnit(SpeechUnit su)

setBMLBlockState

public void setBMLBlockState(String bmlId,
                             PlanUnitState state)

interruptBehaviourBlock

public void interruptBehaviourBlock(String bmlId,
                                    double time)

getNumberOfSpeechUnits

public int getNumberOfSpeechUnits()

interruptSpeechUnit

private void interruptSpeechUnit(SpeechUnit su,
                                 double globalTime)

removeSpeechUnits

private void removeSpeechUnits(List<SpeechUnit> suList)

interruptSpeechUnit

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

play

public void play(double t)

shutdown

public void shutdown()
              throws InterruptedException
Shutdown the VerbalPlanPlayer thread

Throws:
InterruptedException

scheduleStop

public void scheduleStop()

stop

public void stop()
Stop playing speech units


reset

public void reset()

getInvalidBehaviors

public Set<String> getInvalidBehaviors()

clearAll

public void clearAll(double time)

suException

private void suException(SpeechUnit su,
                         String message,
                         double time)
Callback for behaviors


getBehaviours

public Set<String> getBehaviours(String bmlId)

getEndTime

public double getEndTime(String behId,
                         String bmlId)

setParameterValue

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

setParameterValue

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

exception

public void exception(BMLExceptionFeedback e)

addExceptionListener

public void addExceptionListener(BMLExceptionListener ws)

removeAllWarningListeners

public void removeAllWarningListeners()