Package edu.tufts.hrilab.action
Class Condition
java.lang.Object
edu.tufts.hrilab.action.Condition
- All Implemented Interfaces:
Serializable
A Condition is a (set of) predicate(s) that has(ve) to hold before or during the execution of an action.
It consists of one or more predicates (description of the condition) and a type (pre-condition, overall-condition).
Uses LinkedHashMap to keep key insertion order, important when you have disjunctions to keep ordering and evaluation consistent (stop evaluating once the first condition holds).
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionCondition
(Predicate p, ConditionType t) Condition
(Predicate p, ConditionType t, Observable o) -
Method Summary
Modifier and TypeMethodDescriptionvoid
applySemanticTypes
(ActionDBEntry actionDBEntry) Using the roles from the ActionDBEntry, attempt to extract semantic type information from the roles and apply them to the predicate(s) in this Condition.bindToContext
(ArgumentBasedContext context) Bind each predicate in condition to a context.boolean
getType()
int
hashCode()
holds
(ActionContext context, StateMachine sm) Verify if condition holds.boolean
toString()
-
Constructor Details
-
Condition
-
Condition
-
Condition
-
Condition
-
-
Method Details
-
applySemanticTypes
Using the roles from the ActionDBEntry, attempt to extract semantic type information from the roles and apply them to the predicate(s) in this Condition.- Parameters:
actionDBEntry
-
-
getType
-
isDisjunction
public boolean isDisjunction() -
getPredicates
-
bindToContext
Bind each predicate in condition to a context.- Parameters:
context
- Context in which to look up variable bindings- Returns:
- New Condition with unbound arguments bound, if possible.
-
holds
Verify if condition holds.- Parameters:
context
- context providing variable bindingssm
- state machine in which condition is checked- Returns:
- justification with bindings. true if condition holds.
-
toString
-
equals
-
hashCode
public int hashCode()
-