Public Methods | |
| OpenList | cons (Object _First) |
| Object | first () throws OpenListException |
| OpenList | rest () throws OpenListException |
| boolean | isEmpty () |
| boolean | nonEmpty () |
| OpenList | append (OpenList L2) |
| boolean | member (Object Ob) |
| OpenList | reverse () |
| int | length () |
| Object | nth (int n) throws OpenListException |
| OpenList | prefix (int n) |
| Object | second () throws OpenListException |
| Object | third () throws OpenListException |
| boolean | equals (Object Ob) |
| String | toString () |
| String | toString (String leftParen, String spacer, String rightParen) |
| String | implode () |
| Object [] | toArray () |
| OpenList | sort (java.util.Comparator comparator) |
Static Public Methods | |
| OpenList | cons (Object _First, OpenList _Rest) |
| Object | first (OpenList List) throws OpenListException |
| OpenList | rest (OpenList List) throws OpenListException |
| boolean | isEmpty (OpenList List) |
| boolean | nonEmpty (OpenList List) |
| OpenList | append (OpenList L1, OpenList L2) |
| boolean | member (Object Ob, OpenList L) |
| OpenList | reverse (OpenList L1) |
| int | length (OpenList L) |
| Object | nth (int n, OpenList L) throws OpenListException |
| OpenList | prefix (int n, OpenList L) |
| Object | second (OpenList L) throws OpenListException |
| Object | third (OpenList L) throws OpenListException |
| OpenList | list () |
| OpenList | list (Object First) |
| OpenList | list (Object First, Object Second) |
| OpenList | list (Object First, Object Second, Object Third) |
| OpenList | list (Object First, Object Second, Object Third, Object Fourth) |
| OpenList | list (Object First, Object Second, Object Third, Object Fourth, Object Fifth) |
| OpenList | list (Object First, Object Second, Object Third, Object Fourth, Object Fifth, Object Sixth) |
| OpenList | list (Object First, Object Second, Object Third, Object Fourth, Object Fifth, Object Sixth, Object Seventh) |
| boolean | equals (OpenList L1, OpenList L2) |
| OpenList | explode (String s) |
| String | implode (OpenList L) |
| Object [] | toArray (OpenList L) |
| OpenList | fromArray (Object a[]) |
| void | main (String arg[]) |
Static Public Attributes | |
| final OpenList | nil = cons(null, null) |
| String | defaultLeftParen = "[" |
| String | defaultRightParen = "]" |
| String | defaultSpacer = ", " |
| String | firstException = "first() of empty list" |
| String | restException = "rest() of empty list" |
| String | nthException = "nth of an OpenList of length " |
| String | wherePart = ", where n == " |
| String | secondException = "second of an OpenList, where length() = " |
| String | thirdException = "third of an OpenList, where length() = " |
Definition at line 16 of file OpenList.java.
|
|
Create a new list formed by elements of this list followed by those of the argument list.
Definition at line 281 of file OpenList.java. |
|
|
Create a new list formed by elements of the first argument followed by those of the second.
Definition at line 259 of file OpenList.java. |
|
|
Return a new OpenList constructed from this list and a first.
Definition at line 127 of file OpenList.java. |
|
|
Return a new OpenList constructed from its first and rest.
Definition at line 114 of file OpenList.java. Referenced by append(), explode(), fromArray(), list(), main(), prefix(), and reverse(). |
|
|
Return true if this list is equal to the argument list.
Definition at line 723 of file OpenList.java. |
|
|
Return true if the two OpenLists are equal, in the sense of having the equal elements in both listss.
Definition at line 693 of file OpenList.java. |
|
|
Explode the argument String into a list of Characters wrapping the characters of the String.
Definition at line 788 of file OpenList.java. Referenced by main(). |
|
|
Return the first of the argument, a non-empty OpenList.
Definition at line 158 of file OpenList.java. |
|
|
Return the first of this non-empty OpenList.
Definition at line 140 of file OpenList.java. Referenced by append(), equals(), implode(), member(), nth(), prefix(), reverse(), toArray(), and toString(). |
|
|
Create an OpenList from an array of Objects.
Definition at line 882 of file OpenList.java. Referenced by sort(). |
|
|
Implode this OpenList into a single String. The list can contain any Objects, not just Characters. The toString method is used to get the character representation of the object. No parentheses or spacing is added around or between the elements of the outer list.
Definition at line 836 of file OpenList.java. Referenced by main(). |
|
|
Implode the contents of an OpenList into a single String. The list can contain any Objects, not just Characters. The toString method is used to get the character representation of the object. No parentheses or spacing is added around or between the elements of the outer list. If these are wanted, use the toString method rather than implode.
Definition at line 813 of file OpenList.java. |
|
|
Return true if the argument list is empty, false otherwise. Note: Done by comparing this list to nil, which should be the only way to determine whether the list is empty.
Definition at line 230 of file OpenList.java. |
|
|
Return true if this list is empty, false otherwise. Note: Done by comparing this list to nil, which should be the only way to determine whether the list is empty.
Definition at line 204 of file OpenList.java. Referenced by append(), equals(), first(), isEmpty(), prefix(), and rest(). |
|
|
Return the number of elements of this list.
Definition at line 382 of file OpenList.java. Referenced by main(), nth(), second(), third(), and toArray(). |
|
|
Return the number of elements of the argument list.
Definition at line 363 of file OpenList.java. |
|
|
Return the list consisting of the argument objects.
Definition at line 672 of file OpenList.java. |
|
|
Return the list consisting of the argument objects.
Definition at line 648 of file OpenList.java. |
|
|
Return the list consisting of the argument objects.
Definition at line 626 of file OpenList.java. |
|
|
Return the list consisting of the argument objects.
Definition at line 606 of file OpenList.java. |
|
|
Return the list consisting of the argument objects.
Definition at line 590 of file OpenList.java. |
|
|
Return the list consisting of the argument objects.
Definition at line 574 of file OpenList.java. |
|
|
Return the list consisting of the argument objects.
Definition at line 560 of file OpenList.java. |
|
|
Return the list consisting of the argument objects, in this case the empty list.
Definition at line 547 of file OpenList.java. Referenced by list(). |
|
|
test program: exercises a variety of the defined methods, printing out results Definition at line 941 of file OpenList.java. |
|
|
Return true if the first argument is a member (in the sense of being equals) of this OpenList
Definition at line 317 of file OpenList.java. |
|
|
Return true if the first argument is a member (in the sense of being equals) of the second argument list
Definition at line 297 of file OpenList.java. Referenced by member(). |
|
|
Return true if the argument list is non-empty, false otherwise.
Definition at line 243 of file OpenList.java. |
|
|
Return true if this list is non-empty, false otherwise.
Definition at line 215 of file OpenList.java. Referenced by equals(), implode(), length(), member(), nonEmpty(), reverse(), toArray(), and toString(). |
|
|
Return the nth element of this list, starting with n = 0, 1, 2, ... If there is no nth element, throws an EmptyList exception so indicating.
Definition at line 430 of file OpenList.java. |
|
|
Return the nth element of the second argument list, starting with n = 0, 1, 2, ... If there is no nth element, throws an OpenListException so indicating.
Definition at line 400 of file OpenList.java. |
|
|
Returns the first n elements of an OpenList. If there aren't n elements in the list, returns the entire list. If n <= 0, returns nil.
Definition at line 466 of file OpenList.java. |
|
|
Returns the first n elements of this OpenList. If there aren't n elements in the list, returns the entire list. If n <= 0, returns nil.
Definition at line 445 of file OpenList.java. |
|
|
Return the rest, i.e. all a list of all but the first of the argument non-empty OpenList.
Definition at line 191 of file OpenList.java. |
|
|
Return the rest, i.e. all a list of all but the first of this non-empty OpenList.
Definition at line 172 of file OpenList.java. Referenced by append(), equals(), implode(), length(), member(), nth(), prefix(), reverse(), toArray(), and toString(). |
|
|
Return a new list containing the elements of the argument this list in reverse order.
Definition at line 351 of file OpenList.java. Referenced by main(). |
|
|
Return a new list containing the elements of the argument list in reverse order.
Definition at line 331 of file OpenList.java. |
|
|
Return the second element of the argument OpenList, assuming it has one.
Definition at line 520 of file OpenList.java. |
|
|
Return the second element of this OpenList, assuming it has one.
Definition at line 479 of file OpenList.java. Referenced by second(). |
|
|
Return a sorted version of this list, as determined by the Comparator, using the Quicksort algorithm
Definition at line 905 of file OpenList.java. |
|
|
Return the third element of the argument OpenList, assuming it has one.
Definition at line 534 of file OpenList.java. |
|
|
Return the third element of this OpenList, assuming it has one.
Definition at line 499 of file OpenList.java. Referenced by third(). |
|
|
Return an array of the Objects in this OpenList.
Definition at line 870 of file OpenList.java. |
|
|
Return an array of the Objects in the argument OpenList.
Definition at line 849 of file OpenList.java. Referenced by sort(). |
|
|
Convert this OpenList to a String, using the arguments as punctuation.
Definition at line 754 of file OpenList.java. |
|
|
Convert this OpenList to a String, using default punctuation.
Definition at line 739 of file OpenList.java. |
|
|
the default left paren used when a list is printed. Defaults are used when the toString() method is called, i.e. whenever an OpenList is automatically cast to a String, as in printing. To use different punctuation, or no punctuation, use the three-argument toString, and supply the punctuation you want. Definition at line 38 of file OpenList.java. |
|
|
the default right paren used when a list is printed Definition at line 43 of file OpenList.java. |
|
|
the default space used when a list is printed Definition at line 48 of file OpenList.java. |
|
|
exception message for first of empty list Definition at line 53 of file OpenList.java. |
|
|
the one and only empty OpenList. Do not create any others. This list is represented by a unique cell allocated for the purpose. The first and rest are not intended to be used. We do not use null for this list, so that we can call methods on it. We do not create other empty lists so that our implementation of isEmpty() works by comparing references. Definition at line 27 of file OpenList.java. |
|
|
exception message for nth of a list Definition at line 63 of file OpenList.java. |
|
|
exception message for rest of empty list Definition at line 58 of file OpenList.java. |
|
|
exception message for second of a list Definition at line 73 of file OpenList.java. |
|
|
exception message for third of a list Definition at line 78 of file OpenList.java. |
|
|
part of exception message for nth of a list Definition at line 68 of file OpenList.java. |
1.2.6 written by Dimitri van Heesch,
© 1997-2001