Class Effect

  • All Implemented Interfaces:
    IGroundable, java.io.Serializable, java.lang.Cloneable

    public class Effect
    extends java.lang.Object
    implements IGroundable, java.lang.Cloneable, java.io.Serializable
    Represents a step's effect. Includes information about the probability of the effect to succeed in the world.
    Author:
    Joao Dias
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      Effect​(AgentModel am, java.lang.String stepName, float prob, Condition effect)
      Creates a new Effect
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object clone()
      Clones this effect, returning an equal copy.
      void DecreaseProbability​(AgentModel am)
      Decreases an effect's probability by a fixed ammount.
      Condition GetEffect()
      Gets the condition that represents the Effect
      float GetProbability​(AgentModel am)
      Gets the effect's probability
      void IncreaseProbability​(AgentModel am)
      Increases an effect's probability by a fixed ammount.
      boolean isGrounded()
      Indicates if the name is grounded (no unbound variables in it's WFN) Example: Stronger(Luke,John) is grounded while Stronger(John,[X]) is not.
      void MakeGround​(Substitution subst)
      Applies a set of substitutions to the object, grounding it.
      void MakeGround​(java.util.ArrayList<Substitution> bindings)
      Applies a set of substitutions to the object, grounding it.
      void ReplaceUnboundVariables​(int variableID)
      Replaces all unbound variables in the object by applying a numeric identifier to each one.
      java.lang.String toString()
      Converts the Effect to a String
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Effect

        public Effect​(AgentModel am,
                      java.lang.String stepName,
                      float prob,
                      Condition effect)
        Creates a new Effect
        Parameters:
        stepName - - the name of the step that this effect bellongs to
        prob - - the effect's probability
        effect - - the condition that represents the effect
    • Method Detail

      • DecreaseProbability

        public void DecreaseProbability​(AgentModel am)
        Decreases an effect's probability by a fixed ammount. Used to perform wishfull thinking or denial withing emotion-focused coping strategies
      • GetEffect

        public Condition GetEffect()
        Gets the condition that represents the Effect
        Returns:
        the effect (represented as a condition)
      • GetProbability

        public float GetProbability​(AgentModel am)
        Gets the effect's probability
        Returns:
        the effect's probability
      • ReplaceUnboundVariables

        public void ReplaceUnboundVariables​(int variableID)
        Replaces all unbound variables in the object by applying a numeric identifier to each one. For example, the variable [x] becomes [x4] if the received ID is 4. Attention, this method modifies the original object.
        Specified by:
        ReplaceUnboundVariables in interface IGroundable
        Parameters:
        variableID - - the identifier to be applied
      • MakeGround

        public void MakeGround​(java.util.ArrayList<Substitution> bindings)
        Applies a set of substitutions to the object, grounding it. Example: Applying the substitution "[X]/John" in the name "Weak([X])" returns "Weak(John)". Attention, this method modifies the original object.
        Specified by:
        MakeGround in interface IGroundable
        Parameters:
        bindings - - A list of substitutions of the type "[Variable]/value"
        See Also:
        Substitution
      • MakeGround

        public void MakeGround​(Substitution subst)
        Applies a set of substitutions to the object, grounding it. Example: Applying the substitution "[X]/John" in the name "Weak([X])" returns "Weak(John)". Attention, this method modifies the original object.
        Specified by:
        MakeGround in interface IGroundable
        Parameters:
        subst - - a substitution of the type "[Variable]/value"
        See Also:
        Substitution
      • isGrounded

        public boolean isGrounded()
        Indicates if the name is grounded (no unbound variables in it's WFN) Example: Stronger(Luke,John) is grounded while Stronger(John,[X]) is not.
        Specified by:
        isGrounded in interface IGroundable
        Returns:
        true if the name is grounded, false otherwise
      • IncreaseProbability

        public void IncreaseProbability​(AgentModel am)
        Increases an effect's probability by a fixed ammount. Used to perform wishfull thinking or denial withing emotion-focused coping strategies
      • clone

        public java.lang.Object clone()
        Clones this effect, returning an equal copy. If this clone is changed afterwards, the original object remains the same.
        Overrides:
        clone in class java.lang.Object
        Returns:
        The effects's copy.
      • toString

        public java.lang.String toString()
        Converts the Effect to a String
        Overrides:
        toString in class java.lang.Object
        Returns:
        the converted String