Package jason.asSyntax
Class Structure
java.lang.Object
jason.asSyntax.DefaultTerm
jason.asSyntax.Literal
jason.asSyntax.Atom
jason.asSyntax.Structure
- All Implemented Interfaces:
LogicalFormula
,Term
,ToDOM
,ToJson
,Serializable
,Cloneable
,Comparable<Term>
- Direct Known Subclasses:
ArithFunctionTerm
,BinaryStructure
,InternalActionLiteral
,ListTermImpl
,Plan
,PlanBodyImpl
,Pred
,Trigger
Represents a structure: a functor with n arguments,
e.g.: val(10,x(3)).
- See Also:
-
Field Summary
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 TypeMethodDescriptionvoid
adds some terms and return thisadds some terms and return thisprotected int
clone and applies together (and faster than clone and then apply)clone()
make a deep copy of the termsclone in another namespacevoid
void
delTerm
(int index) boolean
int
getArity()
returns the number of terms of this literalget as XMLreturns all singleton vars (that appears once) in this literalgetTerm
(int i) returns the i-th term (first term is 0)getTerms()
returns all terms of this literalint
Deprecated.use getArityboolean
hasTerm()
returns true if this literal has some termboolean
boolean
isAtom()
boolean
isGround()
boolean
boolean
isUnary()
void
replaces all terms by unnamed variables (_).replaces all variables by unnamed variables (_).makeVarsAnnon
(Unifier un) replaces all variables of the term for unnamed variables (_).static Structure
void
set all terms of the literal and return thisboolean
toString()
varToReplace
(Term t, Unifier un) 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, getAsListOfTerms, getPredicateIndicator, getSources, getTermsArray, hasAnnot, hasAnnot, hasSource, hasSource, hasSubsetAnnot, hasSubsetAnnot, importAnnots, isLiteral, logicalConsequence, negated, newFromListOfTerms, 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
-
emptyTermList
-
emptyTermArray
-
-
Constructor Details
-
Structure
-
Structure
-
Structure
-
Structure
-
Structure
-
Structure
Create a structure with a defined number of terms. It is used by list term, plan body, ... to not create the array list for terms.
-
-
Method Details
-
parse
-
calcHashCode
protected int calcHashCode()- Overrides:
calcHashCode
in classAtom
-
equals
-
subsumes
- Specified by:
subsumes
in interfaceTerm
- Overrides:
subsumes
in classDefaultTerm
-
capply
Description copied from interface:Term
clone and applies together (and faster than clone and then apply) -
clone
make a deep copy of the terms -
cloneNS
Description copied from interface:Term
clone in another namespace -
addTerm
-
delTerm
public void delTerm(int index) -
addTerms
Description copied from class:Literal
adds some terms and return this -
addTerms
Description copied from class:Literal
adds some terms and return this -
setTerms
Description copied from class:Literal
set all terms of the literal and return this -
setTerm
-
getTerm
Description copied from class:Literal
returns the i-th term (first term is 0) -
getArity
public int getArity()Description copied from class:Literal
returns the number of terms of this literal -
getTermsSize
Deprecated.use getArity -
getTerms
Description copied from class:Literal
returns all terms of this literal -
hasTerm
public boolean hasTerm()Description copied from class:Literal
returns true if this literal has some term -
isStructure
public boolean isStructure()- Specified by:
isStructure
in interfaceTerm
- Overrides:
isStructure
in classDefaultTerm
-
isAtom
public boolean isAtom() -
isGround
public boolean isGround()- Specified by:
isGround
in interfaceTerm
- Overrides:
isGround
in classDefaultTerm
-
isUnary
public boolean isUnary() -
makeVarsAnnon
Description copied from class:Literal
replaces all variables by unnamed variables (_).- Overrides:
makeVarsAnnon
in classLiteral
-
makeVarsAnnon
Description copied from class:Literal
replaces all variables of the term for unnamed variables (_).- Overrides:
makeVarsAnnon
in classLiteral
- Parameters:
un
- is the unifier that contains the map of replacements
-
varToReplace
-
makeTermsAnnon
public void makeTermsAnnon()Description copied from class:Literal
replaces all terms by unnamed variables (_).- Overrides:
makeTermsAnnon
in classLiteral
-
hasVar
- Specified by:
hasVar
in interfaceTerm
- Overrides:
hasVar
in classDefaultTerm
-
getSingletonVars
Description copied from class:Literal
returns all singleton vars (that appears once) in this literal- Overrides:
getSingletonVars
in classLiteral
-
countVars
- Specified by:
countVars
in interfaceTerm
- Overrides:
countVars
in classDefaultTerm
-
toString
-
getAsDOM
get as XML
-