Class Condition

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected Condition()  
      protected Condition​(Condition c)
      Creates a new Condition - not used directly because its an abstract class
        Condition​(Name name)
      Creates a new Condition - not used directly because its an abstract class
        Condition​(Name name, Symbol ToM)  
    • Constructor Detail

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

      • 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 java.util.ArrayList<SubstitutionSet> CheckActivation​(AgentModel am,
                                                                           java.util.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:
        SubstitutionSet
      • setVerifiable

        public void setVerifiable​(boolean verifiableStatus)
      • hasChangedVerifiability

        public boolean hasChangedVerifiability()
      • clone

        public abstract java.lang.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 java.lang.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:
        KnowledgeBase
      • GetValidBindings

        public java.util.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:
        KnowledgeBase
      • 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 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
        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​(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
        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
        Parameters:
        subst - - a substitution of the type "[Variable]/value"
        See Also:
        Substitution
      • 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