Package FAtiMA.Core.conditions
Class Condition
java.lang.Object
FAtiMA.Core.conditions.Condition
- All Implemented Interfaces:
IGroundable,Serializable,Cloneable
- Direct Known Subclasses:
MoodCondition,PredicateCondition,PropertyCondition
Abstract condition test, used to represent preconditions, success conditions,
etc. Conditions can be either Predicate conditions or Property conditions.
Provides methods to search the value of such conditions in the KnowledgeBase.
- Author:
- Joao Dias
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ArrayList<SubstitutionSet>CheckActivation(AgentModel am, ArrayList<Condition> preconditions) Checks if a list of conditions (usually preconditions) to see if all of them are verified.abstract booleanChecks if the condition is verified in the agent's memory (KB + AM)abstract Objectclone()Clones this Condition, returning an equal copy.getName()getToM()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)abstract NameGetValue()Gets the condition's value - the object compared against the condition's nameprotected abstract ArrayList<Substitution>Find a set of Substitutions for the second part of the condition, which will make it become true.booleanbooleanIndicates if the Predicate is grounded (no unbound variables in it's WFN) Example: Stronger(Luke,John) is grounded while Stronger(John,[X]) is not.booleanvoidMakeGround(Substitution subst) Applies a set of substitutions to the object, grounding it.voidMakeGround(ArrayList<Substitution> bindings) Applies a set of substitutions to the object, grounding it.voidReplaceUnboundVariables(int variableID) Replaces all unbound variables in the object by applying a numeric identifier to each one.protected voidprotected voidvoidsetVerifiable(boolean verifiableStatus)
-
Constructor Details
-
Condition
Creates a new Condition - not used directly because its an abstract class -
Condition
protected Condition() -
Condition
Creates a new Condition - not used directly because its an abstract class- Parameters:
name- - the condition's name
-
Condition
-
-
Method Details
-
getName
-
getToM
-
isVerifiable
public boolean isVerifiable() -
setName
-
setToM
-
CheckActivation
public static ArrayList<SubstitutionSet> CheckActivation(AgentModel am, 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:
-
setVerifiable
public void setVerifiable(boolean verifiableStatus) -
hasChangedVerifiability
public boolean hasChangedVerifiability() -
clone
Clones this Condition, returning an equal copy. If this clone is changed afterwards, the original object remains the same. -
CheckCondition
Checks if the condition is verified in the agent's memory (KB + AM)- Returns:
- true if the condition is verified, false otherwise
- See Also:
-
GetValidBindings
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:
-
GetValue
Gets the condition's value - the object compared against the condition's name- Returns:
- the condition's value
-
GetValueBindings
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:
ReplaceUnboundVariablesin interfaceIGroundable- Parameters:
variableID- - the identifier to be applied
-
MakeGround
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- Parameters:
bindings- - A list of substitutions of the type "[Variable]/value"- See Also:
-
MakeGround
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- Parameters:
subst- - a substitution of the type "[Variable]/value"- See Also:
-
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:
isGroundedin interfaceIGroundable- Returns:
- true if the Predicate is grounded, false otherwise
-