Package jadex.bdi.runtime.impl
Class APL
java.lang.Object
jadex.bdi.runtime.impl.APL
The APL is the applicable plan list. It stores the
candidates that can be (and were) executed for a processable element.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Candidate info for mgoal.static class
Candidate info for mplan.static class
Candidate info for pojo plan.static class
Candidate info for rplan.static class
Candidate info for waitqueue.static class
Goal info that contains the mgoal and the parameter bindings.static class
Plan info that contains the mgoal and the parameter bindings. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List
<ICandidateInfo> The list of candidates.protected RProcessableElement
The processable element.protected List
<ICandidateInfo> The mgoal candidates (in case a goal triggers another goal).protected List
<ICandidateInfo> The mplan candidates. -
Constructor Summary
ConstructorsConstructorDescriptionAPL
(RProcessableElement element) Create a new APL.APL
(RProcessableElement element, List<ICandidateInfo> candidates) Create a new APL. -
Method Summary
Modifier and TypeMethodDescriptionvoid
build()
Build the apl.calculateBindingElements
(MParameterElement melem, RProcessableElement element) Calculate the possible binding value combinations.static boolean
checkMPlan
(ICandidateInfo cand, RProcessableElement element) Test precondition (and match expression) of a plan to decide if it can be added to the candidates.static List
<ICandidateInfo> createMGoalCandidates
(MGoal mgoal, RProcessableElement element) Create candidates for a matching mgoal.static List
<ICandidateInfo> createMPlanCandidates
(MPlan mplan, RProcessableElement element) Create candidates for a matching mplan.protected List
<ICandidateInfo> doBuild()
Do build the apl by adding possible candidate plans.Get the candidates.protected ICandidateInfo
getNextCandidate
(MCapability mcapa) Get the next candidate with respect to the plan priority and the rank of the candidate.protected static int
getPriority
(ICandidateInfo cand, MCapability mcapa) Get the priority of a candidate.protected int
Get the rank of a candidate.boolean
isEmpty()
Test if APL has more candidates.protected boolean
isToExclude
(IInternalPlan rplan, ExcludeMode exclude) Check if an rplan is to exclude wrt the exclude mode and plan result state.void
planFinished
(IInternalPlan rplan) After plan has finished the candidate will be removed from the APL.protected void
Remove tried candidates from the actual candidate collection.selectCandidates
(MCapability mcapa) Select candidates from the list of applicable plans.
-
Field Details
-
element
The processable element. -
candidates
The list of candidates. -
precandidates
The mplan candidates. -
goalprecandidates
The mgoal candidates (in case a goal triggers another goal).
-
-
Constructor Details
-
APL
Create a new APL. -
APL
Create a new APL.
-
-
Method Details
-
build
public void build()Build the apl. -
removeTriedCandidates
protected void removeTriedCandidates()Remove tried candidates from the actual candidate collection. -
isToExclude
Check if an rplan is to exclude wrt the exclude mode and plan result state.- Parameters:
rplan
- The tried plan.exclude
-- Returns:
- True, if should be excluded.
-
isEmpty
public boolean isEmpty()Test if APL has more candidates. -
selectCandidates
Select candidates from the list of applicable plans. -
doBuild
Do build the apl by adding possible candidate plans. -
checkMPlan
Test precondition (and match expression) of a plan to decide if it can be added to the candidates. -
getNextCandidate
Get the next candidate with respect to the plan priority and the rank of the candidate.- Returns:
- The next candidate.
-
getCandidates
Get the candidates.- Returns:
- The candidates
-
getPriority
Get the priority of a candidate.- Returns:
- The priority of a candidate.
-
getRank
Get the rank of a candidate. The order is as follows: new plan from model/candidate (0/1) -> waitqueue (2/3) -> running plan instance (4/5).- Returns:
- The rank of a candidate.
-
planFinished
After plan has finished the candidate will be removed from the APL. -
createMPlanCandidates
Create candidates for a matching mplan. Checks precondition and evaluates bindings (if any).- Returns:
- List of plan info objects.
-
createMGoalCandidates
Create candidates for a matching mgoal. Checks precondition and evaluates bindings (if any).- Returns:
- List of goal info objects.
-
calculateBindingElements
public static List<Map<String,Object>> calculateBindingElements(MParameterElement melem, RProcessableElement element) Calculate the possible binding value combinations.- Parameters:
melem
- The parameter element.element
- The element to process (if any).agent
- The agent.- Returns:
- The list of binding maps.
-