Package jason.asSyntax
Class Plan
java.lang.Object
jason.asSyntax.DefaultTerm
jason.asSyntax.Literal
jason.asSyntax.Atom
jason.asSyntax.Structure
jason.asSyntax.Plan
- All Implemented Interfaces:
LogicalFormula
,Term
,ToDOM
,ToJson
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable<Term>
public class Plan extends Structure implements java.lang.Cloneable, java.io.Serializable
Represents an AgentSpeak plan
(it extends structure to be used as a term)
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from class jason.asSyntax.Literal
Literal.FalseLiteral, Literal.TrueLiteral
-
Field Summary
Fields Modifier and Type Field Description private PlanBody
body
private LogicalFormula
context
private LogicalFormula
goalCondition
private boolean
hasBreakpoint
private boolean
isAllUnifs
private boolean
isAtomic
private boolean
isTerm
private Pred
label
private static java.util.logging.Logger
logger
private static Term
noLabelAtom
private PlanLibrary
scope
private static long
serialVersionUID
private java.lang.String
source
private PlanLibrary
subplans
private static Term
TAllUnifs
private static Term
TAtomic
private static Term
TBreakPoint
private Trigger
tevent
Fields inherited from class jason.asSyntax.Structure
emptyTermArray, emptyTermList
Fields inherited from class jason.asSyntax.Literal
DefaultNS, LFalse, LNeg, LPos, LTrue, predicateIndicatorCache
Fields inherited from class jason.asSyntax.DefaultTerm
hashCodeCache, srcInfo
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description void
addSubPlan(Plan p)
Plan
capply(Unifier u)
clone and applies together (and faster than clone and then apply)Term
clone()
make a deep copy of the termsPlan
cloneNS(Atom ns)
clone in another namespacePlan
cloneOnlyBody()
used to create a plan clone in a new IMvoid
delLabel()
boolean
equals(java.lang.Object o)
int
getArity()
returns the number of terms of this literalorg.w3c.dom.Element
getAsDOM(org.w3c.dom.Document document)
get as XMLListTerm
getAsListOfTerms()
returns this literal as a list with three elements: [namespace, functor, list of terms, list of annots]PlanBody
getBody()
LogicalFormula
getContext()
java.lang.String
getFile()
Deprecated.LogicalFormula
getGoalCondition()
Pred
getLabel()
PlanLibrary
getScope()
java.lang.String
getSourceFile()
PlanLibrary
getSubPlans()
Term
getTerm(int i)
returns the i-th term (first term is 0)Trigger
getTrigger()
Trigger
getTriggerEvent()
Deprecated.use getTriggerboolean
hasBreakpoint()
boolean
hasGoalCondition()
boolean
hasInterestInUpdateEvents()
boolean
hasSubPlans()
boolean
isAllUnifs()
boolean
isAtomic()
boolean
isPlanTerm()
Unifier
isRelevant(Trigger te, Unifier u)
returns an unifier if this plan is relevant for the event te, returns null otherwise.static Plan
newFromListOfTerms(ListTerm lt)
creates a plan from a list with four elements: [L, T, C, B]static Plan
parse(java.lang.String sPlan)
prefer using ASSyntax.parsePlanvoid
setAsPlanTerm(boolean b)
void
setContext(LogicalFormula le)
void
setGoalCondition(LogicalFormula f)
void
setLabel(Pred p)
void
setScope(PlanLibrary pl)
void
setSourceFile(java.lang.String f)
void
setTerm(int i, Term t)
java.lang.String
toASString()
returns this plan in a string complaint with AS syntaxjava.lang.String
toString()
Methods inherited from class jason.asSyntax.Structure
addTerm, addTerms, addTerms, calcHashCode, countVars, delTerm, getSingletonVars, getTerms, getTermsSize, hasTerm, hasVar, isAtom, isGround, isStructure, isUnary, makeTermsAnnon, makeVarsAnnon, makeVarsAnnon, setTerms, subsumes, varToReplace
Methods inherited from class jason.asSyntax.Atom
compareTo, getFunctor, getNS
Methods inherited from class jason.asSyntax.Literal
addAnnot, addAnnots, addAnnots, addSource, addSourceInfoAsAnnots, canBeAddedInBB, clearAnnots, copy, delAnnot, delAnnots, delAnnots, delSource, delSources, equalsAsStructure, forceFullLiteralImpl, getAnnot, getAnnots, getAnnots, getAsJson, getPredicateIndicator, getSources, getTermsArray, hasAnnot, hasAnnot, hasSource, hasSource, hasSubsetAnnot, hasSubsetAnnot, importAnnots, isLiteral, logicalConsequence, negated, newFunctor, noSource, parseLiteral, setAnnots, setNegated, subjectToBUF
Methods inherited from class jason.asSyntax.DefaultTerm
getCyclicVar, getErrorMsg, getSrcInfo, hashCode, isArithExpr, isCyclicTerm, isInternalAction, isList, isMap, isNumeric, isPlanBody, isPred, isRule, isSet, isString, isUnnamedVar, isVar, resetHashCodeCache, setSrcInfo
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface jason.asSyntax.Term
getCyclicVar, getSrcInfo, isArithExpr, isCyclicTerm, isInternalAction, isList, isMap, isNumeric, isPlanBody, isPred, isRule, isSet, isString, isUnnamedVar, isVar, setSrcInfo
Methods inherited from interface jason.util.ToJson
getAsJsonStr
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
- Constant Field Values
-
TAtomic
-
TBreakPoint
-
TAllUnifs
-
logger
private static java.util.logging.Logger logger -
label
-
tevent
-
context
-
body
-
goalCondition
-
subplans
-
scope
-
isAtomic
private boolean isAtomic -
isAllUnifs
private boolean isAllUnifs -
hasBreakpoint
private boolean hasBreakpoint -
isTerm
private boolean isTerm -
source
private java.lang.String source -
noLabelAtom
-
-
Constructor Details
-
Plan
public Plan() -
Plan
-
-
Method Details
-
getArity
public int getArity()Description copied from class:Literal
returns the number of terms of this literal -
setSourceFile
public void setSourceFile(java.lang.String f) -
getSourceFile
public java.lang.String getSourceFile() -
getFile
@Deprecated public java.lang.String getFile()Deprecated. -
getTerm
Description copied from class:Literal
returns the i-th term (first term is 0) -
setTerm
-
setLabel
-
getLabel
-
delLabel
public void delLabel() -
setContext
-
setAsPlanTerm
public void setAsPlanTerm(boolean b) -
isPlanTerm
public boolean isPlanTerm() -
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 classLiteral
-
newFromListOfTerms
creates a plan from a list with four elements: [L, T, C, B]- Throws:
JasonException
-
parse
prefer using ASSyntax.parsePlan -
getTriggerEvent
Deprecated.use getTrigger -
getTrigger
-
getContext
-
getBody
-
isAtomic
public boolean isAtomic() -
hasBreakpoint
public boolean hasBreakpoint() -
isAllUnifs
public boolean isAllUnifs() -
isRelevant
returns an unifier if this plan is relevant for the event te, returns null otherwise. -
equals
public boolean equals(java.lang.Object o) -
capply
Description copied from interface:Term
clone and applies together (and faster than clone and then apply) -
clone
Description copied from class:Structure
make a deep copy of the terms -
cloneNS
Description copied from interface:Term
clone in another namespace -
cloneOnlyBody
used to create a plan clone in a new IM -
toString
public java.lang.String toString() -
toASString
public java.lang.String toASString()returns this plan in a string complaint with AS syntax -
getAsDOM
public org.w3c.dom.Element getAsDOM(org.w3c.dom.Document document)get as XML -
addSubPlan
- Throws:
JasonException
-
hasSubPlans
public boolean hasSubPlans() -
hasInterestInUpdateEvents
public boolean hasInterestInUpdateEvents() -
getSubPlans
-
setScope
-
getScope
-
setGoalCondition
-
getGoalCondition
-
hasGoalCondition
public boolean hasGoalCondition()
-