Package FAtiMA.Core.emotionalState
Class EmotionalState
java.lang.Object
FAtiMA.Core.emotionalState.EmotionalState
- All Implemented Interfaces:
Serializable
Implements the character's emotional state. It contains emotions,
mood, and arousal. You cannot create an EmotionalState, since there
is one and only one instance of the EmotionalState for the agent.
If you want to access it use EmotionalState.GetInstance() method.
- Author:
- Joao Dias
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Hashtable<String,EmotionDisposition> protected Hashtable<String,ActiveEmotion> protected longprotected Mood -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAddEmotion(BaseEmotion potEm, AgentModel am) Creates and Adds to the emotional state a new ActiveEmotion based on a received BaseEmotion.voidAddEmotionDisposition(EmotionDisposition emotionDisposition) voidClear()Clears all the emotions in the EmotionalStateclone()voidDecay()Decays all emotions, mood and arousal according to the System TimeCreates a new ActiveEmotion based on a received BaseEmotion.GetEmotion(BaseEmotion emotion) GetEmotion(String emotionKey) Searches for a given emotion in the EmotionalStategetEmotionDisposition(String emotionName) Gets a set that contains all the keys for the emotionsGets an Iterator that allows you to iterate over the set of ActiveEmotions in the agent's emotional statefloatGetMood()Gets a float value that represents the characters mood.Gets the current strongest emotion (the one with highest intensity) in the character's emotional stateGetStrongestEmotion(Event event) Gets the current strongest emotion (the one with highest intensity) in the character's emotional state, which was triggered by the received eventvoidtoString()Converts the emotional state to a StringtoXml()Converts the emotional state to XML
-
Field Details
-
_emotionPool
-
_emotionDispositions
-
_lastTime
protected long _lastTime -
_mood
-
-
Constructor Details
-
EmotionalState
public EmotionalState()Creates a empty EmotionalState
-
-
Method Details
-
clone
-
AddEmotion
Creates and Adds to the emotional state a new ActiveEmotion based on a received BaseEmotion. However, the ActiveEmotion will be created and added to the emotional state only if the final intensity for the emotion surpasses the threshold for the emotion type.- Parameters:
potEm- - the BaseEmotion that creates the ActiveEmotion- Returns:
- the ActiveEmotion created if it was added to the EmotionalState. Otherwise, if the intensity of the emotion was not enough to be added to the EmotionalState, the method returns null
-
DetermineActiveEmotion
Creates a new ActiveEmotion based on a received BaseEmotion. However, the ActiveEmotion will be created only if the final intensity for the emotion surpasses the threshold for the emotion type. Very similar to the method AddEmotion, but this method DOES NOT ADD the emotion to the emotional state. It should only be used to determine the emotion that would be created.- Parameters:
potEm- - the BaseEmotion that creates the ActiveEmotion- Returns:
- the ActiveEmotion created. If the intensity of the emotion was not enough to be created, the method returns null
-
Clear
public void Clear()Clears all the emotions in the EmotionalState -
Decay
public void Decay()Decays all emotions, mood and arousal according to the System Time -
GetEmotion
Searches for a given emotion in the EmotionalState- Parameters:
emotionKey- - a string that corresponds to a hashkey that represents the emotion in the EmotionalState- Returns:
- the found ActiveEmotion if it exists in the EmotionalState, null if the emotion doesn't exist anymore
-
GetEmotion
-
GetEmotionKeysSet
Gets a set that contains all the keys for the emotions- Returns:
- the KeySet for all emotions
-
GetEmotionsIterator
Gets an Iterator that allows you to iterate over the set of ActiveEmotions in the agent's emotional state- Returns:
- an emotion's iterator
-
GetMood
public float GetMood()Gets a float value that represents the characters mood. 0 represents neutral mood, negative values represent negative mood, positive values represent positive mood (ranged [-10;10])- Returns:
- the agent's mood
-
GetStrongestEmotion
Gets the current strongest emotion (the one with highest intensity) in the character's emotional state- Returns:
- the strongest emotion or null if there is no emotion in the emotional state
-
GetStrongestEmotion
Gets the current strongest emotion (the one with highest intensity) in the character's emotional state, which was triggered by the received event- Parameters:
event- - the event that caused the emotion that we want to retrieve- Returns:
- the strongest emotion or null if there is no emotion in the emotional state
-
toString
Converts the emotional state to a String -
toXml
Converts the emotional state to XML- Returns:
- a XML String that contains all information in the emotional state
-
RemoveEmotion
-
AddEmotionDisposition
-
getEmotionDispositions
-
getEmotionDisposition
-
getEmotionPoolValues
-