public class VarTerm extends LiteralImpl implements NumberTerm, ListTerm
VarTerm
.apply.
An object of this class can be used in place of a
Literal, Number, List, String, .... It behaves like a
Literal, Number, .... just in case its value is a Literal,
Number, ...Literal.FalseLiteral, Literal.TrueLiteral
Modifier and Type | Field and Description |
---|---|
private static java.util.logging.Logger |
logger |
private static long |
serialVersionUID |
emptyTermArray, emptyTermList
DefaultNS, LFalse, LNeg, LPos, LTrue, predicateIndicatorCache
hashCodeCache, srcInfo
Constructor and Description |
---|
VarTerm(Atom namespace,
Literal v) |
VarTerm(Atom namespace,
java.lang.String functor) |
VarTerm(java.lang.String s) |
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
Term o) |
boolean |
add(Term o) |
boolean |
addAll(java.util.Collection c) |
boolean |
addAll(int index,
java.util.Collection c) |
void |
addTerm(Term t) |
Literal |
addTerms(java.util.List<Term> l)
adds some terms and return this
|
ListTerm |
append(Term t) |
protected int |
calcHashCode() |
boolean |
canBeAddedInBB()
to be overridden by subclasses (as internal action)
|
Term |
capply(Unifier u)
clone and applies together (and faster than clone and then apply)
|
void |
clear() |
Term |
clone()
make a deep copy of the terms
|
ListTerm |
cloneLT()
clone the list term
|
ListTerm |
cloneLTShallow()
make a shallow copy of the list (terms are not cloned, only the structure)
|
Literal |
cloneNS(Atom newNameSpace)
clone in another namespace
|
int |
compareTo(Term t) |
ListTerm |
concat(ListTerm lt) |
boolean |
contains(java.lang.Object o) |
boolean |
containsAll(java.util.Collection c) |
void |
countVars(java.util.Map<VarTerm,java.lang.Integer> c) |
ListTerm |
difference(ListTerm lt) |
boolean |
equals(java.lang.Object t) |
Term |
get(int index) |
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<Term> |
getAsList() |
ListTerm |
getLast() |
ListTerm |
getNext() |
ListTerm |
getPenultimate() |
VarTerm |
getTail() |
Term |
getTerm() |
Term |
getTerm(int i)
returns the i-th term (first term is 0)
|
java.util.List<Term> |
getTerms()
returns all terms of this literal
|
boolean |
hasVar(VarTerm t,
Unifier u) |
int |
indexOf(java.lang.Object o) |
ListTerm |
insert(Term t) |
ListTerm |
intersection(ListTerm lt) |
boolean |
isArithExpr() |
boolean |
isAtom() |
boolean |
isCyclicTerm() |
boolean |
isEmpty() |
boolean |
isEnd() |
boolean |
isGround() |
boolean |
isInternalAction() |
boolean |
isList() |
boolean |
isLiteral() |
boolean |
isNumeric() |
boolean |
isPlanBody() |
boolean |
isPred() |
boolean |
isRule() |
boolean |
isString() |
boolean |
isStructure() |
boolean |
isTail() |
boolean |
isUnnamedVar() |
boolean |
isVar() |
java.util.Iterator<Term> |
iterator() |
int |
lastIndexOf(java.lang.Object o) |
java.util.ListIterator<Term> |
listIterator() |
java.util.ListIterator<Term> |
listIterator(int index) |
java.util.Iterator<ListTerm> |
listTermIterator() |
java.util.Iterator<Unifier> |
logicalConsequence(Agent ag,
Unifier un)
logicalConsequence checks whether one particular predicate
is a logical consequence of the belief base.
|
static VarTerm |
parseVar(java.lang.String sVar)
Deprecated.
prefer ASSyntax.parseVar(...)
|
Term |
remove(int index) |
boolean |
remove(java.lang.Object o) |
boolean |
removeAll(java.util.Collection c) |
Term |
removeLast() |
boolean |
retainAll(java.util.Collection c) |
ListTerm |
reverse() |
Term |
set(int index,
Term o) |
void |
setNext(Term t) |
void |
setTail(VarTerm v) |
void |
setTerm(int i,
Term t) |
void |
setTerm(Term t) |
Literal |
setTerms(java.util.List<Term> l)
set all terms of the literal and return this
|
int |
size() |
double |
solve()
returns the numeric value of the term
|
java.util.List<Term> |
subList(int arg0,
int arg1) |
java.util.Iterator<java.util.List<Term>> |
subSets(int k)
returns all subsets that take k elements of this list
|
boolean |
subsumes(Term t) |
java.lang.Object[] |
toArray() |
java.lang.Object[] |
toArray(java.lang.Object[] arg0) |
ListTerm |
union(ListTerm lt) |
getErrorMsg, getPredicateIndicator, negated, setNegated
addAnnot, addAnnots, addAnnots, addSource, clearAnnots, createSource, delAnnot, delAnnots, delSource, delSources, equalsAsStructure, getAnnot, getAnnots, getAnnots, getSources, hasAnnot, hasAnnot, hasSource, hasSource, hasSubsetAnnot, hasSubsetAnnot, importAnnots, makeVarsAnnon, parsePred, setAnnots, toStringAsTerm
addTerms, delTerm, getSingletonVars, getTermsSize, hasTerm, isUnary, makeTermsAnnon, makeVarsAnnon, parse, toString, varToReplace
getFunctor, getNS
copy, forceFullLiteralImpl, getAsListOfTerms, getTermsArray, newFromListOfTerms, parseLiteral
getCyclicVar, getSrcInfo, hashCode, resetHashCodeCache, setSrcInfo
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getCyclicVar, getSrcInfo, setSrcInfo
private static final long serialVersionUID
private static java.util.logging.Logger logger
public VarTerm(java.lang.String s)
public VarTerm(Atom namespace, java.lang.String functor)
public static VarTerm parseVar(java.lang.String sVar)
public Term capply(Unifier u)
Term
capply
in interface Term
capply
in class LiteralImpl
public Term clone()
Structure
clone
in interface Term
clone
in class LiteralImpl
public Literal cloneNS(Atom newNameSpace)
Term
cloneNS
in interface Term
cloneNS
in class LiteralImpl
public boolean isVar()
isVar
in interface Term
isVar
in class DefaultTerm
public boolean isUnnamedVar()
isUnnamedVar
in interface Term
isUnnamedVar
in class DefaultTerm
public boolean isGround()
public boolean equals(java.lang.Object t)
protected int calcHashCode()
calcHashCode
in class LiteralImpl
public int compareTo(Term t)
compareTo
in interface java.lang.Comparable<Term>
compareTo
in class LiteralImpl
public boolean subsumes(Term t)
public java.util.Iterator<Unifier> logicalConsequence(Agent ag, Unifier un)
Literal
logicalConsequence
in interface LogicalFormula
logicalConsequence
in class Literal
public Term getTerm(int i)
Literal
public int getArity()
Literal
public java.util.List<Term> getTerms()
Literal
public Literal setTerms(java.util.List<Term> l)
Literal
public Literal addTerms(java.util.List<Term> l)
Literal
public boolean isInternalAction()
isInternalAction
in interface Term
isInternalAction
in class DefaultTerm
public boolean isList()
isList
in interface Term
isList
in class DefaultTerm
public boolean isString()
isString
in interface Term
isString
in class DefaultTerm
public boolean isPlanBody()
isPlanBody
in interface Term
isPlanBody
in class DefaultTerm
public boolean isNumeric()
isNumeric
in interface Term
isNumeric
in class DefaultTerm
public boolean isPred()
public boolean isLiteral()
public boolean isStructure()
isStructure
in interface Term
isStructure
in class Structure
public boolean isAtom()
isAtom
in interface Term
isAtom
in class LiteralImpl
public boolean isRule()
isRule
in interface Term
isRule
in class DefaultTerm
public boolean isArithExpr()
isArithExpr
in interface Term
isArithExpr
in class DefaultTerm
public boolean isCyclicTerm()
isCyclicTerm
in interface Term
isCyclicTerm
in class DefaultTerm
public void countVars(java.util.Map<VarTerm,java.lang.Integer> c)
public boolean canBeAddedInBB()
LiteralImpl
canBeAddedInBB
in class LiteralImpl
public double solve() throws NoValueException
NumberTerm
solve
in interface NumberTerm
NoValueException
public boolean add(Term o)
public boolean addAll(java.util.Collection c)
public boolean addAll(int index, java.util.Collection c)
addAll
in interface java.util.List<Term>
public void clear()
public boolean contains(java.lang.Object o)
public boolean containsAll(java.util.Collection c)
public int indexOf(java.lang.Object o)
indexOf
in interface java.util.List<Term>
public int lastIndexOf(java.lang.Object o)
lastIndexOf
in interface java.util.List<Term>
public java.util.Iterator<Term> iterator()
public java.util.ListIterator<Term> listIterator()
listIterator
in interface java.util.List<Term>
public java.util.ListIterator<Term> listIterator(int index)
listIterator
in interface java.util.List<Term>
public boolean remove(java.lang.Object o)
public boolean removeAll(java.util.Collection c)
public boolean retainAll(java.util.Collection c)
public java.util.List<Term> subList(int arg0, int arg1)
subList
in interface java.util.List<Term>
public java.util.Iterator<java.util.List<Term>> subSets(int k)
ListTerm
public java.lang.Object[] toArray()
public java.lang.Object[] toArray(java.lang.Object[] arg0)
public ListTerm intersection(ListTerm lt)
intersection
in interface ListTerm
public ListTerm difference(ListTerm lt)
difference
in interface ListTerm
public ListTerm getPenultimate()
getPenultimate
in interface ListTerm
public Term removeLast()
removeLast
in interface ListTerm
public boolean isEmpty()
public java.util.Iterator<ListTerm> listTermIterator()
listTermIterator
in interface ListTerm
public int size()
public ListTerm cloneLTShallow()
ListTerm
cloneLTShallow
in interface ListTerm
public org.w3c.dom.Element getAsDOM(org.w3c.dom.Document document)
getAsDOM
in interface ToDOM
getAsDOM
in class LiteralImpl