Package jason.pl

Class PlanLibrary

java.lang.Object
jason.pl.PlanLibrary
All Implemented Interfaces:
ToDOM, Serializable, Iterable<Plan>

public class PlanLibrary extends Object implements Iterable<Plan>, Serializable, ToDOM
Represents a set of plans used by an agent
See Also:
  • Field Details

    • KQML_PLANS_FILE

      public static String KQML_PLANS_FILE
    • TE_JAG_SLEEPING

      public static final Trigger TE_JAG_SLEEPING
    • TE_JAG_AWAKING

      public static final Trigger TE_JAG_AWAKING
    • TE_JAG_SHUTTING_DOWN

      public static final Trigger TE_JAG_SHUTTING_DOWN
    • eDOMPlans

      protected Element eDOMPlans
  • Constructor Details

    • PlanLibrary

      public PlanLibrary()
    • PlanLibrary

      public PlanLibrary(PlanLibrary father)
  • Method Details

    • isRoot

      public boolean isRoot()
    • getFather

      public PlanLibrary getFather()
    • setFather

      public void setFather(PlanLibrary pl)
    • hasPlansForUpdateEvents

      public boolean hasPlansForUpdateEvents()
    • getLock

      public Lock getLock()
    • add

      public Plan add(Plan p, Term source, boolean before) throws JasonException
      Add a new plan in PL. The source normally is "self" or the agent that sent this plan. If the PL already has a plan equals to the parameter p, only a new source is added.

      If before is true, the plan will be added in the beginning of the PlanLibrary; otherwise, it is added in the end.

      returns the plan just added

      Throws:
      JasonException
    • add

      public Plan add(Plan p) throws JasonException
      Throws:
      JasonException
    • add

      public Plan add(Plan p, boolean before) throws JasonException
      Adds a plan into the plan library, either before or after all other plans depending on the boolean parameter.
      Parameters:
      p - The plan to be added to the plan library
      before - Whether to place the new plan before others
      Throws:
      JasonException
    • addAll

      public void addAll(PlanLibrary pl) throws JasonException
      Throws:
      JasonException
    • addAll

      public void addAll(List<Plan> plans) throws JasonException
      Throws:
      JasonException
    • hasMetaEventPlans

      public boolean hasMetaEventPlans()
    • hasUserKqmlReceivedPlans

      public boolean hasUserKqmlReceivedPlans()
    • hasJagPlans

      public boolean hasJagPlans()
    • getUniqueLabel

      public Pred getUniqueLabel()
      add a label to the plan
    • get

      public Plan get(String label)
      return a plan for a label
    • get

      public Plan get(Literal label)
      return a plan for a label
    • size

      public int size()
    • getPlans

      public List<Plan> getPlans()
    • iterator

      public Iterator<Plan> iterator()
      Specified by:
      iterator in interface Iterable<Plan>
    • clear

      public void clear()
      remove all plans
    • remove

      public boolean remove(Literal pLabel, Term source)
      Remove a plan represented by the label pLabel. In case the plan has many sources, only the plan's source is removed.
    • remove

      public Plan remove(Literal pLabel)
      remove the plan with label pLabel
    • hasCandidatePlan

      public boolean hasCandidatePlan(Trigger te)
    • getCandidatePlans

      public List<Plan> getCandidatePlans(Trigger te)
    • clone

      public PlanLibrary clone()
      Overrides:
      clone in class Object
    • hasListener

      public boolean hasListener()
    • addListener

      public void addListener(PlanLibraryListener el)
    • removeListener

      public void removeListener(PlanLibraryListener el)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getAsTxt

      public String getAsTxt(boolean includeKQMLPlans)
      get as txt
    • getAsDOM

      public Element getAsDOM(Document document)
      get as XML
      Specified by:
      getAsDOM in interface ToDOM