    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class org.w3c.tools.sexpr.Cons

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

public class Cons
extends Object
implements SExpr

Basic class for implementing linked lists a la Lisp.

##

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

##

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

##

Cons

     public Cons(Object left,
                 Object right)

  Initializes a Cons cell with the left and right "subtrees".

Cons

     public Cons(Object left)

  Initializes a Cons cell with a left subtree only. Right subtree will be set to `null`.

##

left

     public Object left()

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

right

     public Object right()

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

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```

elements

     public Enumeration elements()

printExpr

     public void printExpr(PrintStream stream)

    All Packages  Class Hierarchy  This Package  Previous  Next  Index