Class InterestGoal

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

    public class InterestGoal
    extends Goal
    Implements OCC's Interest goals
    Author:
    Joao Dias
    See Also:
    Serialized Form
    • Constructor Detail

      • InterestGoal

        public InterestGoal​(Name description)
        Creates a new InterestGoal
        Parameters:
        description - - the InterestGoal's name or description
    • Method Detail

      • AddCondition

        public void AddCondition​(java.lang.String conditionType,
                                 Condition cond)
        Adds a condition to the goal's protected conditions
        Specified by:
        AddCondition in class Goal
        Parameters:
        conditionType - - in this method the conditionType is irrelevant because an InterestGoal only has protection conditions
        cond - - the condition to add
      • CheckIntegrity

        public void CheckIntegrity​(IntegrityValidator val)
                            throws UnreachableGoalException
        Checks the integrity of the goal. For instance it checks if the goal's success conditions are reachable by at leas one action in the domain operators. If not it means that the goal will never be achieve and probably is a typo in the goal's definition (or in the actions file)
        Specified by:
        CheckIntegrity in class Goal
        Parameters:
        val - - the validator used to check the goal
        Throws:
        UnreachableGoalException - - thrown if a goal's success conditions can never be achieved because there is no operator with such effects
      • getProtectionConstraints

        public java.util.ArrayList<Condition> getProtectionConstraints()
        Gets the InterestGoal's protected conditions
        Returns:
        an ArrayList with the conditions that the goal wants to protect
      • 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
        Specified by:
        ReplaceUnboundVariables in class Goal
        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
        Specified by:
        MakeGround in class Goal
        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
        Specified by:
        MakeGround in class Goal
        Parameters:
        subst - - a substitution of the type "[Variable]/value"
        See Also:
        Substitution
      • clone

        public java.lang.Object clone()
        Clones this InterestGoal, 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 Goal's copy.
      • toString

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