jason.asSyntax
Class PlanLibrary

Package class diagram package PlanLibrary
java.lang.Object
  extended by jason.asSyntax.PlanLibrary
All Implemented Interfaces:
java.lang.Iterable<Plan>

public class PlanLibrary
extends java.lang.Object
implements java.lang.Iterable<Plan>

Represents a set of plans used by an agent


Field Summary
static Trigger TE_IDLE
           
 
Constructor Summary
PlanLibrary()
           
 
Method Summary
 void add(Plan p)
           
 void add(Plan p, boolean before)
          Adds a plan into the plan library, either before or after all other plans depending on the boolean parameter.
 Plan add(Plan p, Term source, boolean before)
          Add a new plan in PL.
 Plan add(StringTerm stPlan, Term tSource)
          Deprecated. parse the plan before (ASSyntax methods) and call add(Plan, ...) methods
 Plan add(StringTerm stPlan, Term tSource, boolean before)
          Deprecated. parse the plan before (ASSyntax methods) and call add(Plan, ...) methods
 void addAll(java.util.List<Plan> plans)
           
 void addAll(PlanLibrary pl)
           
 void clear()
          remove all plans
 PlanLibrary clone()
           
 Plan get(java.lang.String label)
          return a plan for a label
 java.util.List<Plan> getAllRelevant(Trigger te)
          Deprecated. use getCandidatePlans(te) instead
 org.w3c.dom.Element getAsDOM(org.w3c.dom.Document document)
          get as XML
 java.util.List<Plan> getCandidatePlans(Trigger te)
           
 java.util.List<Plan> getIdlePlans()
           
 java.util.List<Plan> getPlans()
           
 boolean hasCandidatePlan(Trigger te)
           
 boolean hasMetaEventPlans()
           
 boolean isRelevant(Trigger te)
          Deprecated. use hasCandidatePlan(te) instead
 java.util.Iterator<Plan> iterator()
           
 boolean remove(Atom pLabel, Term source)
          Remove a plan represented by the label pLabel.
 Plan remove(java.lang.String pLabel)
          remove the plan with label pLabel
 int size()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TE_IDLE

public static final Trigger TE_IDLE
Constructor Detail

PlanLibrary

public PlanLibrary()
Method Detail

add

public Plan add(StringTerm stPlan,
                Term tSource)
         throws jason.asSyntax.parser.ParseException,
                JasonException
Deprecated. parse the plan before (ASSyntax methods) and call add(Plan, ...) methods

Add a new plan written as a String. The source normally is "self" or the agent that sent this plan. If the PL already has a plan equals to "stPlan", only a new source is added. The plan is added in the end of the PlanLibrary.

Throws:
jason.asSyntax.parser.ParseException
JasonException

add

public Plan add(StringTerm stPlan,
                Term tSource,
                boolean before)
         throws jason.asSyntax.parser.ParseException,
                JasonException
Deprecated. parse the plan before (ASSyntax methods) and call add(Plan, ...) methods

Add a new plan written as a String. The source normally is "self" or the agent that sent this plan. If the PL already has a plan equals to "stPlan", only a new source is added. If before is true, the plan will be added in the begin of the PlanLibrary; otherwise, it is added in the end.

Throws:
jason.asSyntax.parser.ParseException
JasonException

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 begin of the PlanLibrary; otherwise, it is added in the end.

Throws:
JasonException

add

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

add

public void 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 or not to place the new plan before others
Throws:
JasonException

addAll

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

addAll

public void addAll(java.util.List<Plan> plans)
            throws JasonException
Throws:
JasonException

hasMetaEventPlans

public boolean hasMetaEventPlans()

get

public Plan get(java.lang.String label)
return a plan for a label


size

public int size()

getPlans

public java.util.List<Plan> getPlans()

iterator

public java.util.Iterator<Plan> iterator()
Specified by:
iterator in interface java.lang.Iterable<Plan>

clear

public void clear()
remove all plans


remove

public boolean remove(Atom 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(java.lang.String pLabel)
remove the plan with label pLabel


isRelevant

public boolean isRelevant(Trigger te)
Deprecated. use hasCandidatePlan(te) instead


hasCandidatePlan

public boolean hasCandidatePlan(Trigger te)

getAllRelevant

public java.util.List<Plan> getAllRelevant(Trigger te)
Deprecated. use getCandidatePlans(te) instead


getCandidatePlans

public java.util.List<Plan> getCandidatePlans(Trigger te)

getIdlePlans

public java.util.List<Plan> getIdlePlans()

clone

public PlanLibrary clone()
Overrides:
clone in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getAsDOM

public org.w3c.dom.Element getAsDOM(org.w3c.dom.Document document)
get as XML