Class PredicateCondition

    • Constructor Detail

      • 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
    • Method Detail

      • getPositive

        protected boolean getPositive()
      • setPositive

        protected void setPositive​(boolean positive)
      • clone

        public java.lang.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​(org.xml.sax.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:
        KnowledgeBase
      • 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 java.lang.String toString()
        Converts the Predicate to a String
        Overrides:
        toString in class java.lang.Object
        Returns:
        the converted String
      • GetValueBindings

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