public class LList extends ExtSequence<java.lang.Object> implements Sequence<java.lang.Object>, java.io.Externalizable, java.lang.Comparable
Modifier and Type | Field and Description |
---|---|
static EmptyList |
Empty |
noInts
ATTRIBUTE_VALUE, BOOLEAN_VALUE, CDATA_VALUE, CHAR_VALUE, COMMENT_VALUE, DOCUMENT_VALUE, DOUBLE_VALUE, ELEMENT_VALUE, EOF_VALUE, eofValue, FLOAT_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 and Description |
---|
LList()
Do not use - only public for serialization!
|
Modifier and Type | Method and Description |
---|---|
int |
boundedHash(int seed,
int limit)
Calculate a hash code for this object.
|
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) |
static java.lang.Object |
consX(java.lang.Object[] args)
SRFI-1's cons* and Common Lisp's list* function.
|
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.
|
int |
hashCode() |
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 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) |
copyPos, isAfterPos, nextIndex, releasePos
add, add, addAll, addAll, addPos, asImmutable, badRank, checkCanWrite, checkRank, clear, compare, compare, compare, consume, consumeNext, consumePosRange, contains, containsAll, effectiveIndex, effectiveIndex, effectiveIndex, effectiveIndex, effectiveIndex, elements, endPos, equals, fill, fill, fillPosRange, firstAttributePos, firstChildPos, firstChildPos, fromEndIndex, get, get, get, get, getAttribute, getAttributeLength, getBooleanRaw, getByteRaw, getCharRaw, getContainingSequenceSize, getDoubleRaw, getElementKind, getFloatRaw, getIndexDifference, getInt, getInt, getInt, getInt, getInt, getIntRaw, getIterator, getIteratorAtPos, getLongRaw, getLowBound, getNextKind, getNextTypeName, getNextTypeObject, getRaw, getRowMajor, getShortRaw, getSize, getSize, gotoAttributesStart, gotoChildrenStart, gotoParent, hasPrevious, indexOf, iterator, lastIndexOf, listIterator, listIterator, nextIndex, nextMatching, parentPos, previousPos, rank, remove, remove, removeAll, removePos, removePosRange, retainAll, set, set, setAt, setBuffer, setRaw, stableCompare, startPos, subList, subSequence, subSequencePos, toArray, toArray, toString, unsupported, unsupportedException
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
public static final EmptyList Empty
public static int listLength(java.lang.Object obj, boolean allowOtherSequence)
obj
- the putative list to measureallowOtherSequence
- if a non-List Sequence is seen, allow thatpublic boolean equals(java.lang.Object obj)
equals
in interface java.util.Collection<java.lang.Object>
equals
in interface java.util.List<java.lang.Object>
equals
in class AbstractSequence<java.lang.Object>
public int compareTo(java.lang.Object obj)
compareTo
in interface java.lang.Comparable
public int size()
Sequence
size
in interface Sequence<java.lang.Object>
size
in interface java.util.Collection<java.lang.Object>
size
in interface java.util.List<java.lang.Object>
size
in class AbstractSequence<java.lang.Object>
public boolean isEmpty()
Sequence
isEmpty
in interface Sequence<java.lang.Object>
isEmpty
in interface java.util.Collection<java.lang.Object>
isEmpty
in interface java.util.List<java.lang.Object>
isEmpty
in class AbstractSequence<java.lang.Object>
public SeqPosition getIterator(int index)
getIterator
in class AbstractSequence<java.lang.Object>
public int createPos(int index, boolean isAfter)
AbstractSequence
createPos
in class AbstractSequence<java.lang.Object>
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<java.lang.Object>
public boolean hasNext(int ipos)
hasNext
in class AbstractSequence<java.lang.Object>
public int nextPos(int ipos)
AbstractSequence
nextPos
in class AbstractSequence<java.lang.Object>
public java.lang.Object getPosNext(int ipos)
AbstractSequence
getPosNext
in class AbstractSequence<java.lang.Object>
ipos
- the specified position.public java.lang.Object getPosPrevious(int ipos)
AbstractSequence
getPosPrevious
in class AbstractSequence<java.lang.Object>
ipos
- the specified position.protected void setPosNext(int ipos, java.lang.Object value)
setPosNext
in class AbstractSequence<java.lang.Object>
protected void setPosPrevious(int ipos, java.lang.Object value)
setPosPrevious
in class AbstractSequence<java.lang.Object>
public java.lang.Object get(int index)
Sequence
get
in interface Sequence<java.lang.Object>
get
in interface java.util.List<java.lang.Object>
get
in class AbstractSequence<java.lang.Object>
public static final int length(java.lang.Object arg)
public int boundedHash(int seed, int limit)
BoundedHashable
boundedHash
in interface BoundedHashable
boundedHash
in class AbstractSequence<java.lang.Object>
seed
- The seed is an initial value, or the accumulated
hash code from previous elements in a containing object.
Using zero as the seed is fine.limit
- A limit on the number of sub-elements whose hash we
should calculate. This guards against cycles. Any recursive calls
should be done with a smaller value of limit, and no recursive
calls must be done when the limit is zero.Object#hashCode
.public int hashCode()
hashCode
in interface java.util.Collection<java.lang.Object>
hashCode
in interface java.util.List<java.lang.Object>
hashCode
in class AbstractSequence<java.lang.Object>
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<java.lang.Object>
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 consX(java.lang.Object[] args)
public java.lang.String toString()
toString
in class AbstractSequence<java.lang.Object>
public static java.lang.Object checkNonList(java.lang.Object rest)