Class EmotionalState

java.lang.Object
FAtiMA.Core.emotionalState.EmotionalState
All Implemented Interfaces:
Serializable

public class EmotionalState extends Object implements 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 Details

  • Constructor Details

    • EmotionalState

      public EmotionalState()
      Creates a empty EmotionalState
  • Method Details

    • clone

      public EmotionalState clone()
      Overrides:
      clone in class Object
    • AddEmotion

      public ActiveEmotion AddEmotion(BaseEmotion potEm, AgentModel am)
      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

      public ActiveEmotion DetermineActiveEmotion(BaseEmotion potEm)
      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

      public ActiveEmotion GetEmotion(String emotionKey)
      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

      public ActiveEmotion GetEmotion(BaseEmotion emotion)
    • GetEmotionKeysSet

      public Set<String> GetEmotionKeysSet()
      Gets a set that contains all the keys for the emotions
      Returns:
      the KeySet for all emotions
    • GetEmotionsIterator

      public Iterator<ActiveEmotion> 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

      public ActiveEmotion 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

      public ActiveEmotion GetStrongestEmotion(Event event)
      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

      public String toString()
      Converts the emotional state to a String
      Overrides:
      toString in class Object
      Returns:
      the converted String
    • toXml

      public String toXml()
      Converts the emotional state to XML
      Returns:
      a XML String that contains all information in the emotional state
    • RemoveEmotion

      public void RemoveEmotion(ActiveEmotion em)
    • AddEmotionDisposition

      public void AddEmotionDisposition(EmotionDisposition emotionDisposition)
    • getEmotionDispositions

      public Collection<EmotionDisposition> getEmotionDispositions()
    • getEmotionDisposition

      public EmotionDisposition getEmotionDisposition(String emotionName)
    • getEmotionPoolValues

      public Collection<ActiveEmotion> getEmotionPoolValues()