Package FAtiMA.Core.conditions
Class PropertyCondition
- java.lang.Object
-
- FAtiMA.Core.conditions.Condition
-
- FAtiMA.Core.conditions.PropertyCondition
-
- All Implemented Interfaces:
IGroundable,java.io.Serializable,java.lang.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:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedPropertyCondition(PropertyCondition pC)PropertyCondition(Name name, Name value, Symbol ToM)Creates a new Property
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanCheckCondition(AgentModel am)Checks if the Property Condition is verified in the agent's memory (KB + AM)java.lang.Objectclone()Clones this Condition, returning an equal copy.protected java.util.ArrayList<Substitution>GetBindings(AgentModel am, Name groundValue, Name value)NameGetValue()Gets the Property's test valueprotected 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.booleanisGrounded()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.voidMakeGround(Substitution subst)Applies a set of substitutions to the object, grounding it.voidMakeGround(java.util.ArrayList<Substitution> bindings)Applies a set of substitutions to the object, grounding it.static PropertyConditionParseProperty(org.xml.sax.Attributes attributes)Parses a PropertyTest given a XML attribute listvoidPrint()Prints the PropertyTest to the Standard OutputvoidReplaceUnboundVariables(int variableID)Replaces all unbound variables in the object by applying a numeric identifier to each one.-
Methods inherited from class FAtiMA.Core.conditions.Condition
CheckActivation, getName, getToM, GetValidBindings, hasChangedVerifiability, isVerifiable, setName, setToM, setVerifiable
-
-
-
-
Constructor Detail
-
PropertyCondition
public PropertyCondition(Name name, Name value, Symbol ToM)
Creates a new Property- Parameters:
name- - the property's namevalue- - the property's value
-
PropertyCondition
protected PropertyCondition(PropertyCondition pC)
-
-
Method Detail
-
clone
public java.lang.Object clone()
Description copied from class:ConditionClones this Condition, returning an equal copy. If this clone is changed afterwards, the original object remains the same.
-
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:
CheckConditionin classCondition- Returns:
- true if the condition is verified, false otherwise
- See Also:
KnowledgeBase
-
GetValue
public Name GetValue()
Gets the Property's test value
-
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:
ReplaceUnboundVariablesin interfaceIGroundable- Overrides:
ReplaceUnboundVariablesin classCondition- 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:
MakeGroundin interfaceIGroundable- Overrides:
MakeGroundin classCondition- 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:
MakeGroundin interfaceIGroundable- Overrides:
MakeGroundin classCondition- 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:
isGroundedin interfaceIGroundable- Overrides:
isGroundedin classCondition- Returns:
- true if the condition is grounded, false otherwise
-
Print
public void Print()
Prints the PropertyTest to the Standard Output
-
GetBindings
protected java.util.ArrayList<Substitution> GetBindings(AgentModel am, Name groundValue, Name value)
-
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:
GetValueBindingsin classCondition- Returns:
- returns all set of Substitutions that make the condition valid.
-
-