public class RGoal extends RFinishableElement implements IGoal, IInternalPlan
RProcessableElement.State
RParameterElement.RParameter, RParameterElement.RParameterSet
IGoal.GoalLifecycleState, IGoal.GoalProcessingState
Modifier and Type | Field and Description |
---|---|
protected RPlan |
childplan
The child plan.
|
protected IGoal.GoalLifecycleState |
lifecyclestate
The lifecycle state.
|
protected RGoal |
parentgoal |
protected RPlan |
parentplan
The parent plan.
|
protected IGoal.GoalProcessingState |
processingstate
The processing state.
|
exception, listeners
apl, pojoelement, state, triedplans
parameters, parametersets
agent, cnt, id, modelelement
Constructor and Description |
---|
RGoal(jadex.bridge.IInternalAccess agent,
MGoal mgoal,
java.lang.Object goal,
RGoal parentgoal,
java.util.Map<java.lang.String,java.lang.Object> vals,
MConfigParameterElement config)
Create a new rgoal.
|
Modifier and Type | Method and Description |
---|---|
protected jadex.commons.future.IFuture<java.lang.Void> |
abortPlans()
Abort the child plans.
|
void |
addListener(jadex.commons.future.IResultListener<java.lang.Void> listener)
Add a new listener to get notified when the goal is finished.
|
static void |
adoptGoal(RGoal rgoal,
jadex.bridge.IInternalAccess ia)
Adopt a goal so that the agent tries pursuing it.
|
jadex.commons.future.IFuture<java.lang.Void> |
drop()
Drop the goal.
|
boolean |
equals(java.lang.Object obj)
Test if equal to other object.
|
java.lang.Object |
getCandidate()
Get the candidate.
|
RPlan |
getChildPlan()
Get the childplan.
|
java.lang.String |
getFetcherName()
Get the name of the element in the fetcher (e.g.
|
static java.lang.Object |
getGoalResult(RGoal rgoal,
java.lang.ClassLoader cl)
Get the goal result of the pojo element.
|
IGoal.GoalLifecycleState |
getLifecycleState()
Get the lifecycleState.
|
MGoal |
getMGoal()
Get the model element.
|
RElement |
getParent()
Get parent (goal or plan).
|
RGoal |
getParentGoal()
Get the parentgoal.
|
RPlan |
getParentPlan()
Get the parentplan.
|
IGoal.GoalProcessingState |
getProcessingState()
Get the processingState.
|
int |
hashCode()
Get the hashcode.
|
boolean |
isAborted()
Test if plan has been aborted.
|
boolean |
isActive()
Test if the goal is in lifecyclestate 'active'.
|
boolean |
isFailed()
Test if the element is failed.
|
boolean |
isPassed()
Test if plan has passed.
|
boolean |
isProceduralGoal() |
boolean |
isProceduralSucceeded()
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 |
isSame(IGoal goal)
Check if the goal is the same as another goal
with respect to uniqueness settings.
|
boolean |
isSucceeded()
Test if the element is succeeded.
|
boolean |
onActivate() |
void |
planFinished(jadex.bridge.IInternalAccess ia,
IInternalPlan rplan)
Called when a plan is finished.
|
void |
publishToolGoalEvent(java.lang.String evtype) |
void |
setChildPlan(RPlan childplan)
Set the childplan.
|
void |
setGoalResult(java.lang.Object result,
java.lang.ClassLoader cl) |
void |
setGoalResult(java.lang.Object result,
java.lang.ClassLoader cl,
ChangeEvent event,
RPlan rplan,
RProcessableElement rpe)
Set the goal result from a plan.
|
void |
setLifecycleState(IGoal.GoalLifecycleState lifecyclestate)
Set the lifecycleState.
|
void |
setLifecycleState(jadex.bridge.IInternalAccess ia,
IGoal.GoalLifecycleState lifecyclestate)
Set the lifecycle state.
|
void |
setParent(RGoal parent)
Set parent (goal or plan).
|
void |
setParent(RPlan parent)
Set parent (goal or plan).
|
void |
setProcessingState(IGoal.GoalProcessingState processingstate)
Set the processingState.
|
void |
setProcessingState(jadex.bridge.IInternalAccess ia,
IGoal.GoalProcessingState processingstate)
Set the processingState.
|
void |
targetConditionTriggered(jadex.bridge.IInternalAccess ia,
jadex.rules.eca.IEvent event,
jadex.rules.eca.IRule<java.lang.Void> rule,
java.lang.Object context)
Called when the target condition of a goal triggers.
|
java.lang.String |
toString()
Get the string representation.
|
getException, getListeners, isFinished, notifyListeners, removeListener, setException
addTriedPlan, getApplicablePlanList, getPojoElement, getState, getTriedPlans, setApplicablePlanList, setPojoElement, setState, setState, setTriedPlans, testWriteOK
addParameter, addParameterSet, createParameter, createParameter, createParameterSet, createParameterSet, get, getParameter, getParameters, getParameterSet, getParameterSets, getType, hasParameter, hasParameterSet, initParameters, wrapFetcher
getAgent, getCapability, getId, getMCapability, getModelElement, getRuleSystem, setId, setModelElement
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getException, isFinished, removeListener
getException
getParameter, getParameters, getParameterSet, getParameterSets, getType, hasParameter, hasParameterSet
getModelElement
protected IGoal.GoalLifecycleState lifecyclestate
protected IGoal.GoalProcessingState processingstate
protected RPlan parentplan
protected RGoal parentgoal
protected RPlan childplan
public RGoal(jadex.bridge.IInternalAccess agent, MGoal mgoal, java.lang.Object goal, RGoal parentgoal, java.util.Map<java.lang.String,java.lang.Object> vals, MConfigParameterElement config)
public java.lang.String getFetcherName()
getFetcherName
in class RParameterElement
public static void adoptGoal(RGoal rgoal, jadex.bridge.IInternalAccess ia)
public RPlan getParentPlan()
public RGoal getParentGoal()
public RElement getParent()
public void setParent(RGoal parent)
public void setParent(RPlan parent)
public IGoal.GoalLifecycleState getLifecycleState()
getLifecycleState
in interface IGoal
public void setLifecycleState(IGoal.GoalLifecycleState lifecyclestate)
lifecycleState
- The lifecycleState to set.public IGoal.GoalProcessingState getProcessingState()
getProcessingState
in interface IGoal
public void setProcessingState(IGoal.GoalProcessingState processingstate)
processingState
- The processingState to set.public void setProcessingState(jadex.bridge.IInternalAccess ia, IGoal.GoalProcessingState processingstate)
processingState
- The processingState to set.public void setLifecycleState(jadex.bridge.IInternalAccess ia, IGoal.GoalLifecycleState lifecyclestate)
processingState
- The processingState to set.protected jadex.commons.future.IFuture<java.lang.Void> abortPlans()
public MGoal getMGoal()
public boolean isSucceeded()
isSucceeded
in interface IFinishableElement<java.lang.Void>
isSucceeded
in class RFinishableElement
public boolean isFailed()
isFailed
in interface IInternalPlan
isFailed
in interface IFinishableElement<java.lang.Void>
isFailed
in class RFinishableElement
public boolean isActive()
public RPlan getChildPlan()
public void setChildPlan(RPlan childplan)
childplan
- The childplan to set.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
RElement
public void planFinished(jadex.bridge.IInternalAccess ia, IInternalPlan rplan)
planFinished
in class RProcessableElement
public boolean onActivate()
public boolean isRetry()
public boolean isRecur()
public boolean isProceduralSucceeded()
public boolean isProceduralGoal()
public static java.lang.Object getGoalResult(RGoal rgoal, java.lang.ClassLoader cl)
public jadex.commons.future.IFuture<java.lang.Void> drop()
public void addListener(jadex.commons.future.IResultListener<java.lang.Void> listener)
addListener
in interface IFinishableElement<java.lang.Void>
addListener
in class RFinishableElement
listener
- The listener.public void targetConditionTriggered(jadex.bridge.IInternalAccess ia, jadex.rules.eca.IEvent event, jadex.rules.eca.IRule<java.lang.Void> rule, java.lang.Object context)
public void setGoalResult(java.lang.Object result, java.lang.ClassLoader cl)
result
- cl
- public void setGoalResult(java.lang.Object result, java.lang.ClassLoader cl, ChangeEvent event, RPlan rplan, RProcessableElement rpe)
public void publishToolGoalEvent(java.lang.String evtype)
public java.lang.Object getCandidate()
getCandidate
in interface IInternalPlan
public boolean isPassed()
isPassed
in interface IInternalPlan
public boolean isAborted()
isAborted
in interface IInternalPlan
public boolean isSame(IGoal goal)
public static boolean isQueryGoalFinished(RGoal goal)