gnu.lists
Class LList
public
class
LList
extends ExtSequence
implements Sequence, Externalizable, Comparable
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.
| Method Summary |
| static Pair | chain1(Pair old, Object arg1) Utility function used by compiler when inlining `list'. |
| static Pair | chain4(Pair old, Object arg1, Object arg2, Object arg3, Object arg4) Utility function used by compiler when inlining `list'. |
| static Object | checkNonList(Object rest) Helper to protect against pathological LLists (neithr Pair nor Empty). |
| int | compareTo(Object obj) |
| void | consume(Consumer out) |
| static Object | consX(Object[] args) SRFI-1's cons* and Common Lisp's list* function. |
| int | createPos(int index, boolean isAfter) |
| int | createRelativePos(int pos, int delta, boolean isAfter) |
| boolean | equals(Object obj) |
| Object | get(int index) |
| SeqPosition | getIterator(int index) |
| Object | getPosNext(int ipos) |
| Object | getPosPrevious(int ipos) |
| boolean | hasNext(int ipos) |
| boolean | isEmpty() |
| static int | length(Object arg) |
| static Pair | list1(Object arg1) |
| static Pair | list2(Object arg1, Object arg2) |
| static Pair | list3(Object arg1, Object arg2, Object arg3) |
| static Pair | list4(Object arg1, Object arg2, Object arg3, Object arg4) |
| static int | listLength(Object obj, boolean allowOtherSequence)
A safe function to count the length of a list. |
| static Object | listTail(Object list, int count) |
| static LList | makeList(List vals) |
| static LList | makeList(Object[] vals, int offset, int length) |
| static LList | makeList(Object[] vals, int offset) |
| int | nextPos(int ipos) |
| void | readExternal(ObjectInput in) |
| Object | readResolve() |
| static LList | reverseInPlace(Object list) Reverse a list in place, by modifying the cdr fields. |
| protected void | setPosNext(int ipos, Object value) |
| protected void | setPosPrevious(int ipos, Object value) |
| int | size() |
| String | toString() |
| void | writeExternal(ObjectOutput out) |
public static final
LList Empty
public LList()
Do not use - only public for serialization!
public static
Pair chain1(
Pair old, Object arg1)
Utility function used by compiler when inlining `list'.
public static
Pair chain4(
Pair old, Object arg1, Object arg2, Object arg3, Object arg4)
Utility function used by compiler when inlining `list'.
public static Object checkNonList(Object rest)
Helper to protect against pathological LLists (neithr Pair nor Empty).
public int compareTo(Object obj)
public static Object consX(Object[] args)
SRFI-1's cons* and Common Lisp's list* function.
public int createPos(int index, boolean isAfter)
public int createRelativePos(int pos, int delta, boolean isAfter)
public boolean equals(Object obj)
public Object get(int index)
public Object getPosNext(int ipos)
public Object getPosPrevious(int ipos)
public boolean hasNext(int ipos)
public boolean isEmpty()
public static final int length(Object arg)
public static
Pair list1(Object arg1)
public static
Pair list2(Object arg1, Object arg2)
public static
Pair list3(Object arg1, Object arg2, Object arg3)
public static
Pair list4(Object arg1, Object arg2, Object arg3, Object arg4)
public static int listLength(Object obj, boolean allowOtherSequence)
A safe function to count the length of a list.
Parameters: obj the putative list to measure allowOtherSequence if a non-List Sequence is seen, allow that
Returns: the length, or -1 for a circular list, or -2 for an improper list
public static Object listTail(Object list, int count)
public static
LList makeList(List vals)
public static
LList makeList(Object[] vals, int offset, int length)
public static
LList makeList(Object[] vals, int offset)
public int nextPos(int ipos)
public void readExternal(ObjectInput in)
public Object readResolve()
public static
LList reverseInPlace(Object list)
Reverse a list in place, by modifying the cdr fields.
protected void setPosNext(int ipos, Object value)
protected void setPosPrevious(int ipos, Object value)
public int size()
public String toString()
public void writeExternal(ObjectOutput out)
Serial Data: Write nothing.
(Don't need to write anything.)