eu.semaine.components.dialogue.actionproposers
Class UtteranceActionProposer

java.lang.Object
  extended by java.lang.Thread
      extended by eu.semaine.components.Component
          extended by eu.semaine.components.dialogue.actionproposers.UtteranceActionProposer
All Implemented Interfaces:
eu.semaine.components.dialogue.behaviourselection.behaviours.BehaviourClass, SEMAINEMessageAvailableListener, java.lang.Runnable

public class UtteranceActionProposer
extends Component
implements eu.semaine.components.dialogue.behaviourselection.behaviours.BehaviourClass


Nested Class Summary
 
Nested classes/interfaces inherited from class eu.semaine.components.Component
Component.State
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class eu.semaine.components.Component
inputWaiting, isInput, isOutput, log, meta, receivers, senders, state, waitingTime
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
UtteranceActionProposer()
          Constructor of ResponseActionProposer Initializes all Senders and Receivers, and initializes everything.
 
Method Summary
 void act()
          Act method, called every 50ms.
 org.w3c.dom.Document constructFMLDocument(java.util.ArrayList<java.lang.String> argNames, java.util.ArrayList<java.lang.String> argValues)
          Constructs a FML-document from the given arguments
 java.lang.String createHash(eu.semaine.components.dialogue.datastructures.Response r, java.util.ArrayList<java.lang.String> argNames, java.util.ArrayList<java.lang.String> argValues)
          Creates a unique Hash from the given list of arguments, to make a unique identifier of this particular Response.
 void execute(eu.semaine.components.dialogue.informationstate.InformationState is, java.util.ArrayList<java.lang.String> argNames, java.util.ArrayList<java.lang.String> argValues)
          Executes the Behaviour of a Template, with the given InformationState, and the given list of arguments.
 void getCombinedUserDialogueAct()
          Combines all DialogueActs of the last UserTurn, and puts this in the InformationState
static UtteranceActionProposer getMyClass()
          Returns the instance of this class.
 eu.semaine.components.dialogue.datastructures.Response getResponse(java.util.ArrayList<java.lang.String> argNames, java.util.ArrayList<java.lang.String> argValues)
          Retrieves the Response from the given list of arguments.
 void prepare(eu.semaine.components.dialogue.informationstate.InformationState is, java.util.ArrayList<java.lang.String> argNames, java.util.ArrayList<java.lang.String> argValues)
          Executes the Behaviour of a Template, with the given InformationState, and the given list of arguments.
 void react(SEMAINEMessage m)
          Updates the InformationState based on the SemaineMessages it receives
 void sendData(java.lang.String name, java.lang.String value, java.lang.String channel)
          Sends the given data to the other Semaine components
 void sendDataAtEndOfTurn(java.lang.String name, java.lang.String value, java.lang.String channel)
          Adds the given data to the list of data to send to Semaine at the end of the Agent's turn
 void sendSpeaking()
          Updates the InformationState with the behaviour that the Agent is performing now
 void setISEmotions(java.lang.String emotion, java.util.ArrayList<java.lang.Float> nrLow, java.util.ArrayList<java.lang.Float> nrHigh)
          Based on the given emotion-name, and the list of low and high receives intensities, calculate the min,max and average values, and put this in the InformationState.
 java.lang.String speechReady(SEMAINEXMLMessage xm)
          This method checks if the given message contains the end signal of the animation that the agent is playing.
 boolean speechStarted(SEMAINEXMLMessage xm)
          This method checks if the given message contains the start signal of the animation that the agent is going to play next.
 void summarizeEmotionEvents()
          Summarizes the detected Emotional events and puts this in the InformationState
 void summarizeFeatures()
          Summarizes the detected AudioFeatures and puts this in the InformationState
 
Methods inherited from class eu.semaine.components.Component
customStartIO, exitRequested, messageAvailableFrom, requestExit, run
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UtteranceActionProposer

public UtteranceActionProposer()
                        throws javax.jms.JMSException
Constructor of ResponseActionProposer Initializes all Senders and Receivers, and initializes everything.

Throws:
javax.jms.JMSException
Method Detail

getMyClass

public static UtteranceActionProposer getMyClass()
Returns the instance of this class.


act

public void act()
         throws javax.jms.JMSException
Act method, called every 50ms. If the system is started and the Agent is not speaking at this moment, check all Templates and execute any fitting behaviour.

Overrides:
act in class Component
Throws:
javax.jms.JMSException - if communication with the JMS server goes wrong.

react

public void react(SEMAINEMessage m)
           throws javax.jms.JMSException
Updates the InformationState based on the SemaineMessages it receives

Overrides:
react in class Component
Throws:
javax.jms.JMSException - if communication with the JMS server goes wrong.

speechStarted

public boolean speechStarted(SEMAINEXMLMessage xm)
This method checks if the given message contains the start signal of the animation that the agent is going to play next.

Parameters:
xm - the message to check
Returns:
true if the message contains the start signal, false if it does not.

speechReady

public java.lang.String speechReady(SEMAINEXMLMessage xm)
                             throws javax.jms.JMSException
This method checks if the given message contains the end signal of the animation that the agent is playing.

Parameters:
xm - the message to check
Returns:
true if the message contains the end signal, false if it does not.
Throws:
javax.jms.JMSException

summarizeEmotionEvents

public void summarizeEmotionEvents()
Summarizes the detected Emotional events and puts this in the InformationState


setISEmotions

public void setISEmotions(java.lang.String emotion,
                          java.util.ArrayList<java.lang.Float> nrLow,
                          java.util.ArrayList<java.lang.Float> nrHigh)
Based on the given emotion-name, and the list of low and high receives intensities, calculate the min,max and average values, and put this in the InformationState.

Parameters:
emotion - - the name of the Emotion this data belongs to
nrLow - - the number of low emotion-values (<0)
nrHigh - - the number of high emotion-values (>=0)

summarizeFeatures

public void summarizeFeatures()
Summarizes the detected AudioFeatures and puts this in the InformationState


getCombinedUserDialogueAct

public void getCombinedUserDialogueAct()
Combines all DialogueActs of the last UserTurn, and puts this in the InformationState


sendSpeaking

public void sendSpeaking()
Updates the InformationState with the behaviour that the Agent is performing now


sendDataAtEndOfTurn

public void sendDataAtEndOfTurn(java.lang.String name,
                                java.lang.String value,
                                java.lang.String channel)
Adds the given data to the list of data to send to Semaine at the end of the Agent's turn

Parameters:
name - - the name of the data-element to send.
value - - the value of the data-element to send.
channel - - the Semaine-channel to send the data too.

sendData

public void sendData(java.lang.String name,
                     java.lang.String value,
                     java.lang.String channel)
              throws javax.jms.JMSException
Sends the given data to the other Semaine components

Parameters:
name - - the name of the data-element to send.
value - - the value of the data-element to send.
channel - - the Semaine-channel to send the data too (could be 'dialogstate' and 'contextstate')
Throws:
javax.jms.JMSException

execute

public void execute(eu.semaine.components.dialogue.informationstate.InformationState is,
                    java.util.ArrayList<java.lang.String> argNames,
                    java.util.ArrayList<java.lang.String> argValues)
Executes the Behaviour of a Template, with the given InformationState, and the given list of arguments.

Specified by:
execute in interface eu.semaine.components.dialogue.behaviourselection.behaviours.BehaviourClass
Parameters:
is - - the current InformationState
argNames - - the list of names of the given arguments
argValues - - the list of values of the given arguments

prepare

public void prepare(eu.semaine.components.dialogue.informationstate.InformationState is,
                    java.util.ArrayList<java.lang.String> argNames,
                    java.util.ArrayList<java.lang.String> argValues)
Executes the Behaviour of a Template, with the given InformationState, and the given list of arguments.

Specified by:
prepare in interface eu.semaine.components.dialogue.behaviourselection.behaviours.BehaviourClass
Parameters:
is - - the current InformationState
argNames - - the list of names of the given arguments
argValues - - the list of values of the given arguments

constructFMLDocument

public org.w3c.dom.Document constructFMLDocument(java.util.ArrayList<java.lang.String> argNames,
                                                 java.util.ArrayList<java.lang.String> argValues)
Constructs a FML-document from the given arguments

Parameters:
argNames - - the names of the given arguments.
argValues - - the values of the given arguments.
Returns:
the constructed FML-document.

getResponse

public eu.semaine.components.dialogue.datastructures.Response getResponse(java.util.ArrayList<java.lang.String> argNames,
                                                                          java.util.ArrayList<java.lang.String> argValues)
Retrieves the Response from the given list of arguments. If two responses are present they are combined into 1.

Parameters:
argNames - - the names of the given arguments.
argValues - - the values of the given arguments.
Returns:
the found Response

createHash

public java.lang.String createHash(eu.semaine.components.dialogue.datastructures.Response r,
                                   java.util.ArrayList<java.lang.String> argNames,
                                   java.util.ArrayList<java.lang.String> argValues)
Creates a unique Hash from the given list of arguments, to make a unique identifier of this particular Response.

Parameters:
argNames - - the names of the given arguments.
argValues - - the values of the given arguments.
Returns:
the Hash-string creates from the list of arguments.