Package jason.asSyntax
Class VarTerm
java.lang.Object
- All Implemented Interfaces:
ListTerm
,LogicalFormula
,NumberTerm
,Term
,ToDOM
,ToJson
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable<Term>
,java.lang.Iterable<Term>
,java.util.Collection<Term>
,java.util.List<Term>
- Direct Known Subclasses:
UnnamedVar
public class VarTerm extends LiteralImpl implements NumberTerm, ListTerm
Represents a variable Term: like X (starts with upper case). It may have a
value, after
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, ...- Author:
- jomi
- 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 static java.util.logging.Logger
logger
private static long
serialVersionUID
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
Fields inherited from interface jason.asSyntax.ListTerm
EMPTY_LIST
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description void
add(int index, Term o)
boolean
add(Term o)
boolean
addAll(int index, java.util.Collection c)
boolean
addAll(java.util.Collection c)
void
addTerm(Term t)
Literal
addTerms(java.util.List<Term> l)
adds some terms and return thisListTerm
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 termsListTerm
cloneLT()
clone the list termListTerm
cloneLTShallow()
make a shallow copy of the list (terms are not cloned, only the structure)Literal
cloneNS(Atom newNameSpace)
clone in another namespaceint
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 literalorg.w3c.dom.Element
getAsDOM(org.w3c.dom.Document document)
get as XMLjava.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 literalboolean
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 thisint
size()
double
solve()
returns the numeric value of the termjava.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 listboolean
subsumes(Term t)
java.lang.Object[]
toArray()
java.lang.Object[]
toArray(java.lang.Object[] arg0)
ListTerm
union(ListTerm lt)
Methods inherited from class jason.asSyntax.LiteralImpl
getErrorMsg, getPredicateIndicator, negated, setNegated
Methods inherited from class jason.asSyntax.Pred
addAnnot, addAnnots, addAnnots, addSource, capplyAnnots, clearAnnots, createSource, delAnnot, delAnnots, delSource, delSources, equalsAsStructure, getAnnot, getAnnots, getAnnots, getSources, hasAnnot, hasAnnot, hasSource, hasSource, hasSubsetAnnot, hasSubsetAnnot, importAnnots, makeVarsAnnon, parsePred, setAnnots, toStringAsTerm
Methods inherited from class jason.asSyntax.Structure
addTerms, delTerm, getSingletonVars, getTermsSize, hasTerm, isUnary, makeTermsAnnon, makeVarsAnnon, parse, toString, varToReplace
Methods inherited from class jason.asSyntax.Atom
getFunctor, getNS
Methods inherited from class jason.asSyntax.Literal
addSourceInfoAsAnnots, copy, delAnnots, forceFullLiteralImpl, getAsJson, getAsListOfTerms, getTermsArray, newFromListOfTerms, newFunctor, noSource, parseLiteral, subjectToBUF
Methods inherited from class jason.asSyntax.DefaultTerm
getCyclicVar, getSrcInfo, hashCode, isMap, isSet, resetHashCodeCache, setSrcInfo
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.lang.Iterable
forEach
Methods inherited from interface java.util.List
hashCode, replaceAll, sort, spliterator
Methods inherited from interface jason.asSyntax.Term
getCyclicVar, getSrcInfo, isMap, isSet, setSrcInfo
Methods inherited from interface jason.util.ToJson
getAsJson, getAsJsonStr
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
- Constant Field Values
-
logger
private static java.util.logging.Logger logger
-
-
Constructor Details
-
VarTerm
public VarTerm(java.lang.String s) -
VarTerm
-
VarTerm
-
-
Method Details
-
parseVar
Deprecated.prefer ASSyntax.parseVar(...) -
capply
Description copied from interface:Term
clone and applies together (and faster than clone and then apply)- Specified by:
capply
in interfaceTerm
- Overrides:
capply
in classLiteralImpl
-
clone
Description copied from class:Structure
make a deep copy of the terms- Specified by:
clone
in interfaceTerm
- Overrides:
clone
in classLiteralImpl
-
cloneNS
Description copied from interface:Term
clone in another namespace- Specified by:
cloneNS
in interfaceTerm
- Overrides:
cloneNS
in classLiteralImpl
-
cloneLT
Description copied from interface:ListTerm
clone the list term -
isVar
public boolean isVar()- Specified by:
isVar
in interfaceTerm
- Overrides:
isVar
in classDefaultTerm
-
isUnnamedVar
public boolean isUnnamedVar()- Specified by:
isUnnamedVar
in interfaceTerm
- Overrides:
isUnnamedVar
in classDefaultTerm
-
isGround
public boolean isGround() -
equals
public boolean equals(java.lang.Object t) -
calcHashCode
protected int calcHashCode()- Overrides:
calcHashCode
in classLiteralImpl
-
compareTo
-
subsumes
-
logicalConsequence
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 interfaceLogicalFormula
- Overrides:
logicalConsequence
in classLiteral
-
getTerm
Description copied from class:Literal
returns the i-th term (first term is 0) -
addTerm
-
getArity
public int getArity()Description copied from class:Literal
returns the number of terms of this literal -
getTerms
Description copied from class:Literal
returns all terms of this literal -
setTerms
Description copied from class:Literal
set all terms of the literal and return this -
setTerm
-
addTerms
Description copied from class:Literal
adds some terms and return this -
isInternalAction
public boolean isInternalAction()- Specified by:
isInternalAction
in interfaceTerm
- Overrides:
isInternalAction
in classDefaultTerm
-
isList
public boolean isList()- Specified by:
isList
in interfaceTerm
- Overrides:
isList
in classDefaultTerm
-
isString
public boolean isString()- Specified by:
isString
in interfaceTerm
- Overrides:
isString
in classDefaultTerm
-
isPlanBody
public boolean isPlanBody()- Specified by:
isPlanBody
in interfaceTerm
- Overrides:
isPlanBody
in classDefaultTerm
-
isNumeric
public boolean isNumeric()- Specified by:
isNumeric
in interfaceTerm
- Overrides:
isNumeric
in classDefaultTerm
-
isPred
public boolean isPred() -
isLiteral
public boolean isLiteral() -
isStructure
public boolean isStructure()- Specified by:
isStructure
in interfaceTerm
- Overrides:
isStructure
in classStructure
-
isAtom
public boolean isAtom()- Specified by:
isAtom
in interfaceTerm
- Overrides:
isAtom
in classLiteralImpl
-
isRule
public boolean isRule()- Specified by:
isRule
in interfaceTerm
- Overrides:
isRule
in classDefaultTerm
-
isArithExpr
public boolean isArithExpr()- Specified by:
isArithExpr
in interfaceTerm
- Overrides:
isArithExpr
in classDefaultTerm
-
isCyclicTerm
public boolean isCyclicTerm()- Specified by:
isCyclicTerm
in interfaceTerm
- Overrides:
isCyclicTerm
in classDefaultTerm
-
hasVar
-
countVars
-
canBeAddedInBB
public boolean canBeAddedInBB()Description copied from class:LiteralImpl
to be overridden by subclasses (as internal action)- Overrides:
canBeAddedInBB
in classLiteralImpl
-
solve
Description copied from interface:NumberTerm
returns the numeric value of the term- Specified by:
solve
in interfaceNumberTerm
- Throws:
NoValueException
-
add
- Specified by:
add
in interfacejava.util.List<Term>
-
add
-
addAll
public boolean addAll(java.util.Collection c) -
addAll
public boolean addAll(int index, java.util.Collection c)- Specified by:
addAll
in interfacejava.util.List<Term>
-
clear
public void clear() -
contains
public boolean contains(java.lang.Object o) -
containsAll
public boolean containsAll(java.util.Collection c) -
get
- Specified by:
get
in interfacejava.util.List<Term>
-
indexOf
public int indexOf(java.lang.Object o)- Specified by:
indexOf
in interfacejava.util.List<Term>
-
lastIndexOf
public int lastIndexOf(java.lang.Object o)- Specified by:
lastIndexOf
in interfacejava.util.List<Term>
-
iterator
-
listIterator
- Specified by:
listIterator
in interfacejava.util.List<Term>
-
listIterator
- Specified by:
listIterator
in interfacejava.util.List<Term>
-
remove
- Specified by:
remove
in interfacejava.util.List<Term>
-
remove
public boolean remove(java.lang.Object o) -
removeAll
public boolean removeAll(java.util.Collection c) -
retainAll
public boolean retainAll(java.util.Collection c) -
set
- Specified by:
set
in interfacejava.util.List<Term>
-
subList
- Specified by:
subList
in interfacejava.util.List<Term>
-
subSets
Description copied from interface:ListTerm
returns all subsets that take k elements of this list -
toArray
public java.lang.Object[] toArray() -
toArray
public java.lang.Object[] toArray(java.lang.Object[] arg0) -
setTerm
-
setNext
-
append
-
insert
-
concat
-
reverse
-
union
-
intersection
- Specified by:
intersection
in interfaceListTerm
-
difference
- Specified by:
difference
in interfaceListTerm
-
getAsList
-
getLast
-
getPenultimate
- Specified by:
getPenultimate
in interfaceListTerm
-
removeLast
- Specified by:
removeLast
in interfaceListTerm
-
getNext
-
getTerm
-
isEmpty
public boolean isEmpty() -
isEnd
public boolean isEnd() -
isTail
public boolean isTail() -
setTail
-
getTail
-
listTermIterator
- Specified by:
listTermIterator
in interfaceListTerm
-
size
public int size() -
cloneLTShallow
Description copied from interface:ListTerm
make a shallow copy of the list (terms are not cloned, only the structure)- Specified by:
cloneLTShallow
in interfaceListTerm
-
getAsDOM
public org.w3c.dom.Element getAsDOM(org.w3c.dom.Document document)get as XML- Specified by:
getAsDOM
in interfaceToDOM
- Overrides:
getAsDOM
in classLiteralImpl
-