Class Motivator

java.lang.Object
FAtiMA.motivationalSystem.Motivator
All Implemented Interfaces:
Serializable

public class Motivator extends Object implements Serializable
Represents a motivator based on the PSI model, which is an instance of MotivatorType
Author:
Meiyii Lim
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final float
    Constant value that defines how fast should a drive decay over time.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Motivator(short type, float decayFactor, float weight, float intensity)
    Creates a new Motivator
    Creates a new Motivator that consists in a copy of a given motivator
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Decays the motivator intensity according to the system's timer
    float
     
    float
    Gets the motivator's intensity
    float
    Deprecated.
    use GetNeedUrgency() instead.
    float
    Gets the motivator's urgency discretizing the need intensity into diffent categories (very urgent, urgent, not urgent, satisfied)
    short
    Gets the motivator's type
    float
    Gets the motivator's weight
    void
    SetDecayFactor(float newAffiliationDecayFactor)
     
    void
    SetIntensity(float intensity)
    Set the motivator's intensity
    void
    SetWeight(float weight)
     
    Converts the Motivator to XMl
    float
    UpdateIntensity(float effect)
    Update the motivator's intensity

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • MotivatorDecayFactor

      public static final float MotivatorDecayFactor
      Constant value that defines how fast should a drive decay over time.
      See Also:
  • Constructor Details

    • Motivator

      public Motivator(short type, float decayFactor, float weight, float intensity)
      Creates a new Motivator
      Parameters:
      type - - the type of built-in motivator // * @param threshold - the min value for the motivator that the character wants to maintain
      decayFactor - - the decay factor for the intensity of the motivator over time
      weight - - the weight of the motivator
      intensity - - intensity of the built-in motivator, the higher the intensity the lower the need due to a smaller deviation from the threshold, this value will be pre-defined based on scenario
    • Motivator

      public Motivator(Motivator mot)
      Creates a new Motivator that consists in a copy of a given motivator
      Parameters:
      mot - - the motivator that will be copied into the new motivator
  • Method Details

    • GetType

      public short GetType()
      Gets the motivator's type
      Returns:
      a short representing the motivator type (enumerable)
      See Also:
    • GetWeight

      public float GetWeight()
      Gets the motivator's weight
      Returns:
      a float value corresponding to the motivator's weight
    • SetWeight

      public void SetWeight(float weight)
    • GetIntensity

      public float GetIntensity()
      Gets the motivator's intensity
      Returns:
      a float value corresponding to the motivator's intensity
    • GetNeed

      public float GetNeed()
      Deprecated.
      use GetNeedUrgency() instead.
      Gets the motivator's need
      Returns:
      a float value corresponding to the motivator's intensity
    • GetNeedUrgency

      public float GetNeedUrgency()
      Gets the motivator's urgency discretizing the need intensity into diffent categories (very urgent, urgent, not urgent, satisfied)
      Returns:
      a multiplier corresponding to the motivator's urgency
    • UpdateIntensity

      public float UpdateIntensity(float effect)
      Update the motivator's intensity
      Returns:
      a float value corresponding to the difference between the current and the old value
    • SetIntensity

      public void SetIntensity(float intensity)
      Set the motivator's intensity
    • DecayMotivator

      public void DecayMotivator()
      Decays the motivator intensity according to the system's timer
    • toXml

      public String toXml()
      Converts the Motivator to XMl
      Returns:
      a XML String that contains all information about the Motivator
    • GetDecayFactor

      public float GetDecayFactor()
    • SetDecayFactor

      public void SetDecayFactor(float newAffiliationDecayFactor)