Package edu.tufts.hrilab.action.db
Class ActionDatabase
java.lang.Object
edu.tufts.hrilab.action.db.ActionDatabase
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Protected so that only the Database can instantiate. -
Method Summary
Modifier and TypeMethodDescriptionactionExists
(Predicate goal) Check if a certain action is available in this goal manager for a particular actorfinal boolean
actionExists
(String type) Lookup action by type.final void
disableAction
(ActionDBEntry entry) Move an action into a disabledActions list so it isn't used during goal execution.final ActionDBEntry
Lookup action by type.final ActionDBEntry
Lookup action by type, roles and agent namefinal ActionDBEntry
Lookup action by type and roles.getActionsByEffect
(Symbol actor, Predicate effect) Lookup by postcondition.getActionsBySignature
(Predicate actionSignature) Look up action(s) by signature.getActionSignaturesForName
(Symbol actionName) final Set<ActionDBEntry>
Return all actions (primitives and scripts) in the database.final ActionDBEntry
getDisabledAction
(String type) Lookup disabled action by type.final Set<ActionDBEntry>
Get primitive set of ActionDBEntries.final Set<ActionDBEntry>
Get primitive set of ActionDBEntries.protected final void
putAction
(ActionDBEntry entry) Insert the action into the database.final void
removeAction
(ActionDBEntry entry) Remove an action from the databaseprotected final void
removeActionsWithSignature
(Predicate actionSignature) Remove all actions with a certain action signature.protected void
Remove all script actions from DB, used to destroy/restart database/gm.
-
Constructor Details
-
ActionDatabase
protected ActionDatabase()Protected so that only the Database can instantiate.
-
-
Method Details
-
putAction
Insert the action into the database. The action is keyed by its type. This function is internally synchronized on the singleton.- Parameters:
entry
- the database entry defining this action
-
actionExists
Lookup action by type. Returns if a matching action exists.- Parameters:
type
- the type of the action to look up- Returns:
- if a matching action exists
-
getAction
Lookup action by type. Returns last added entry if more than one action with type.- Parameters:
type
- the type of the action to look up- Returns:
- the requested action (last added), if found, null otherwise
-
getAction
Lookup action by type and roles.- Parameters:
type
- the type of the action to look uproles
- the roles of the action to look up- Returns:
- the requested action, if found, null otherwise
-
getAction
Lookup action by type, roles and agent name- Parameters:
type
- the type of the action to look upactor
- the actor affected by the action to look upinputRoleTypes
- the java types of the input roles of the action to look up- Returns:
- the requested action, if found, null otherwise
-
removeAction
Remove an action from the database- Parameters:
entry
- to remove
-
disableAction
Move an action into a disabledActions list so it isn't used during goal execution.- Parameters:
entry
- to disable
-
getDisabledAction
Lookup disabled action by type. Returns last added entry if more than one action exists. Returns null if no matching action exists.- Parameters:
type
- the type of the action to look up- Returns:
- the requested action (last added), if found, null otherwise
-
actionExists
Check if a certain action is available in this goal manager for a particular actor- Parameters:
goal
- goal(actor,state) or action(actor,args)- Returns:
- true if action is in database
-
getActionsByEffect
Lookup by postcondition.- Parameters:
actor
- to specify the actor that must be able to execute the action(s). Can be null.effect
- the postcondition of the entity to look up- Returns:
- the requested entry, if found, null otherwise
-
getActionsBySignature
Look up action(s) by signature.- Parameters:
actionSignature
-- Returns:
-
getAllActions
Return all actions (primitives and scripts) in the database.- Returns:
-
getPrimitives
Get primitive set of ActionDBEntries.- Returns:
-
getScripts
Get primitive set of ActionDBEntries.- Returns:
-
removeActionsWithSignature
Remove all actions with a certain action signature.- Parameters:
actionSignature
- action signature to remove.
-
removeScripts
protected void removeScripts()Remove all script actions from DB, used to destroy/restart database/gm. -
getActionSignaturesForName
-