jason.asSyntax
Class PlanBodyImpl
java.lang.Object
jason.asSyntax.DefaultTerm
jason.asSyntax.Literal
jason.asSyntax.Atom
jason.asSyntax.Structure
jason.asSyntax.PlanBodyImpl
- All Implemented Interfaces:
- LogicalFormula, PlanBody, Term, ToDOM, java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<Term>, java.lang.Iterable<PlanBody>
- Direct Known Subclasses:
- BodyLiteral
public class PlanBodyImpl
- extends Structure
- implements PlanBody, java.lang.Iterable<PlanBody>
Represents a plan body item (achieve, test, action, ...) and its successors.
A plan body like a1; ?t; !g
is represented by the following structure
(a1, (?t, (!g)))
.
- See Also:
- Serialized Form
Methods inherited from class jason.asSyntax.Structure |
addTerm, addTerms, addTerms, compareTo, countVars, delTerm, getSingletonVars, getTerms, getTermsSize, hasTerm, hasVar, isGround, isStructure, makeTermsAnnon, makeVarsAnnon, makeVarsAnnon, parse, setTerms, varToReplace |
Methods inherited from class jason.asSyntax.Literal |
addAnnot, addAnnots, addAnnots, addSource, canBeAddedInBB, clearAnnots, copy, delAnnot, delAnnots, delSource, delSources, equalsAsStructure, forceFullLiteralImpl, getAnnots, getAnnots, getAsListOfTerms, getPredicateIndicator, getSources, getTermsArray, hasAnnot, hasAnnot, hasSource, hasSource, hasSubsetAnnot, hasSubsetAnnot, importAnnots, isLiteral, negated, newFromListOfTerms, parseLiteral, setAnnots, setNegated |
Methods inherited from class jason.asSyntax.DefaultTerm |
getErrorMsg, getSrcInfo, hashCode, isArithExpr, isInternalAction, isList, isNumeric, isPred, isRule, 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 |
countVars, getSrcInfo, hasVar, isArithExpr, isGround, isInternalAction, isList, isLiteral, isNumeric, isPred, isRule, isString, isStructure, isUnnamedVar, isVar, setSrcInfo |
Methods inherited from interface java.lang.Comparable |
compareTo |
BODY_PLAN_FUNCTOR
public static final java.lang.String BODY_PLAN_FUNCTOR
- See Also:
- Constant Field Values
PlanBodyImpl
public PlanBodyImpl()
- constructor for empty plan body
PlanBodyImpl
public PlanBodyImpl(PlanBody.BodyType t,
Term b)
setBodyNext
public void setBodyNext(PlanBody next)
- Specified by:
setBodyNext
in interface PlanBody
getBodyNext
public PlanBody getBodyNext()
- Specified by:
getBodyNext
in interface PlanBody
isEmptyBody
public boolean isEmptyBody()
- Specified by:
isEmptyBody
in interface PlanBody
getBodyType
public PlanBody.BodyType getBodyType()
- Specified by:
getBodyType
in interface PlanBody
setBodyType
public void setBodyType(PlanBody.BodyType bt)
- Specified by:
setBodyType
in interface PlanBody
getBodyTerm
public Term getBodyTerm()
- Specified by:
getBodyTerm
in interface PlanBody
setBodyTerm
public void setBodyTerm(Term t)
- Specified by:
setBodyTerm
in interface PlanBody
isBodyTerm
public boolean isBodyTerm()
- Specified by:
isBodyTerm
in interface PlanBody
isAtom
public boolean isAtom()
- Specified by:
isAtom
in interface Term
- Overrides:
isAtom
in class Structure
setAsBodyTerm
public void setAsBodyTerm(boolean b)
- Specified by:
setAsBodyTerm
in interface PlanBody
isPlanBody
public boolean isPlanBody()
- Specified by:
isPlanBody
in interface Term
- Overrides:
isPlanBody
in class DefaultTerm
iterator
public java.util.Iterator<PlanBody> iterator()
- Specified by:
iterator
in interface java.lang.Iterable<PlanBody>
getArity
public int getArity()
- Description copied from class:
Literal
- returns the number of terms of this literal
- Overrides:
getArity
in class Structure
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
apply
public boolean apply(Unifier u)
- Description copied from interface:
Term
- replaces variables by their values in the unifier, returns true if some variable was applied
- Specified by:
apply
in interface Term
- Overrides:
apply
in class Structure
logicalConsequence
public java.util.Iterator<Unifier> logicalConsequence(Agent ag,
Unifier un)
- Description copied from class:
Literal
- logicalConsequence checks whether one particular predicate
is a logical consequence of the belief base.
Returns an iterator for all unifiers that are logCons.
- Specified by:
logicalConsequence
in interface LogicalFormula
- Overrides:
logicalConsequence
in class Literal
equals
public boolean equals(java.lang.Object o)
- Specified by:
equals
in interface Term
- Overrides:
equals
in class Structure
calcHashCode
public int calcHashCode()
- Overrides:
calcHashCode
in class Structure
add
public boolean add(PlanBody bl)
- clone the plan body and adds it in the end of this plan
- Specified by:
add
in interface PlanBody
getLastBody
public PlanBody getLastBody()
- Specified by:
getLastBody
in interface PlanBody
add
public boolean add(int index,
PlanBody bl)
- Specified by:
add
in interface PlanBody
removeBody
public Term removeBody(int index)
- Specified by:
removeBody
in interface PlanBody
getPlanSize
public int getPlanSize()
- Specified by:
getPlanSize
in interface PlanBody
clone
public PlanBody clone()
- Description copied from class:
Structure
- make a deep copy of the terms
- Specified by:
clone
in interface Term
- Overrides:
clone
in class Structure
clonePB
public PlanBody clonePB()
- Description copied from interface:
PlanBody
- clone the plan body
- Specified by:
clonePB
in interface PlanBody
toString
public java.lang.String toString()
- Overrides:
toString
in class Structure
getAsDOM
public org.w3c.dom.Element getAsDOM(org.w3c.dom.Document document)
- get as XML
- Specified by:
getAsDOM
in interface ToDOM
- Overrides:
getAsDOM
in class Structure