Class Plan

All Implemented Interfaces:
LogicalFormula, Term, ToDOM, ToJson, Serializable, Cloneable, Comparable<Term>

public class Plan extends Structure implements Cloneable, Serializable
Represents an AgentSpeak plan (it extends structure to be used as a term)
See Also:
  • Constructor Details

  • Method Details

    • getArity

      public int getArity()
      Description copied from class: Literal
      returns the number of terms of this literal
      Overrides:
      getArity in class Structure
    • setSourceFile

      public void setSourceFile(String f)
    • getSourceFile

      public String getSourceFile()
    • getFile

      @Deprecated public String getFile()
      Deprecated.
    • getTerm

      public Term getTerm(int i)
      Description copied from class: Literal
      returns the i-th term (first term is 0)
      Overrides:
      getTerm in class Structure
    • setTerm

      public void setTerm(int i, Term t)
      Overrides:
      setTerm in class Structure
    • setLabel

      public void setLabel(Pred p)
    • getLabel

      public Pred getLabel()
    • delLabel

      public void delLabel()
    • setContext

      public void setContext(LogicalFormula le)
    • setAsPlanTerm

      public void setAsPlanTerm(boolean b)
    • isPlanTerm

      public boolean isPlanTerm()
    • getAsListOfTerms

      public ListTerm getAsListOfTerms()
      Description copied from class: Literal
      returns this literal as a list with three elements: [namespace, functor, list of terms, list of annots]
      Overrides:
      getAsListOfTerms in class Literal
    • newFromListOfTerms

      public static Plan newFromListOfTerms(ListTerm lt) throws JasonException
      creates a plan from a list with four elements: [L, T, C, B]
      Throws:
      JasonException
    • parse

      public static Plan parse(String sPlan)
      prefer using ASSyntax.parsePlan
    • getTriggerEvent

      @Deprecated public Trigger getTriggerEvent()
      Deprecated.
      use getTrigger
    • getTrigger

      public Trigger getTrigger()
    • getContext

      public LogicalFormula getContext()
    • getBody

      public PlanBody getBody()
    • isAtomic

      public boolean isAtomic()
    • hasBreakpoint

      public boolean hasBreakpoint()
    • isAllUnifs

      public boolean isAllUnifs()
    • isRelevant

      public Unifier isRelevant(Trigger te, Unifier u)
      returns an unifier if this plan is relevant for the event te, returns null otherwise.
    • equals

      public boolean equals(Object o)
      Specified by:
      equals in interface Term
      Overrides:
      equals in class Structure
    • capply

      public Plan capply(Unifier u)
      Description copied from interface: Term
      clone and applies together (and faster than clone and then apply)
      Specified by:
      capply in interface Term
      Overrides:
      capply in class Structure
    • clone

      public Term clone()
      Description copied from class: Structure
      make a deep copy of the terms
      Specified by:
      clone in interface Term
      Overrides:
      clone in class Structure
    • cloneNS

      public Plan cloneNS(Atom ns)
      Description copied from interface: Term
      clone in another namespace
      Specified by:
      cloneNS in interface Term
      Overrides:
      cloneNS in class Structure
    • cloneOnlyBody

      public Plan cloneOnlyBody()
      used to create a plan clone in a new IM
    • toString

      public String toString()
      Overrides:
      toString in class Structure
    • toASString

      public String toASString()
      returns this plan in a string complaint with AS syntax
    • getAsDOM

      public Element getAsDOM(Document document)
      get as XML
      Specified by:
      getAsDOM in interface ToDOM
      Overrides:
      getAsDOM in class Structure
    • addSubPlan

      public void addSubPlan(Plan p) throws JasonException
      Throws:
      JasonException
    • hasSubPlans

      public boolean hasSubPlans()
    • hasInterestInUpdateEvents

      public boolean hasInterestInUpdateEvents()
    • getSubPlans

      public PlanLibrary getSubPlans()
    • setScope

      public void setScope(PlanLibrary pl)
    • getScope

      public PlanLibrary getScope()
    • setGoalCondition

      public void setGoalCondition(LogicalFormula f)
    • getGoalCondition

      public LogicalFormula getGoalCondition()
    • hasGoalCondition

      public boolean hasGoalCondition()
    • hasSource

      public boolean hasSource()
      Description copied from class: Literal
      returns true if this literal has some source annotation
      Overrides:
      hasSource in class Literal
    • hasSource

      public boolean hasSource(Term agName)
      Description copied from class: Literal
      returns true if this literal has a "source(agName)"
      Overrides:
      hasSource in class Literal
    • getSources

      public ListTerm getSources()
      Description copied from class: Literal
      returns the sources of this literal as a new list. e.g.: from annots [source(a), source(b)], it returns [a,b]
      Overrides:
      getSources in class Literal
    • addSource

      public Literal addSource(Term agName)
      Description copied from class: Literal
      adds the annotation source(agName)
      Overrides:
      addSource in class Literal
    • delSource

      public boolean delSource(Term agName)
      Description copied from class: Literal
      deletes one source(agName) annotation, return true if deleted
      Overrides:
      delSource in class Literal
    • delSources

      public void delSources()
      Description copied from class: Literal
      deletes all source annotations
      Overrides:
      delSources in class Literal