Package edu.tufts.hrilab.action.db
Class ActionDBEntry.Builder
java.lang.Object
edu.tufts.hrilab.action.db.ActionDBEntry.Builder
- Enclosing class:
- ActionDBEntry
-
Constructor Summary
ConstructorsConstructorDescriptionBuilder
(ActionDBEntry entryToCopy) Seed the Builder with an existing ActionDBEntry. -
Method Summary
Modifier and TypeMethodDescriptionAdds an agent on which this action will have an effect.Add a condition that must hold for this action to be possible.addConditions
(Collection<Condition> conditionCollection) Add collection of conditions that must hold for this action to be possibleAdd an effect to be sent as a planner update whenever the action is executed.addEffects
(Collection<Effect> effectCollection) Add a collection of effects to be sent as a planner update whenever the action is executed.addEventSpec
(EventSpec val) Add a new script event specification to a scriptaddObservation
(Predicate obs) Adds a state that this action can observe.addOnCancelEvent
(EventSpec onCancelEvent) Add EventSpec specifying what to do when this action is cancelled.addOnResumeEvent
(EventSpec onResumeEvent) Add EventSpec specifying what to do when this action is resumed (after being suspended).addOnSuspendEvent
(EventSpec onSuspendEvent) Add EventSpec specifying what to do when this action is suspended.addRecoveryPolicyConstraint
(PolicyConstraints constraint) Adds a recovery policy constraint.addResourceLock
(String name) addRole
(ActionBinding newRole) Add new role.addRoles
(List<ActionBinding> newRoles) Convenience method for adding set of new roles.Adds info to translate a context of this dbEntry into another representationappendEventSpecs
(List<EventSpec> eventSpecs) Append a sequence of actions to the event specs.build
(boolean addToDatabase) Getter for default semantic type for ?actor role.getRoles()
Shallow copy of roles.boolean
Contains an effect.boolean
Checks if OnCancel Event has been added to the Builder.boolean
Checks if OnResume Event has been added to the Builder.boolean
Checks if OnSuspend Event has been added to the Builder.prependEffect
(Effect effect) Add an effect to the beginning of the Effect list to be sent as a planner update whenever the action is executed.prependEventSpecs
(List<EventSpec> eventSpecs) Prepend a sequence of actions to the event specs.Remove a condition.removeEffect
(Effect effect) Remove an effect.replaceEffect
(Effect toRemove, Effect toAdd) Replace an effect at the same location in the effects list.setActionImplementer
(ai.thinkingrobots.trade.TRADEServiceInfo tsi) setBenefit
(String val) setDescription
(String val) setIsVarArgs
(boolean val) setNegAffect
(String val) setPosAffect
(String val) setRoles
(List<ActionBinding> roles) Replace all existing roles with the passed in roles.setTimeout
(Long val) setTimeout
(String val) Set the action type (i.e., action method name).
-
Constructor Details
-
Builder
Seed the Builder with an existing ActionDBEntry. This will copy all the existing action's fields into the Builder's fields. This is useful if you want to modify an existing action.- Parameters:
entryToCopy
-
-
Builder
-
-
Method Details
-
getDefaultActorType
Getter for default semantic type for ?actor role.- Returns:
-
setType
Set the action type (i.e., action method name).- Parameters:
type
-- Returns:
-
setDescription
-
popEventSpec
-
addEventSpec
Add a new script event specification to a script- Parameters:
val
- the event to be added to the (ordered) eventSpecs list (an event specification includes the name of the action to be executed and its parameters)- Returns:
- this Builder instance
-
prependEventSpecs
Prepend a sequence of actions to the event specs.- Parameters:
eventSpecs
-- Returns:
-
appendEventSpecs
Append a sequence of actions to the event specs.- Parameters:
eventSpecs
-- Returns:
-
clearEventSpecList
-
addCondition
Add a condition that must hold for this action to be possible.- Parameters:
c
- the condition to be added- Returns:
- this Builder instance
-
removeCondition
Remove a condition.- Parameters:
c
- condition to be removed- Returns:
-
addConditions
Add collection of conditions that must hold for this action to be possible- Parameters:
conditionCollection
- collection of conditions to be added- Returns:
- this Builder instance
-
addEffect
Add an effect to be sent as a planner update whenever the action is executed.- Parameters:
effect
- the effect to be added- Returns:
- this Builder instance
-
addEffects
Add a collection of effects to be sent as a planner update whenever the action is executed.- Parameters:
effectCollection
- collection of effects to be added- Returns:
- this Builder instance
-
prependEffect
Add an effect to the beginning of the Effect list to be sent as a planner update whenever the action is executed.- Parameters:
effect
- the effect to be added- Returns:
- this Builder instance
-
replaceEffect
Replace an effect at the same location in the effects list.- Parameters:
toRemove
- the effect to be removedtoAdd
- the effect to be added- Returns:
- this Builder instance
-
removeEffect
Remove an effect.- Parameters:
effect
- the effect to be removed- Returns:
- this Builder instance
-
hasEffect
Contains an effect.- Parameters:
effect
- the effect- Returns:
- this Builder instance
-
addObservation
Adds a state that this action can observe.- Parameters:
obs
- observable fact- Returns:
- this Builder instance
-
addRecoveryPolicyConstraint
Adds a recovery policy constraint.- Parameters:
constraint
- policy constraint- Returns:
- this Builder instance
-
addOnCancelEvent
Add EventSpec specifying what to do when this action is cancelled.- Parameters:
onCancelEvent
-- Returns:
-
addOnSuspendEvent
Add EventSpec specifying what to do when this action is suspended.- Parameters:
onSuspendEvent
-- Returns:
-
addOnResumeEvent
Add EventSpec specifying what to do when this action is resumed (after being suspended).- Parameters:
onResumeEvent
-- Returns:
-
hasOnCancelEvent
public boolean hasOnCancelEvent()Checks if OnCancel Event has been added to the Builder.- Returns:
-
hasOnSuspendEvent
public boolean hasOnSuspendEvent()Checks if OnSuspend Event has been added to the Builder.- Returns:
-
hasOnResumeEvent
public boolean hasOnResumeEvent()Checks if OnResume Event has been added to the Builder.- Returns:
-
addTranslationInfo
Adds info to translate a context of this dbEntry into another representation- Parameters:
t
- the TranslationInfo for the action being built- Returns:
- this Builder instance
-
addAgent
Adds an agent on which this action will have an effect.- Parameters:
agentName
- agent name- Returns:
- this Builder instance
-
setRoles
Replace all existing roles with the passed in roles.- Parameters:
roles
-- Returns:
-
addRole
Add new role.- Parameters:
newRole
-- Returns:
-
addRoles
Convenience method for adding set of new roles. Internally calls the single addRole method to do any necessary checks before appending to roles list.- Parameters:
newRoles
-- Returns:
-
getRoles
Shallow copy of roles.- Returns:
-
addResourceLock
-
setPosAffect
-
setNegAffect
-
setCost
-
setBenefit
-
setTimeout
-
setTimeout
-
setMinUrg
-
setMaxUrg
-
setIsVarArgs
-
setActionImplementer
-
setDBFile
-
build
-