Class PropertyCondition

    • Constructor Detail

      • PropertyCondition

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

      • clone

        public java.lang.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​(org.xml.sax.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:
        KnowledgeBase
      • 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​(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
        Overrides:
        MakeGround in class Condition
        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
        Overrides:
        MakeGround in class Condition
        Parameters:
        subst - - a substitution of the type "[Variable]/value"
        See Also:
        Substitution
      • 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
      • GetValueBindings

        protected java.util.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.