Package FAtiMA.Core.conditions
Class PredicateCondition
- java.lang.Object
-
- FAtiMA.Core.conditions.Condition
-
- FAtiMA.Core.conditions.PredicateCondition
-
- All Implemented Interfaces:
IGroundable,java.io.Serializable,java.lang.Cloneable
- Direct Known Subclasses:
EmotionCondition,PastEventCondition
public class PredicateCondition extends Condition
Represents a test to a predicate. Used to represent preconditions, success conditions, etc- Author:
- Joao Dias
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description PredicateCondition()PredicateCondition(boolean positive, Name name, Symbol ToM)Creates a new Test to a PredicateprotectedPredicateCondition(PredicateCondition pC)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanCheckCondition(AgentModel am)Checks if the Predicate is verified in the agent's KnowledgeBasejava.lang.Objectclone()Clones this Predicate, returning an equal copy.protected booleangetPositive()NameGetValue()Gets the predicates's value - the object compared against the condition's nameprotected 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.booleanisPositive()Indicates if the Predicate is positive or negative.static PredicateConditionParsePredicate(org.xml.sax.Attributes attributes)Parses a Predicate given a XML attribute listprotected voidsetPositive(boolean positive)java.lang.StringtoString()Converts the Predicate to a String-
Methods inherited from class FAtiMA.Core.conditions.Condition
CheckActivation, getName, getToM, GetValidBindings, hasChangedVerifiability, isGrounded, isVerifiable, MakeGround, MakeGround, ReplaceUnboundVariables, setName, setToM, setVerifiable
-
-
-
-
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 negativename- - the predicate's name
-
PredicateCondition
protected PredicateCondition(PredicateCondition pC)
-
-
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.
-
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:
CheckConditionin classCondition- 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
-
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:
toStringin classjava.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:
GetValueBindingsin classCondition- Returns:
- returns all set of Substitutions that make the condition valid.
-
-