Package jadex.bdi.runtime.impl
Class RGoal
- All Implemented Interfaces:
IElement,IFinishableElement<Void>,IGoal,IInternalPlan,IParameterElement,jadex.javaparser.IMapAccess
Goal instance implementation.
-
Nested Class Summary
Nested classes/interfaces inherited from class jadex.bdi.runtime.impl.RProcessableElement
RProcessableElement.StateNested classes/interfaces inherited from class jadex.bdi.runtime.impl.RParameterElement
RParameterElement.RParameter, RParameterElement.RParameterSetNested classes/interfaces inherited from interface jadex.bdi.runtime.IGoal
IGoal.GoalLifecycleState, IGoal.GoalProcessingState -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ICandidateInfoThe candidate from which this plan was created.protected RPlanThe child plan.protected IGoal.GoalLifecycleStateThe lifecycle state.protected RGoalprotected RPlanThe parent plan.protected IGoal.GoalProcessingStateThe processing state.Fields inherited from class jadex.bdi.runtime.impl.RFinishableElement
exception, listenersFields inherited from class jadex.bdi.runtime.impl.RProcessableElement
apl, pojoelement, state, triedplansFields inherited from class jadex.bdi.runtime.impl.RParameterElement
parameters, parametersetsFields inherited from class jadex.bdi.runtime.impl.RElement
cnt, id, modelelement -
Constructor Summary
ConstructorsConstructorDescriptionRGoal(MGoal mgoal, Object goal, RGoal parentgoal, Map<String, Object> vals, MConfigParameterElement config, ICandidateInfo candidate) Create a new rgoal. -
Method Summary
Modifier and TypeMethodDescriptionprotected jadex.future.IFuture<Void> Abort the child plans.voidaddListener(jadex.future.IResultListener<Void> listener) Add a new listener to get notified when the goal is finished.static voidAdopt a goal so that the agent tries pursuing it.jadex.future.IFuture<Void> Call the user finished method if available.voiddoSetLifecycleState(IGoal.GoalLifecycleState lifecyclestate) Set the lifecycleState.voiddoSetProcessingState(IGoal.GoalProcessingState processingstate) Set the processingState.jadex.future.IFuture<Void> drop()Drop the goal.booleanTest if equal to other object.Get the candidate.Get the childplan.Get the name of the element in the fetcher (e.g.static ObjectgetGoalResult(RGoal rgoal, ClassLoader cl) Get the goal result of the pojo element.Get the lifecycleState.getMGoal()Get the model element.Get parent (goal or plan).Get the parentgoal.Get the parentplan.Get the processingState.inthashCode()Get the hashcode.booleanTest if plan has been aborted.booleanisActive()Test if the goal is in lifecyclestate 'active'.booleanCheck if the element is currently part of the agent's reasoning.booleanisFailed()Test if the element is failed.booleanisPassed()Test if plan has passed.booleanbooleanTest if a goal has succeeded with respect to its plan execution.static booleanisQueryGoalFinished(RGoal goal) Test if a querygoal is finished.booleanisRecur()booleanisRetry()booleanCheck if the goal is the same as another goal with respect to uniqueness settings.booleanTest if the element is succeeded.booleanvoidplanFinished(IInternalPlan rplan) Called when a plan is finished.voidsetCandidate(ICandidateInfo candidate) Set the candidate.voidsetChildPlan(RPlan childplan) Set the childplan.voidsetGoalResult(Object result, ClassLoader cl) voidsetGoalResult(Object result, ClassLoader cl, ChangeEvent<?> event, RPlan rplan, RProcessableElement rpe) Set the goal result from a plan.voidsetLifecycleState(IGoal.GoalLifecycleState lifecyclestate) Set the lifecycle state.voidSet parent (goal or plan).voidSet parent (goal or plan).voidsetProcessingState(IGoal.GoalProcessingState processingstate) Set the processingState.voidtargetConditionTriggered(jadex.rules.eca.IEvent event, jadex.rules.eca.IRule<Void> rule, Object context) Called when the target condition of a goal triggers.Methods inherited from class jadex.bdi.runtime.impl.RFinishableElement
getException, getListeners, isFinished, notifyListeners, removeListener, setExceptionMethods inherited from class jadex.bdi.runtime.impl.RProcessableElement
addTriedPlan, getApplicablePlanList, getPojoElement, getState, getTriedPlans, setApplicablePlanList, setPojoElement, setState, setTriedPlans, testWriteOK, toStringMethods inherited from class jadex.bdi.runtime.impl.RParameterElement
addParameter, addParameterSet, createParameter, createParameter, createParameterSet, createParameterSet, get, getParameter, getParameters, getParameterSet, getParameterSets, getType, hasParameter, hasParameterSet, initParameters, wrapFetcherMethods inherited from class jadex.bdi.runtime.impl.RElement
getAgent, getCapability, getCount, getId, getMCapability, getModelElement, getRuleSystem, setId, setModelElementMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface jadex.bdi.runtime.IElement
getCount, getModelElementMethods inherited from interface jadex.bdi.runtime.IFinishableElement
getException, isFinished, removeListenerMethods inherited from interface jadex.bdi.runtime.impl.IInternalPlan
getExceptionMethods inherited from interface jadex.bdi.runtime.IParameterElement
getParameter, getParameters, getParameterSet, getParameterSets, getType, hasParameter, hasParameterSet
-
Field Details
-
lifecyclestate
The lifecycle state. -
processingstate
The processing state. -
parentplan
The parent plan. -
parentgoal
-
childplan
The child plan. -
candidate
The candidate from which this plan was created. Used for tried plans in proc elem.
-
-
Constructor Details
-
RGoal
public RGoal(MGoal mgoal, Object goal, RGoal parentgoal, Map<String, Object> vals, MConfigParameterElement config, ICandidateInfo candidate) Create a new rgoal.
-
-
Method Details
-
getFetcherName
Get the name of the element in the fetcher (e.g. $goal).- Specified by:
getFetcherNamein classRParameterElement- Returns:
- The element name in the fetcher name.
-
adoptGoal
Adopt a goal so that the agent tries pursuing it. -
getParentPlan
Get the parentplan.- Returns:
- The parentplan.
-
getParentGoal
Get the parentgoal.- Returns:
- The parentgoal.
-
getParent
Get parent (goal or plan). -
setParent
Set parent (goal or plan). -
setParent
Set parent (goal or plan). -
getLifecycleState
Get the lifecycleState.- Specified by:
getLifecycleStatein interfaceIGoal- Returns:
- The lifecycleState.
-
doSetLifecycleState
Set the lifecycleState.- Parameters:
lifecycleState- The lifecycleState to set.
-
getProcessingState
Get the processingState.- Specified by:
getProcessingStatein interfaceIGoal- Returns:
- The processingState.
-
doSetProcessingState
Set the processingState.- Parameters:
processingState- The processingState to set.
-
setProcessingState
Set the processingState.- Parameters:
processingState- The processingState to set.
-
setLifecycleState
Set the lifecycle state.- Parameters:
processingState- The processingState to set.
-
abortPlans
Abort the child plans. -
getMGoal
Get the model element. -
isSucceeded
public boolean isSucceeded()Test if the element is succeeded.- Specified by:
isSucceededin interfaceIFinishableElement<Void>- Specified by:
isSucceededin classRFinishableElement- Returns:
- True, if is succeeded.
-
isFailed
public boolean isFailed()Test if the element is failed.- Specified by:
isFailedin interfaceIFinishableElement<Void>- Specified by:
isFailedin interfaceIInternalPlan- Specified by:
isFailedin classRFinishableElement- Returns:
- True, if is failed.
-
isActive
public boolean isActive()Test if the goal is in lifecyclestate 'active'. -
getChildPlan
Get the childplan.- Returns:
- The childplan.
-
setChildPlan
Set the childplan.- Parameters:
childplan- The childplan to set.
-
hashCode
public int hashCode()Get the hashcode. -
equals
Test if equal to other object. -
planFinished
Called when a plan is finished.- Overrides:
planFinishedin classRProcessableElement
-
onActivate
public boolean onActivate() -
isRetry
public boolean isRetry() -
isRecur
public boolean isRecur() -
isProceduralSucceeded
public boolean isProceduralSucceeded()Test if a goal has succeeded with respect to its plan execution. -
isProceduralGoal
public boolean isProceduralGoal() -
getGoalResult
Get the goal result of the pojo element. Searches @GoalResult and delivers value. -
drop
Drop the goal. -
addListener
Add a new listener to get notified when the goal is finished.- Specified by:
addListenerin interfaceIFinishableElement<Void>- Overrides:
addListenerin classRFinishableElement- Parameters:
listener- The listener.
-
targetConditionTriggered
public void targetConditionTriggered(jadex.rules.eca.IEvent event, jadex.rules.eca.IRule<Void> rule, Object context) Called when the target condition of a goal triggers. -
setGoalResult
- Parameters:
result-cl-
-
setGoalResult
public void setGoalResult(Object result, ClassLoader cl, ChangeEvent<?> event, RPlan rplan, RProcessableElement rpe) Set the goal result from a plan. -
callFinishedMethod
Call the user finished method if available. -
isPassed
public boolean isPassed()Test if plan has passed.- Specified by:
isPassedin interfaceIInternalPlan
-
isAborted
public boolean isAborted()Test if plan has been aborted.- Specified by:
isAbortedin interfaceIInternalPlan
-
isAdopted
public boolean isAdopted()Check if the element is currently part of the agent's reasoning. E.g. the bases are always adopted and all of their contents such as goals, plans and beliefs.- Overrides:
isAdoptedin classRFinishableElement
-
isSame
Check if the goal is the same as another goal with respect to uniqueness settings. When two goals are the same this does not mean the objects are equal() in the Java sense! -
isQueryGoalFinished
Test if a querygoal is finished. It is finished when all out parameters/sets are filled with a value. -
getCandidate
Get the candidate.- Specified by:
getCandidatein interfaceIInternalPlan- Returns:
- The candidate.
-
setCandidate
Set the candidate.- Parameters:
candidate- The candidate to set.
-