All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class w3c.tools.sexpr.Cons

java.lang.Object
   |
   +----w3c.tools.sexpr.Cons

public class Cons
extends Object
implements SExpr
Basic class for implementing linked lists a la Lisp.


Constructor Index

 o Cons(Object)
Initializes a Cons cell with a left subtree only.
 o Cons(Object, Object)
Initializes a Cons cell with the left and right "subtrees".

Method Index

 o elements()
 o left()
Returns the left subtree (i.e.
 o printExpr(PrintStream)
 o rest()
Returns the tail of a cons cell if it is a list.
 o right()
Returns the right subtree (i.e.
 o toString()

Constructors

 o Cons
 public Cons(Object left,
             Object right)
Initializes a Cons cell with the left and right "subtrees".

 o Cons
 public Cons(Object left)
Initializes a Cons cell with a left subtree only. Right subtree will be set to null.

Methods

 o left
 public Object left()
Returns the left subtree (i.e. the head) of a cons cell.

 o right
 public Object right()
Returns the right subtree (i.e. the tail) of a cons cell.

 o rest
 public Cons rest() throws SExprParserException
Returns the tail of a cons cell if it is a list. Signals an error otherwise (no dotted pairs allowed).

Throws: SExprParserException
if the tail is not a Cons or null
 o elements
 public Enumeration elements()
 o printExpr
 public void printExpr(PrintStream stream)
 o toString
 public String toString()
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index