Class Condition

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

public abstract class Condition extends Object implements IGroundable, Cloneable, Serializable
Abstract condition test, used to represent preconditions, success conditions, etc. Conditions can be either Predicate conditions or Property conditions. Provides methods to search the value of such conditions in the KnowledgeBase.
Author:
Joao Dias
See Also:
  • Constructor Details

    • Condition

      protected Condition(Condition c)
      Creates a new Condition - not used directly because its an abstract class
    • Condition

      protected Condition()
    • Condition

      public Condition(Name name)
      Creates a new Condition - not used directly because its an abstract class
      Parameters:
      name - - the condition's name
    • Condition

      public Condition(Name name, Symbol ToM)
  • Method Details

    • getName

      public Name getName()
    • getToM

      public Symbol getToM()
    • isVerifiable

      public boolean isVerifiable()
    • setName

      protected void setName(Name name)
    • setToM

      protected void setToM(Symbol ToM)
    • CheckActivation

      public static ArrayList<SubstitutionSet> CheckActivation(AgentModel am, ArrayList<Condition> preconditions)
      Checks if a list of conditions (usually preconditions) to see if all of them are verified. The method returns a list of possible SubstitutionSets. Each of the returned SustitutionSet applied to the entire set of conditions will make them all true. As example, if we have the generic goal of bullying someone Bully([Victim]), and we have a precondition list consisting of seing someone weaker than us, So if we see John (a weak victim) and Frances (another weak victim) we can activate the preconditions and subsequently the specific goal Bully(John) and Bully(Frances), by applying the substitutionset {[Victim]/John} and the substitutionset {[Victim]/Frances}
      Parameters:
      preconditions - - the list of preconditions that we want to test for activation
      Returns:
      a list of SubstitutionSets that if applied to all the preconditions will make them true, returns null if no such SubstitutionSet exists
      See Also:
    • setVerifiable

      public void setVerifiable(boolean verifiableStatus)
    • hasChangedVerifiability

      public boolean hasChangedVerifiability()
    • clone

      public abstract Object clone()
      Clones this Condition, returning an equal copy. If this clone is changed afterwards, the original object remains the same.
      Overrides:
      clone in class Object
      Returns:
      The Conditions's copy.
    • CheckCondition

      public abstract boolean CheckCondition(AgentModel am)
      Checks if the condition is verified in the agent's memory (KB + AM)
      Returns:
      true if the condition is verified, false otherwise
      See Also:
    • GetValidBindings

      public ArrayList<SubstitutionSet> GetValidBindings(AgentModel am)
      This method finds all the possible sets of Substitutions that applied to the condition will make it valid (true) according to the agent's memory (KB + AM)
      Returns:
      A list with all SubstitutionsSets that make the condition valid, if there are no such substitutions, the method returns null
      See Also:
    • GetValue

      public abstract Name GetValue()
      Gets the condition's value - the object compared against the condition's name
      Returns:
      the condition's value
    • GetValueBindings

      protected abstract ArrayList<Substitution> GetValueBindings(AgentModel am)
      Find a set of Substitutions for the second part of the condition, 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
      Returns:
      returns all set of Substitutions that make the condition valid.
    • 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(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:
    • 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:
    • isGrounded

      public boolean isGrounded()
      Indicates if the Predicate 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 Predicate is grounded, false otherwise