All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class magician.Four11.List

java.lang.Object
   |
   +----magician.Four11.List

public class List
extends Object
Implements a LISP style list


Constructor Index

 o List()
initializes a null list
 o List(Object, List)
prepends a list with a new element (the "cons" operation in Lisp).

Method Index

 o car()
returns the first element of the list (the "car" in Lisp)
 o cdr()
returns a pointer to the rest of the list (the "cdr" in Lisp)
 o setCar(Object)
sets the "car" of the list
 o setCdr(List)
sets the "cdr" of the list

Constructors

 o List
 public List()
initializes a null list

 o List
 public List(Object data,
             List next)
prepends a list with a new element (the "cons" operation in Lisp). Can be used to create a new list by setting next to null.

Parameters:
data - the element
next - the tail of the list, a pointer to the rest of the list

Methods

 o car
 public Object car()
returns the first element of the list (the "car" in Lisp)

Returns:
element at the head
 o cdr
 public List cdr()
returns a pointer to the rest of the list (the "cdr" in Lisp)

Returns:
List object representing the tail
 o setCar
 public void setCar(Object data)
sets the "car" of the list

Parameters:
data - element to set as car
 o setCdr
 public List setCdr(List cdr)
sets the "cdr" of the list

Parameters:
cdr - List object to be set as cdr

All Packages  Class Hierarchy  This Package  Previous  Next  Index
1