hmi.elckerlyc
Class ElckerlycRealizer

java.lang.Object
  extended by hmi.elckerlyc.ElckerlycRealizer

public class ElckerlycRealizer
extends Object

Use this thin wrapper to a AbstractScheduler to control one virtual human by sending snippets of BML to it. This is one of the central accesspoints to controlling a virtual human. (The A BMLRealizer is built from the following elements:

One way to obtain a BMLRealizer is to request one upon creation of a virtual human in an ElckerlycEnvironment. By default, the BML Realizer will use SmartBody scheduler. One can override the construction of the realizer by overriding the initXXX methods.

Author:
Dennis Reidsma, Herwin van Welbergen

Field Summary
private static org.slf4j.Logger logger
           
private  BMLParser parser
          to parse the BML snippets (stored in BehaviourBlocks) and collect the constraints (this parser is a scheduler.Scheduler object)
private  BMLScheduler scheduler
          A BaseScheduler (e.g.
private  SchedulingClock schedulingClock
           
 
Constructor Summary
ElckerlycRealizer(BMLParser bmlparser, SchedulingClock c, BMLScheduler bmlScheduler, Planner... planners)
          Constructs a ElckerlycRealizer facade and hooks up the planners to it
ElckerlycRealizer(BMLParser p, SchedulingClock c, Planner... planners)
          Constructs a ElckerlycRealizer facade and hooks up the planners to it Uses a BMLScheduler with a SmartBodySchedulingStrategy
ElckerlycRealizer(SchedulingClock c, Planner... planners)
          Constructs a ElckerlycRealizer facade and hooks up the planners to it Uses the default BMLParser as BMLParser and a BMLScheduler with a SmartBodySchedulingStrategy.
 
Method Summary
 void addAnticipator(String id, Anticipator ap)
          Add an Anticipator to the scheduler, to interact with the synchronisation points in the BML
 void addExceptionListener(BMLExceptionListener newListener)
          adds an exception listener to the realizer.
 void addFeedbackListener(BMLFeedbackListener newListener)
          add a feedbacklistener to the realizer.
private  void addPlanner(Planner p)
           
 void addPlanningListener(BMLTPlanningListener bp)
           
 void addWarningListener(BMLWarningListener newListener)
          add a warninglistener to the realizer.
 void clear()
          Clears the parser and the scheduler
 Planner getPlanner(Class<? extends Behaviour> c)
           
 BMLScheduler getScheduler()
           
protected  void initBMLInfo()
          Init the BMLInfo, to make sure that the BML parser knows how to handle all BMLT behavior types.
 void removeAnticipator(String aid)
           
 void reset()
           
 void scheduleBML(Reader in)
          Schedules piece of BML.
 void scheduleBML(String blockContent)
          Schedules piece of BML.
 void scheduleBML(XMLTokenizer in)
          Schedules piece of BML.
 void setExceptionListener(BMLExceptionListener e)
          Remove all exception listeners and set a new one for the scheduler and animation player.
 void setFeedbackListener(BMLFeedbackListener f)
          Remove all feedback listeners and set a new one for the animation planner (who sets it in all newly created tmus).
 void setParameterValue(String behId, String bmlId, String paramId, float value)
           
 void setParameterValue(String behId, String bmlId, String paramId, String value)
           
 void setWarningListener(BMLWarningListener w)
          Remove all warning listeners and set a new one for the scheduler and animation player.
 void shutdown()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static org.slf4j.Logger logger

schedulingClock

private final SchedulingClock schedulingClock

parser

private final BMLParser parser
to parse the BML snippets (stored in BehaviourBlocks) and collect the constraints (this parser is a scheduler.Scheduler object)


scheduler

private final BMLScheduler scheduler
A BaseScheduler (e.g. SmartBodyScheduler) that combines the parser and several planners (verbal, animation) registered for several behaviors (head, BMLTProc, speech) to play behavior sent from XML

Constructor Detail

ElckerlycRealizer

public ElckerlycRealizer(BMLParser bmlparser,
                         SchedulingClock c,
                         BMLScheduler bmlScheduler,
                         Planner... planners)
Constructs a ElckerlycRealizer facade and hooks up the planners to it


ElckerlycRealizer

public ElckerlycRealizer(BMLParser p,
                         SchedulingClock c,
                         Planner... planners)
Constructs a ElckerlycRealizer facade and hooks up the planners to it Uses a BMLScheduler with a SmartBodySchedulingStrategy


ElckerlycRealizer

public ElckerlycRealizer(SchedulingClock c,
                         Planner... planners)
Constructs a ElckerlycRealizer facade and hooks up the planners to it Uses the default BMLParser as BMLParser and a BMLScheduler with a SmartBodySchedulingStrategy.

Method Detail

setParameterValue

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

setParameterValue

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

setFeedbackListener

public void setFeedbackListener(BMLFeedbackListener f)
Remove all feedback listeners and set a new one for the animation planner (who sets it in all newly created tmus).


setWarningListener

public void setWarningListener(BMLWarningListener w)
Remove all warning listeners and set a new one for the scheduler and animation player.


setExceptionListener

public void setExceptionListener(BMLExceptionListener e)
Remove all exception listeners and set a new one for the scheduler and animation player.


addExceptionListener

public void addExceptionListener(BMLExceptionListener newListener)
adds an exception listener to the realizer. This listener will be registered with the scheduler.


addPlanningListener

public void addPlanningListener(BMLTPlanningListener bp)

addWarningListener

public void addWarningListener(BMLWarningListener newListener)
add a warninglistener to the realizer. This listener will be registered with the scheduler.


addFeedbackListener

public void addFeedbackListener(BMLFeedbackListener newListener)
add a feedbacklistener to the realizer. This listener will be registered with the animation planner and verbal planner.


initBMLInfo

protected void initBMLInfo()
Init the BMLInfo, to make sure that the BML parser knows how to handle all BMLT behavior types. This needs to be done for all non-core BML element types.


addPlanner

private void addPlanner(Planner p)

addAnticipator

public void addAnticipator(String id,
                           Anticipator ap)
Add an Anticipator to the scheduler, to interact with the synchronisation points in the BML


removeAnticipator

public void removeAnticipator(String aid)

scheduleBML

public void scheduleBML(Reader in)
                 throws IOException
Schedules piece of BML. This call is blocking.

Throws:
IOException
XMLScanException - if the BML was invalid XML

shutdown

public void shutdown()

scheduleBML

public void scheduleBML(XMLTokenizer in)
Schedules piece of BML. This call is blocking.

Throws:
IOException
XMLScanException - if the BML was invalid XML

scheduleBML

public void scheduleBML(String blockContent)
Schedules piece of BML. This call is blocking.

Throws:
IOException
XMLScanException - if the BML was invalid XML

clear

public void clear()
Clears the parser and the scheduler


reset

public void reset()

getPlanner

public Planner getPlanner(Class<? extends Behaviour> c)

getScheduler

public BMLScheduler getScheduler()
Returns:
the scheduler