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, variableFields inherited from class edu.tufts.hrilab.action.execution.Context
caller, childContexts, cmd, constraints, endTime, maxTime, startTime, stateMachine -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedObservationContext(Context caller, StateMachine sm, Predicate stateToObserve, Symbol actor, Observable observable) protectedObservationContext(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 childrenvoiddoStep()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).booleanCheck if this ObservationContext has found a valid Observer (i.e., ActionContext) in the system.protected voidA method to perform additional steps during ActionStatus updates (i.e., setStatus).protected voidThis resets fields specific to concrete sub-classes and should be overridden by inheriting classes if additional resetting needs to happen.protected voidsetupArguments(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, setArgumentMethods 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:
setupArgumentsin classArgumentBasedContext
-
doStep
public void doStep()Description copied from class:ContextIf 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:ContextA 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:
performAdditionalStatusUpdatesin classContext
-
getStateUpdates
Description copied from class:ContextGet state updates for this context based on the current status (i.e., ActionStatus).- Overrides:
getStateUpdatesin classContext- Returns:
-
verifyReturnValue
If an observation returns null, it fails.- Overrides:
verifyReturnValuein 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:ContextThis resets fields specific to concrete sub-classes and should be overridden by inheriting classes if additional resetting needs to happen.- Overrides:
resetConcreteContextin classContext
-
copy
Description copied from class:Contextdeep copy of the context, its status, and its children
-