public class Structure extends Atom
Modifier and Type | Field and Description |
---|---|
protected static Term[] |
emptyTermArray |
protected static java.util.List<Term> |
emptyTermList |
LFalse, LNeg, LPos, LTrue, predicateIndicatorCache
hashCodeCache, srcInfo
Modifier | Constructor and Description |
---|---|
|
Structure(Literal l) |
protected |
Structure(Literal l,
Unifier u) |
|
Structure(java.lang.String functor) |
|
Structure(java.lang.String functor,
int termsSize)
Create a structure with a defined number of terms.
|
Modifier and Type | Method and Description |
---|---|
void |
addTerm(Term t) |
Literal |
addTerms(java.util.List<Term> l)
adds some terms and return this
|
Literal |
addTerms(Term... ts)
adds some terms and return this
|
protected int |
calcHashCode() |
Term |
capply(Unifier u)
clone and applies together (and faster than clone and then apply)
|
Term |
clone()
make a deep copy of the terms
|
int |
compareTo(Term t) |
void |
countVars(java.util.Map<VarTerm,java.lang.Integer> c) |
void |
delTerm(int index) |
boolean |
equals(java.lang.Object t) |
int |
getArity()
returns the number of terms of this literal
|
org.w3c.dom.Element |
getAsDOM(org.w3c.dom.Document document)
get as XML
|
java.util.List<VarTerm> |
getSingletonVars()
returns all singleton vars (that appears once) in this literal
|
Term |
getTerm(int i)
returns the i-th term (first term is 0)
|
java.util.List<Term> |
getTerms()
returns all terms of this literal
|
int |
getTermsSize()
Deprecated.
use getArity
|
boolean |
hasTerm()
returns true if this literal has some term
|
boolean |
hasVar(VarTerm t,
Unifier u) |
boolean |
isAtom() |
boolean |
isGround() |
boolean |
isStructure() |
boolean |
isUnary() |
void |
makeTermsAnnon()
replaces all terms by unnamed variables (_).
|
Literal |
makeVarsAnnon()
replaces all variables by unnamed variables (_).
|
Literal |
makeVarsAnnon(Unifier un)
replaces all variables of the term for unnamed variables (_).
|
static Structure |
parse(java.lang.String sTerm) |
void |
setTerm(int i,
Term t) |
Literal |
setTerms(java.util.List<Term> l)
set all terms of the literal and return this
|
boolean |
subsumes(Term t) |
java.lang.String |
toString() |
VarTerm |
varToReplace(Term t,
Unifier un) |
getFunctor
addAnnot, addAnnots, addAnnots, addSource, canBeAddedInBB, clearAnnots, copy, delAnnot, delAnnots, delSource, delSources, equalsAsStructure, forceFullLiteralImpl, getAnnot, getAnnots, getAnnots, getAsListOfTerms, getPredicateIndicator, getSources, getTermsArray, hasAnnot, hasAnnot, hasSource, hasSource, hasSubsetAnnot, hasSubsetAnnot, importAnnots, isLiteral, logicalConsequence, negated, newFromListOfTerms, parseLiteral, setAnnots, setNegated
getCyclicVar, getErrorMsg, getSrcInfo, hashCode, isArithExpr, isCyclicTerm, isInternalAction, isList, isNumeric, isPlanBody, isPred, isRule, isString, isUnnamedVar, isVar, resetHashCodeCache, setSrcInfo
finalize, getClass, notify, notifyAll, wait, wait, wait
getCyclicVar, getSrcInfo, isArithExpr, isCyclicTerm, isInternalAction, isList, isNumeric, isPlanBody, isPred, isRule, isString, isUnnamedVar, isVar, setSrcInfo
protected static final java.util.List<Term> emptyTermList
protected static final Term[] emptyTermArray
public Structure(java.lang.String functor)
public Structure(Literal l)
public Structure(java.lang.String functor, int termsSize)
public static Structure parse(java.lang.String sTerm)
protected int calcHashCode()
calcHashCode
in class Atom
public boolean equals(java.lang.Object t)
public int compareTo(Term t)
public boolean subsumes(Term t)
subsumes
in interface Term
subsumes
in class DefaultTerm
public Term capply(Unifier u)
Term
capply
in interface Term
capply
in class DefaultTerm
public Term clone()
public Literal addTerms(Term... ts)
Literal
public Literal addTerms(java.util.List<Term> l)
Literal
public Literal setTerms(java.util.List<Term> l)
Literal
public Term getTerm(int i)
Literal
public int getArity()
Literal
public int getTermsSize()
public java.util.List<Term> getTerms()
Literal
public boolean hasTerm()
Literal
public boolean isStructure()
isStructure
in interface Term
isStructure
in class DefaultTerm
public boolean isAtom()
public boolean isGround()
isGround
in interface Term
isGround
in class DefaultTerm
public boolean isUnary()
public Literal makeVarsAnnon()
Literal
makeVarsAnnon
in class Literal
public Literal makeVarsAnnon(Unifier un)
Literal
makeVarsAnnon
in class Literal
un
- is the unifier that contains the map of replacementspublic void makeTermsAnnon()
Literal
makeTermsAnnon
in class Literal
public boolean hasVar(VarTerm t, Unifier u)
hasVar
in interface Term
hasVar
in class DefaultTerm
public java.util.List<VarTerm> getSingletonVars()
Literal
getSingletonVars
in class Literal
public void countVars(java.util.Map<VarTerm,java.lang.Integer> c)
countVars
in interface Term
countVars
in class DefaultTerm