Class APL

java.lang.Object
jadex.bdi.runtime.impl.APL

public class APL extends Object
The APL is the applicable plan list. It stores the candidates that can be (and were) executed for a processable element.
  • Field Details

    • element

      protected RProcessableElement element
      The processable element.
    • candidates

      protected List<ICandidateInfo> candidates
      The list of candidates.
    • precandidates

      protected List<ICandidateInfo> precandidates
      The mplan candidates.
    • goalprecandidates

      protected List<ICandidateInfo> goalprecandidates
      The mgoal candidates (in case a goal triggers another goal).
  • Constructor Details

  • Method Details

    • build

      public void build()
      Build the apl.
    • removeTriedCandidates

      protected void removeTriedCandidates()
      Remove tried candidates from the actual candidate collection.
    • isToExclude

      protected boolean isToExclude(IInternalPlan rplan, ExcludeMode exclude)
      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

      public List<ICandidateInfo> selectCandidates(MCapability mcapa)
      Select candidates from the list of applicable plans.
    • doBuild

      protected List<ICandidateInfo> doBuild()
      Do build the apl by adding possible candidate plans.
    • checkMPlan

      public 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.
    • getNextCandidate

      protected ICandidateInfo getNextCandidate(MCapability mcapa)
      Get the next candidate with respect to the plan priority and the rank of the candidate.
      Returns:
      The next candidate.
    • getCandidates

      public List<ICandidateInfo> getCandidates()
      Get the candidates.
      Returns:
      The candidates
    • getPriority

      protected static int getPriority(ICandidateInfo cand, MCapability mcapa)
      Get the priority of a candidate.
      Returns:
      The priority of a candidate.
    • getRank

      protected int getRank(Object cand)
      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

      public void planFinished(IInternalPlan rplan)
      After plan has finished the candidate will be removed from the APL.
    • createMPlanCandidates

      public static List<ICandidateInfo> createMPlanCandidates(MPlan mplan, RProcessableElement element)
      Create candidates for a matching mplan. Checks precondition and evaluates bindings (if any).
      Returns:
      List of plan info objects.
    • createMGoalCandidates

      public static List<ICandidateInfo> createMGoalCandidates(MGoal mgoal, RProcessableElement element)
      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.