Package jason.asSyntax
Class ListTermImpl
java.lang.Object
jason.asSyntax.DefaultTerm
jason.asSyntax.Literal
jason.asSyntax.Atom
jason.asSyntax.Structure
jason.asSyntax.ListTermImpl
- All Implemented Interfaces:
ListTerm,LogicalFormula,Term,ToDOM,ToJson,Serializable,Cloneable,Comparable<Term>,Iterable<Term>,Collection<Term>,List<Term>,SequencedCollection<Term>
Represents a list node as in prolog .(t1,.(t2,.(t3,.))).
Each nth-ListTerm has both a term and the next ListTerm.
The last ListTem is an empty ListTerm (term==null).
In lists terms with a tail ([a|X]), next is the Tail (next==X, term==a).
- See Also:
-
Field Summary
FieldsFields inherited from class jason.asSyntax.Structure
emptyTermArray, emptyTermListFields inherited from class jason.asSyntax.Literal
DefaultNS, LFalse, LNeg, LPos, LTrue, predicateIndicatorCacheFields inherited from class jason.asSyntax.DefaultTerm
hashCodeCache, srcInfoFields inherited from interface jason.asSyntax.ListTerm
EMPTY_LIST -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanbooleanaddAll(int index, Collection c) booleanaddAll(Collection c) voidAdds a term in the end of the listintmake a hard copy of the termsvoidclear()clone()make a hard copy of the termscloneLT()make a hard copy of the termsmake a shallow copy of the list (terms are not cloned, only the structure)intAdds a list in the end of this list.booleanbooleandifference(ListTerm lt) returns a new (cloned) list representing the set resulting of the difference of this list and lt.booleanget(int index) intgetArity()returns the number of terms of this literalget as XMLjavax.json.JsonValueReturns this ListTerm as a Java List (implemented by ArrayList).getLast()get the last ListTerm of this ListgetNext()getTail()returns this ListTerm's tail element in case the List has the Tail, otherwise, returns nullgetTerm()gets the term of this ListTermgetTerm(int i) returns the i-th term (first term is 0)getTerms()return the this ListTerm elements (0=Term, 1=ListTerm)intinsert a term in the begin of this listintersection(ListTerm lt) returns a new (cloned) list representing the set resulting of the intersection of this list and lt.booleanisAtom()booleanisEmpty()booleanisEnd()booleanisGround()booleanisList()booleanbooleanisTail()iterator()returns an iterator where each element is a Term of this list, the tail of the list is not considered.intlastIndexOf(Object arg0) listIterator(int startIndex) gives an iterator that includes the final empty list or tail, for [a,b,c] returns [a,b,c]; [b,c]; [c]; and [].logicalConsequence(Agent ag, Unifier un) logicalConsequence checks whether one particular predicate is a logical consequence of the belief base.static ListTermremove(int index) booleanbooleanbooleanreverse()Creates a new (cloned) list with the same elements of this list, but in the reversed order.voidvoidset the tail of this listvoidvoidprotected voidintsize()subList(int arg0, int arg1) subSets(int k) returns all subsets that take k elements of this listObject[]toArray()<T> T[]toArray(T[] a) toString()returns a new (cloned) list representing the set resulting of the union of this list and lt.Methods inherited from class jason.asSyntax.Structure
addTerms, addTerms, cloneNS, countVars, delTerm, getSingletonVars, getTermsSize, hasTerm, hasVar, isStructure, isUnary, makeTermsAnnon, makeVarsAnnon, makeVarsAnnon, parse, setTerms, subsumes, varToReplaceMethods inherited from class jason.asSyntax.Atom
getFunctor, getNSMethods inherited from class jason.asSyntax.Literal
addAnnot, addAnnots, addAnnots, addSource, addSourceInfoAsAnnots, canBeAddedInBB, clearAnnots, copy, delAnnot, delAnnots, delAnnots, delSource, delSources, equalsAsStructure, forceFullLiteralImpl, getAnnot, getAnnots, getAnnots, getAsListOfTerms, getPredicateIndicator, getSources, getTermsArray, hasAnnot, hasAnnot, hasSource, hasSource, hasSubsetAnnot, hasSubsetAnnot, importAnnots, negated, newFromListOfTerms, newFunctor, noSource, parseLiteral, setAnnots, setNegated, subjectToBUFMethods inherited from class jason.asSyntax.DefaultTerm
getCyclicVar, getErrorMsg, getSrcInfo, hashCode, isArithExpr, isCyclicTerm, isInternalAction, isMap, isNumeric, isPlanBody, isPred, isRule, isSet, isString, isUnnamedVar, isVar, resetHashCodeCache, setSrcInfoMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
addFirst, addLast, getFirst, hashCode, removeFirst, replaceAll, reversed, sort, spliteratorMethods inherited from interface jason.asSyntax.Term
cloneNS, countVars, getCyclicVar, getSrcInfo, hasVar, isArithExpr, isCyclicTerm, isInternalAction, isMap, isNumeric, isPlanBody, isPred, isRule, isSet, isString, isStructure, isUnnamedVar, isVar, setSrcInfo, subsumesMethods inherited from interface jason.util.ToJson
getAsJsonStr
-
Field Details
-
LIST_FUNCTOR
- See Also:
-
-
Constructor Details
-
ListTermImpl
public ListTermImpl()
-
-
Method Details
-
parseList
-
clone
make a hard copy of the terms -
cloneLT
make a hard copy of the terms -
capply
make a hard copy of the terms -
cloneLTShallow
make a shallow copy of the list (terms are not cloned, only the structure)- Specified by:
cloneLTShallowin interfaceListTerm
-
equals
-
calcHashCode
public int calcHashCode()- Overrides:
calcHashCodein classStructure
-
compareTo
- Specified by:
compareToin interfaceComparable<Term>- Overrides:
compareToin classAtom
-
setTerm
-
getTerm
gets the term of this ListTerm -
setNext
-
getNext
-
getArity
public int getArity()Description copied from class:Literalreturns the number of terms of this literal -
getTerm
Description copied from class:Literalreturns the i-th term (first term is 0) -
setTerm
-
getTerms
return the this ListTerm elements (0=Term, 1=ListTerm) -
addTerm
-
size
public int size() -
isAtom
public boolean isAtom() -
isList
public boolean isList()- Specified by:
isListin interfaceTerm- Overrides:
isListin classDefaultTerm
-
isLiteral
public boolean isLiteral() -
isEmpty
public boolean isEmpty() -
isEnd
public boolean isEnd() -
isGround
public boolean isGround() -
logicalConsequence
Description copied from class:LiterallogicalConsequence checks whether one particular predicate is a logical consequence of the belief base. Returns an iterator for all unifiers that are logCons.- Specified by:
logicalConsequencein interfaceLogicalFormula- Overrides:
logicalConsequencein classLiteral
-
isTail
public boolean isTail() -
getTail
returns this ListTerm's tail element in case the List has the Tail, otherwise, returns null -
setTail
set the tail of this list -
getLast
get the last ListTerm of this List -
getPenultimate
- Specified by:
getPenultimatein interfaceListTerm
-
removeLast
- Specified by:
removeLastin interfaceList<Term>- Specified by:
removeLastin interfaceListTerm- Specified by:
removeLastin interfaceSequencedCollection<Term>
-
append
Adds a term in the end of the list -
insert
insert a term in the begin of this list -
concat
Adds a list in the end of this list. This method do not clone lt. -
reverse
Creates a new (cloned) list with the same elements of this list, but in the reversed order. The Tail remains the Tail: reverse([a,b|T]) = [b,a|T]. -
union
returns a new (cloned) list representing the set resulting of the union of this list and lt. -
intersection
returns a new (cloned) list representing the set resulting of the intersection of this list and lt.- Specified by:
intersectionin interfaceListTerm
-
difference
returns a new (cloned) list representing the set resulting of the difference of this list and lt.- Specified by:
differencein interfaceListTerm
-
subSets
returns all subsets that take k elements of this list -
listTermIterator
gives an iterator that includes the final empty list or tail, for [a,b,c] returns [a,b,c]; [b,c]; [c]; and []. for [a,b|T] returns [a,b|T]; [b|T]; [b|T]; and T.- Specified by:
listTermIteratorin interfaceListTerm
-
iterator
returns an iterator where each element is a Term of this list, the tail of the list is not considered. for [a,b,c] returns 'a', 'b', and 'c'. for [a,b|T] returns 'a' and 'b'. -
getAsList
Returns this ListTerm as a Java List (implemented by ArrayList). Note: the tail of the list, if any, is not included! -
toString
-
add
-
add
-
addAll
-
addAll
-
clear
public void clear() -
contains
-
containsAll
- Specified by:
containsAllin interfaceCollection<Term>- Specified by:
containsAllin interfaceList<Term>
-
get
-
indexOf
-
lastIndexOf
- Specified by:
lastIndexOfin interfaceList<Term>
-
listIterator
- Specified by:
listIteratorin interfaceList<Term>
-
listIterator
- Specified by:
listIteratorin interfaceList<Term>
-
setValuesFrom
-
remove
-
remove
-
removeAll
-
retainAll
-
set
-
subList
-
toArray
-
toArray
public <T> T[] toArray(T[] a) -
getAsDOM
Description copied from class:Structureget as XML -
getAsJson
public javax.json.JsonValue getAsJson()
-