Class PropertyCondition

java.lang.Object
FAtiMA.Core.conditions.Condition
FAtiMA.Core.conditions.PropertyCondition
All Implemented Interfaces:
IGroundable, Serializable, Cloneable
Direct Known Subclasses:
PropertyEqual, PropertyGreater, PropertyGreaterEqual, PropertyLesser, PropertyLesserEqual, PropertyNotEqual

public class PropertyCondition extends Condition
Represents a test to a property. Used in preconditions, success conditions, etc.. This property test is composed by the property name, and a second name that specifies a comparison value. A PropertyTest can be one of: PropertyEqual, PropertyNotEqual, PropertyLesser, PropertyGreater.
Author:
Joao Dias
See Also:
  • Constructor Details

    • PropertyCondition

      public PropertyCondition(Name name, Name value, Symbol ToM)
      Creates a new Property
      Parameters:
      name - - the property's name
      value - - the property's value
    • PropertyCondition

      protected PropertyCondition(PropertyCondition pC)
  • Method Details

    • clone

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

      public static PropertyCondition ParseProperty(Attributes attributes)
      Parses a PropertyTest given a XML attribute list
      Parameters:
      attributes - - A list of XMl attributes
      Returns:
      - the PropertyTest Parsed
    • CheckCondition

      public boolean CheckCondition(AgentModel am)
      Checks if the Property Condition is verified in the agent's memory (KB + AM)
      Specified by:
      CheckCondition in class Condition
      Returns:
      true if the condition is verified, false otherwise
      See Also:
    • GetValue

      public Name GetValue()
      Gets the Property's test value
      Specified by:
      GetValue in class Condition
      Returns:
      the test value of the property
    • 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
      Overrides:
      ReplaceUnboundVariables in class Condition
      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
      Overrides:
      MakeGround in class Condition
      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
      Overrides:
      MakeGround in class Condition
      Parameters:
      subst - - a substitution of the type "[Variable]/value"
      See Also:
    • isGrounded

      public boolean isGrounded()
      Indicates if the condition 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
      Overrides:
      isGrounded in class Condition
      Returns:
      true if the condition is grounded, false otherwise
    • Print

      public void Print()
      Prints the PropertyTest to the Standard Output
    • GetBindings

      protected ArrayList<Substitution> GetBindings(AgentModel am, Name groundValue, Name value)
    • GetValueBindings

      protected 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
      Specified by:
      GetValueBindings in class Condition
      Returns:
      returns all set of Substitutions that make the condition valid.