shh.util
Class Cons

Object
  extended byCons

public class Cons
extends Object

Partial support for cons, the basic data structure in Lisp. Defines equals(java.lang.Object) on conses to mean the corresponding members are equal recursively, like Lisp's equal.

Author:
Mark McConnell

Constructor Summary
Cons(Object car_, Object cdr_)
           
 
Method Summary
 Object car()
          Returns the first element of the cons.
 Object cdr()
          Returns the second element of the cons.
 boolean equals(Object o)
          Like Lisp's equal, this tests for equality of the members.
 int hashCode()
          Consistent with equals(java.lang.Object).
 void rplaca(Object newCar)
          Resets the first element of the cons.
 void rplacd(Object newCdr)
          Resets the second element of the cons.
 String toString()
           
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Cons

public Cons(Object car_,
            Object cdr_)
Method Detail

car

public final Object car()
Returns the first element of the cons.


cdr

public final Object cdr()
Returns the second element of the cons.


rplaca

public void rplaca(Object newCar)
Resets the first element of the cons.


rplacd

public void rplacd(Object newCdr)
Resets the second element of the cons.


equals

public boolean equals(Object o)
Like Lisp's equal, this tests for equality of the members.


hashCode

public int hashCode()
Consistent with equals(java.lang.Object).


toString

public String toString()