Class ObservationContext
java.lang.Object
edu.tufts.hrilab.action.execution.Context
edu.tufts.hrilab.action.execution.ArgumentBasedContext
edu.tufts.hrilab.action.execution.ObservationContext
-
Field Summary
Fields inherited from class edu.tufts.hrilab.action.execution.ArgumentBasedContext
arguments, variable
Fields inherited from class edu.tufts.hrilab.action.execution.Context
caller, childContexts, cmd, constraints, endTime, maxTime, startTime, stateMachine
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ObservationContext
(Context caller, StateMachine sm, Predicate stateToObserve, Symbol actor, Observable observable) protected
ObservationContext
(Context caller, StateMachine sm, String cmd, List<String> arguments, Symbol actor, Observable observable) -
Method Summary
Modifier and TypeMethodDescriptiondeep copy of the context, its status, and its childrenvoid
doStep()
If Context has a concrete execution step to perform, it should happen in this method.Attempt to retrieve the results of the observation and package them into a Justification.Get state updates for this context based on the current status (i.e., ActionStatus).boolean
Check if this ObservationContext has found a valid Observer (i.e., ActionContext) in the system.protected void
A method to perform additional steps during ActionStatus updates (i.e., setStatus).protected void
This resets fields specific to concrete sub-classes and should be overridden by inheriting classes if additional resetting needs to happen.protected void
setupArguments
(List<? extends Object> inputArgs, List<? extends Object> returnArgs) If an observation returns null, it fails.Methods inherited from class edu.tufts.hrilab.action.execution.ArgumentBasedContext
addArgument, addArgument, bindPredicate, bindText, copyArguments, getArgument, getArguments, getArgumentSilent, getArgumentType, getArgumentValue, getEvaluatedArgument, getLocalArgument, getSignatureInPredicateForm, hasArgumentInScope, hasLocalArgument, redistributeArguments, setArgument
Methods inherited from class edu.tufts.hrilab.action.execution.Context
acquireLocks, addEvent, addEvent, addEvent, causedFailure, copyInternal, createSimulatedEquivalent, getActor, getActualLogicalValue, getChildContexts, getCommand, getConstraints, getContextDescription, getContextDescription, getDuration, getElapsedTime, getEndTime, getEquivalentContext, getExecType, getId, getJustification, getLogicalValue, getMaxTime, getNearestTerminatedAncestor, getNextStep, getNextStepForType, getParentContext, getRootContext, getStartTime, getStateMachine, getStatus, hasNormCheckingAncestor, isAction, isApproved, isAsynchronous, isFailure, isSimulation, isSuccess, isTerminated, releaseLocks, resetContext, resetCoreContext, setChildContexts, setConstraints, setEndTime, setExecType, setLogicalValue, setStartTime, setStartTime, setStateMachine, setStatus, setStatus, setTimeout, setupNextStep, setupNextStep, startOverAllMonitor, toString, updatePerformanceModels, verifyEffects, waitForTermination, waitForTermination
-
Constructor Details
-
ObservationContext
protected ObservationContext(Context caller, StateMachine sm, Predicate stateToObserve, Symbol actor, Observable observable) -
ObservationContext
protected ObservationContext(Context caller, StateMachine sm, String cmd, List<String> arguments, Symbol actor, Observable observable)
-
-
Method Details
-
setupArguments
- Specified by:
setupArguments
in classArgumentBasedContext
-
doStep
public void doStep()Description copied from class:Context
If Context has a concrete execution step to perform, it should happen in this method. This should not include setting up next steps (i.e., children to perform), which should happen in the setupNextStep method. Primitive actions and operators (i.e., leaf nodes in the context tree) are examples where this method should be implemented. -
hasObserver
public boolean hasObserver()Check if this ObservationContext has found a valid Observer (i.e., ActionContext) in the system. This first performs doStep which calls selectionAction, and then does the check.- Returns:
-
performAdditionalStatusUpdates
protected void performAdditionalStatusUpdates()Description copied from class:Context
A method to perform additional steps during ActionStatus updates (i.e., setStatus). If a particular Context sub-class needs this to happen, that class should override this method. NOTE: This method is only called when a select set of ActionStatuses are successfully set.- Overrides:
performAdditionalStatusUpdates
in classContext
-
getStateUpdates
Description copied from class:Context
Get state updates for this context based on the current status (i.e., ActionStatus).- Overrides:
getStateUpdates
in classContext
- Returns:
-
verifyReturnValue
If an observation returns null, it fails.- Overrides:
verifyReturnValue
in classContext
- Returns:
-
getBoundObservationResults
Attempt to retrieve the results of the observation and package them into a Justification.- Returns:
- Justification of state with associated bindings, when applicable.
-
resetConcreteContext
protected void resetConcreteContext()Description copied from class:Context
This resets fields specific to concrete sub-classes and should be overridden by inheriting classes if additional resetting needs to happen.- Overrides:
resetConcreteContext
in classContext
-
copy
Description copied from class:Context
deep copy of the context, its status, and its children
-