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.State
Nested classes/interfaces inherited from class jadex.bdi.runtime.impl.RParameterElement
RParameterElement.RParameter, RParameterElement.RParameterSet
Nested classes/interfaces inherited from interface jadex.bdi.runtime.IGoal
IGoal.GoalLifecycleState, IGoal.GoalProcessingState
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ICandidateInfo
The candidate from which this plan was created.protected RPlan
The child plan.protected IGoal.GoalLifecycleState
The lifecycle state.protected RGoal
protected RPlan
The parent plan.protected IGoal.GoalProcessingState
The processing state.Fields inherited from class jadex.bdi.runtime.impl.RFinishableElement
exception, listeners
Fields inherited from class jadex.bdi.runtime.impl.RProcessableElement
apl, pojoelement, state, triedplans
Fields inherited from class jadex.bdi.runtime.impl.RParameterElement
parameters, parametersets
Fields 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.void
addListener
(jadex.future.IResultListener<Void> listener) Add a new listener to get notified when the goal is finished.static void
Adopt a goal so that the agent tries pursuing it.jadex.future.IFuture
<Void> Call the user finished method if available.void
doSetLifecycleState
(IGoal.GoalLifecycleState lifecyclestate) Set the lifecycleState.void
doSetProcessingState
(IGoal.GoalProcessingState processingstate) Set the processingState.jadex.future.IFuture
<Void> drop()
Drop the goal.boolean
Test if equal to other object.Get the candidate.Get the childplan.Get the name of the element in the fetcher (e.g.static Object
getGoalResult
(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.int
hashCode()
Get the hashcode.boolean
Test if plan has been aborted.boolean
isActive()
Test if the goal is in lifecyclestate 'active'.boolean
Check if the element is currently part of the agent's reasoning.boolean
isFailed()
Test if the element is failed.boolean
isPassed()
Test if plan has passed.boolean
boolean
Test if a goal has succeeded with respect to its plan execution.static boolean
isQueryGoalFinished
(RGoal goal) Test if a querygoal is finished.boolean
isRecur()
boolean
isRetry()
boolean
Check if the goal is the same as another goal with respect to uniqueness settings.boolean
Test if the element is succeeded.boolean
void
planFinished
(IInternalPlan rplan) Called when a plan is finished.void
setCandidate
(ICandidateInfo candidate) Set the candidate.void
setChildPlan
(RPlan childplan) Set the childplan.void
setGoalResult
(Object result, ClassLoader cl) void
setGoalResult
(Object result, ClassLoader cl, ChangeEvent<?> event, RPlan rplan, RProcessableElement rpe) Set the goal result from a plan.void
setLifecycleState
(IGoal.GoalLifecycleState lifecyclestate) Set the lifecycle state.void
Set parent (goal or plan).void
Set parent (goal or plan).void
setProcessingState
(IGoal.GoalProcessingState processingstate) Set the processingState.void
targetConditionTriggered
(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, setException
Methods inherited from class jadex.bdi.runtime.impl.RProcessableElement
addTriedPlan, getApplicablePlanList, getPojoElement, getState, getTriedPlans, setApplicablePlanList, setPojoElement, setState, setTriedPlans, testWriteOK, toString
Methods inherited from class jadex.bdi.runtime.impl.RParameterElement
addParameter, addParameterSet, createParameter, createParameter, createParameterSet, createParameterSet, get, getParameter, getParameters, getParameterSet, getParameterSets, getType, hasParameter, hasParameterSet, initParameters, wrapFetcher
Methods inherited from class jadex.bdi.runtime.impl.RElement
getAgent, getCapability, getCount, getId, getMCapability, getModelElement, getRuleSystem, setId, setModelElement
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface jadex.bdi.runtime.IElement
getCount, getModelElement
Methods inherited from interface jadex.bdi.runtime.IFinishableElement
getException, isFinished, removeListener
Methods inherited from interface jadex.bdi.runtime.impl.IInternalPlan
getException
Methods 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:
getFetcherName
in 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:
getLifecycleState
in interfaceIGoal
- Returns:
- The lifecycleState.
-
doSetLifecycleState
Set the lifecycleState.- Parameters:
lifecycleState
- The lifecycleState to set.
-
getProcessingState
Get the processingState.- Specified by:
getProcessingState
in 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:
isSucceeded
in interfaceIFinishableElement<Void>
- Specified by:
isSucceeded
in classRFinishableElement
- Returns:
- True, if is succeeded.
-
isFailed
public boolean isFailed()Test if the element is failed.- Specified by:
isFailed
in interfaceIFinishableElement<Void>
- Specified by:
isFailed
in interfaceIInternalPlan
- Specified by:
isFailed
in 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:
planFinished
in 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:
addListener
in interfaceIFinishableElement<Void>
- Overrides:
addListener
in 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:
isPassed
in interfaceIInternalPlan
-
isAborted
public boolean isAborted()Test if plan has been aborted.- Specified by:
isAborted
in 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:
isAdopted
in 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:
getCandidate
in interfaceIInternalPlan
- Returns:
- The candidate.
-
setCandidate
Set the candidate.- Parameters:
candidate
- The candidate to set.
-