|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object gnu.lists.AbstractSequence gnu.lists.ExtSequence gnu.lists.LList
public class LList
Semi-abstract class for traditions Lisp-style lists. A list is implemented as a chain of Pair objects, where the 'car' field of the Pair points to a data element, and the 'cdr' field points to the next Pair. (The names 'car' and 'cdr' are historical; they refer to hardware on machines form the 60's.) Includes singleton static Empty, and the Pair sub-class.
Field Summary | |
---|---|
static LList |
Empty
|
Fields inherited from interface gnu.lists.Sequence |
---|
ATTRIBUTE_VALUE, BOOLEAN_VALUE, CDATA_VALUE, CHAR_VALUE, COMMENT_VALUE, DOCUMENT_VALUE, DOUBLE_VALUE, EOF_VALUE, eofValue, FLOAT_VALUE, GROUP_VALUE, INT_S16_VALUE, INT_S32_VALUE, INT_S64_VALUE, INT_S8_VALUE, INT_U16_VALUE, INT_U32_VALUE, INT_U64_VALUE, INT_U8_VALUE, OBJECT_VALUE, PRIM_VALUE, PROCESSING_INSTRUCTION_VALUE, TEXT_BYTE_VALUE |
Constructor Summary | |
---|---|
LList()
Do not use - only public for serialization! |
Method Summary | |
---|---|
static Pair |
chain1(Pair old,
java.lang.Object arg1)
Utility function used by compiler when inlining `list'. |
static Pair |
chain4(Pair old,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3,
java.lang.Object arg4)
Utility function used by compiler when inlining `list'. |
static java.lang.Object |
checkNonList(java.lang.Object rest)
Helper to protect against pathological LLists (neithr Pair nor Empty). |
int |
compareTo(java.lang.Object obj)
|
void |
consume(Consumer out)
|
int |
createPos(int index,
boolean isAfter)
Generate a position at a given index. |
int |
createRelativePos(int pos,
int delta,
boolean isAfter)
|
boolean |
equals(java.lang.Object obj)
|
java.lang.Object |
get(int index)
See java.util.List. |
SeqPosition |
getIterator(int index)
|
java.lang.Object |
getPosNext(int ipos)
Get the element following the specified position. |
java.lang.Object |
getPosPrevious(int ipos)
Get the element before the specified position. |
boolean |
hasNext(int ipos)
|
boolean |
isEmpty()
True is this sequence contains no elements. |
static int |
length(java.lang.Object arg)
|
static Pair |
list1(java.lang.Object arg1)
|
static Pair |
list2(java.lang.Object arg1,
java.lang.Object arg2)
|
static Pair |
list3(java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3)
|
static Pair |
list4(java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3,
java.lang.Object arg4)
|
static int |
listLength(java.lang.Object obj,
boolean allowOtherSequence)
A safe function to count the length of a list. |
static java.lang.Object |
listTail(java.lang.Object list,
int count)
|
static LList |
makeList(java.util.List vals)
|
static LList |
makeList(java.lang.Object[] vals,
int offset)
|
static LList |
makeList(java.lang.Object[] vals,
int offset,
int length)
|
int |
nextPos(int ipos)
Return the next position following the argument. |
void |
readExternal(java.io.ObjectInput in)
|
java.lang.Object |
readResolve()
|
static LList |
reverseInPlace(java.lang.Object list)
Reverse a list in place, by modifying the cdr fields. |
protected void |
setPosNext(int ipos,
java.lang.Object value)
|
protected void |
setPosPrevious(int ipos,
java.lang.Object value)
|
int |
size()
See java.util.List. |
java.lang.String |
toString()
|
void |
writeExternal(java.io.ObjectOutput out)
|
Methods inherited from class gnu.lists.ExtSequence |
---|
copyPos, isAfterPos, nextIndex, releasePos |
Methods inherited from class gnu.lists.AbstractSequence |
---|
add, add, addAll, addAll, addPos, append, append, append, baseUriOfPos, clear, compare, compare, compare, consumeNext, consumePosRange, contains, containsAll, elements, endPos, equals, fill, fill, fillPosRange, firstAttributePos, firstChildPos, fromEndIndex, get, getAttribute, getAttributeLength, getContainingSequenceSize, getEffectiveIndex, getIndexDifference, getIterator, getIteratorAtPos, getLowBound, getNextKind, getNextTypeName, getNextTypeObject, getSize, gotoAttributesStart, gotoChildrenStart, gotoParent, hashCode, hasPrevious, indexOf, iterator, lastIndexOf, listIterator, listIterator, nextIndex, nextMatching, parentPos, previousPos, rank, remove, remove, removeAll, removePos, removePosRange, retainAll, set, set, stableCompare, startPos, subList, subSequence, subSequencePos, toArray, toArray, toString, unsupported |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface gnu.lists.Sequence |
---|
elements, fill |
Methods inherited from interface java.util.List |
---|
add, add, addAll, addAll, clear, contains, containsAll, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, subList, toArray, toArray |
Field Detail |
---|
public static final LList Empty
Constructor Detail |
---|
public LList()
Method Detail |
---|
public static int listLength(java.lang.Object obj, boolean allowOtherSequence)
obj
- the putative list to measureallowOtherSequence
- if a non-List Sequence is seen, allow that
public boolean equals(java.lang.Object obj)
equals
in interface java.util.Collection
equals
in interface java.util.List
equals
in class AbstractSequence
public int compareTo(java.lang.Object obj)
compareTo
in interface java.lang.Comparable
public int size()
AbstractSequence
size
in interface Sequence
size
in interface java.util.Collection
size
in interface java.util.List
size
in class AbstractSequence
public boolean isEmpty()
Sequence
isEmpty
in interface Sequence
isEmpty
in interface java.util.Collection
isEmpty
in interface java.util.List
isEmpty
in class AbstractSequence
public SeqPosition getIterator(int index)
getIterator
in class AbstractSequence
public int createPos(int index, boolean isAfter)
AbstractSequence
createPos
in class AbstractSequence
index
- offset from beginning of desired positionisAfter
- should the position have the isAfter propertypublic int createRelativePos(int pos, int delta, boolean isAfter)
createRelativePos
in class AbstractSequence
public boolean hasNext(int ipos)
hasNext
in class AbstractSequence
public int nextPos(int ipos)
AbstractSequence
nextPos
in class AbstractSequence
public java.lang.Object getPosNext(int ipos)
AbstractSequence
getPosNext
in class AbstractSequence
ipos
- the specified position.
public java.lang.Object getPosPrevious(int ipos)
AbstractSequence
getPosPrevious
in class AbstractSequence
ipos
- the specified position.
protected void setPosNext(int ipos, java.lang.Object value)
setPosNext
in class AbstractSequence
protected void setPosPrevious(int ipos, java.lang.Object value)
setPosPrevious
in class AbstractSequence
public java.lang.Object get(int index)
AbstractSequence
get
in interface Sequence
get
in interface java.util.List
get
in class AbstractSequence
public static final int length(java.lang.Object arg)
public static LList makeList(java.util.List vals)
public static LList makeList(java.lang.Object[] vals, int offset, int length)
public static LList makeList(java.lang.Object[] vals, int offset)
public void consume(Consumer out)
consume
in interface Consumable
consume
in class AbstractSequence
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
java.io.IOException
java.lang.ClassNotFoundException
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
java.io.IOException
public java.lang.Object readResolve() throws java.io.ObjectStreamException
java.io.ObjectStreamException
public static Pair list1(java.lang.Object arg1)
public static Pair list2(java.lang.Object arg1, java.lang.Object arg2)
public static Pair list3(java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)
public static Pair list4(java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, java.lang.Object arg4)
public static Pair chain1(Pair old, java.lang.Object arg1)
public static Pair chain4(Pair old, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, java.lang.Object arg4)
public static LList reverseInPlace(java.lang.Object list)
public static java.lang.Object listTail(java.lang.Object list, int count)
public java.lang.String toString()
toString
in class AbstractSequence
public static java.lang.Object checkNonList(java.lang.Object rest)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |