|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectgnu.lists.AbstractSequence
gnu.lists.ExtSequence
gnu.lists.LList
gnu.lists.Pair
public class Pair
A "pair" object, as used in Lisp-like languages. When used to implement a list, the 'car' field contains an element's value, and the 'cdr' field points to either the next Pair or LList.Empty (which represents the end of the list). (The names "car" and "cdr" [pronounced "coulder"] are historical; better names might be "value" and "next".) While a Pair is normally usued to implement a linked list, sometimes the 'cdr' field ponus to some other non-list object; this is traditionally callled a "dotted list".
| Field Summary | |
|---|---|
java.lang.Object |
car
|
java.lang.Object |
cdr
|
| Fields inherited from class gnu.lists.LList |
|---|
Empty |
| Fields inherited from interface gnu.lists.Sequence |
|---|
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 Summary | |
|---|---|
Pair()
|
|
Pair(java.lang.Object carval,
java.lang.Object cdrval)
|
|
| Method Summary | |
|---|---|
int |
compareTo(java.lang.Object obj)
|
static int |
compareTo(Pair pair1,
Pair pair2)
|
boolean |
equals(java.lang.Object obj)
|
static boolean |
equals(Pair pair1,
Pair pair2)
|
java.lang.Object |
get(int index)
See java.util.List. |
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. |
Pair |
lastPair()
|
int |
length()
|
static Pair |
make(java.lang.Object car,
java.lang.Object cdr)
|
int |
nextPos(int ipos)
Return the next position following the argument. |
void |
readExternal(java.io.ObjectInput in)
|
java.lang.Object |
readResolve()
Needed to override readResolve in LList. |
int |
size()
See java.util.List. |
java.lang.Object[] |
toArray()
|
java.lang.Object[] |
toArray(java.lang.Object[] arr)
|
void |
writeExternal(java.io.ObjectOutput out)
|
| Methods inherited from class gnu.lists.LList |
|---|
chain1, chain4, checkNonList, consume, consX, createPos, createRelativePos, getIterator, length, list1, list2, list3, list4, listLength, listTail, makeList, makeList, makeList, reverseInPlace, setPosNext, setPosPrevious, toString |
| Methods inherited from class gnu.lists.ExtSequence |
|---|
copyPos, isAfterPos, nextIndex, releasePos |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface gnu.lists.Sequence |
|---|
elements, fill, set |
| Methods inherited from interface java.util.List |
|---|
add, add, addAll, addAll, clear, contains, containsAll, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, subList |
| Field Detail |
|---|
public java.lang.Object car
public java.lang.Object cdr
| Constructor Detail |
|---|
public Pair(java.lang.Object carval,
java.lang.Object cdrval)
public Pair()
| Method Detail |
|---|
public int size()
AbstractSequence
size in interface Sequencesize in interface java.util.Collectionsize in interface java.util.Listsize in class LListpublic boolean isEmpty()
Sequence
isEmpty in interface SequenceisEmpty in interface java.util.CollectionisEmpty in interface java.util.ListisEmpty in class LListpublic int length()
public boolean hasNext(int ipos)
hasNext in class LListpublic int nextPos(int ipos)
AbstractSequence
nextPos in class LListpublic java.lang.Object getPosNext(int ipos)
AbstractSequence
getPosNext in class LListipos - the specified position.
public java.lang.Object getPosPrevious(int ipos)
AbstractSequence
getPosPrevious in class LListipos - the specified position.
public final Pair lastPair()
public int hashCode()
hashCode in interface java.util.CollectionhashCode in interface java.util.ListhashCode in class AbstractSequence
public static boolean equals(Pair pair1,
Pair pair2)
public static int compareTo(Pair pair1,
Pair pair2)
public int compareTo(java.lang.Object obj)
compareTo in interface java.lang.ComparablecompareTo in class LListpublic java.lang.Object get(int index)
AbstractSequence
get in interface Sequenceget in interface java.util.Listget in class LListpublic boolean equals(java.lang.Object obj)
equals in interface java.util.Collectionequals in interface java.util.Listequals in class LList
public static Pair make(java.lang.Object car,
java.lang.Object cdr)
public java.lang.Object[] toArray()
toArray in interface java.util.CollectiontoArray in interface java.util.ListtoArray in class AbstractSequencepublic java.lang.Object[] toArray(java.lang.Object[] arr)
toArray in interface java.util.CollectiontoArray in interface java.util.ListtoArray in class AbstractSequence
public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
writeExternal in interface java.io.ExternalizablewriteExternal in class LListjava.io.IOException
public void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
readExternal in interface java.io.ExternalizablereadExternal in class LListjava.io.IOException
java.lang.ClassNotFoundException
public java.lang.Object readResolve()
throws java.io.ObjectStreamException
readResolve in class LListjava.io.ObjectStreamException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||