Class PredicateCondition

java.lang.Object
FAtiMA.Core.conditions.Condition
FAtiMA.Core.conditions.PredicateCondition
All Implemented Interfaces:
IGroundable, Serializable, Cloneable
Direct Known Subclasses:
EmotionCondition, PastEventCondition

public class PredicateCondition extends Condition
Represents a test to a predicate. Used to represent preconditions, success conditions, etc
Author:
Joao Dias
See Also:
  • Constructor Details

    • PredicateCondition

      public PredicateCondition()
    • PredicateCondition

      public PredicateCondition(boolean positive, Name name, Symbol ToM)
      Creates a new Test to a Predicate
      Parameters:
      positive - - Indicates if the Predicate is positive or negative
      name - - the predicate's name
    • PredicateCondition

      protected PredicateCondition(PredicateCondition pC)
  • Method Details

    • getPositive

      protected boolean getPositive()
    • setPositive

      protected void setPositive(boolean positive)
    • clone

      public Object clone()
      Clones this Predicate, returning an equal copy. If this clone is changed afterwards, the original object remains the same.
      Specified by:
      clone in class Condition
      Returns:
      The Predicates's copy.
    • ParsePredicate

      public static PredicateCondition ParsePredicate(Attributes attributes)
      Parses a Predicate given a XML attribute list
      Parameters:
      attributes - - A list of XMl attributes
      Returns:
      - the Predicate Parsed
    • CheckCondition

      public boolean CheckCondition(AgentModel am)
      Checks if the Predicate is verified in the agent's KnowledgeBase
      Specified by:
      CheckCondition in class Condition
      Returns:
      true if the Predicate is verified, false otherwise
      See Also:
    • GetValue

      public Name GetValue()
      Gets the predicates's value - the object compared against the condition's name
      Specified by:
      GetValue in class Condition
      Returns:
      the predicates's value
    • isPositive

      public boolean isPositive()
      Indicates if the Predicate is positive or negative. A negative predicate corresponds to the negation of the original predicate
      Returns:
      True if the Predicate is positive, false otherwise.
    • toString

      public String toString()
      Converts the Predicate to a String
      Overrides:
      toString in class Object
      Returns:
      the converted String
    • GetValueBindings

      protected ArrayList<Substitution> GetValueBindings(AgentModel am)
      Find a set of Substitutions for the second part of the Predicate, which will make it become true. With this method it is possible to test conditions that have unbound variables in the second part such as: "Owner(Ball) = [x]" this condition will be true if there is anyone in the world that owns a Ball. If John owns the ball, the method returns [x]/John
      Specified by:
      GetValueBindings in class Condition
      Returns:
      returns all set of Substitutions that make the condition valid.