org.rubato.scheme
Class SCons

java.lang.Object
  extended by org.rubato.scheme.SExpr
      extended by org.rubato.scheme.SCons

public final class SCons
extends SExpr

The class representing Scheme pairs.

Author:
Gérard Milmeister

Field Summary
 
Fields inherited from class org.rubato.scheme.SExpr
NULL, VOID
 
Constructor Summary
SCons()
          Creates an complete pair where both car and cdr are ().
SCons(SExpr car, SExpr cdr)
          Creates a pair with the given car and cdr.
 
Method Summary
 java.lang.String display()
          Returns a string representation of this SExpr.
 boolean eq_p(SExpr sexpr)
          Returns true iff this is equal to sexpr in the eq? sense.
 boolean equal_p(SExpr sexpr)
          Returns true iff this is equal to sexpr in the equal? sense.
 boolean equals(java.lang.Object obj)
          Returns true iff this is equal to obj.
 boolean eqv_p(SExpr sexpr)
          Returns true iff this is equal to sexpr in the eqv? sense.
 SExpr getCar()
          Returns the car of this SExpr.
 SExpr getCdr()
          Returns the cdr of this SExpr.
 int getLength()
          Returns the length if this is a regular list, otherwise -1.
 boolean isCons()
          Returns true iff this is a cons.
 SExpr nth(int i)
          Returns the i-th element if this is a regular list, otherwise null.
 void setCar(SExpr car)
          Sets the car of this SExpr.
 void setCdr(SExpr cdr)
          Sets the cdr of this SExpr.
 java.lang.String toString()
          Returns a string representation of this SExpr.
 
Methods inherited from class org.rubato.scheme.SExpr
car, cdr, cons, isBoolean, isChar, isClosure, isComplex, isDenotator, isForm, isInteger, isList, isNull, isNumber, isPair, isPrimitive, isRational, isReal, isString, isSymbol, isVector, isVoid
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SCons

public SCons()
Creates an complete pair where both car and cdr are ().


SCons

public SCons(SExpr car,
             SExpr cdr)
Creates a pair with the given car and cdr.

Method Detail

getCar

public SExpr getCar()
Description copied from class: SExpr
Returns the car of this SExpr.

Overrides:
getCar in class SExpr
Returns:
null if this is not a cons

getCdr

public SExpr getCdr()
Description copied from class: SExpr
Returns the cdr of this SExpr.

Overrides:
getCdr in class SExpr
Returns:
null if this is not a cons

setCar

public void setCar(SExpr car)
Description copied from class: SExpr
Sets the car of this SExpr. Does nothing if this is not a cons.

Overrides:
setCar in class SExpr

setCdr

public void setCdr(SExpr cdr)
Description copied from class: SExpr
Sets the cdr of this SExpr. Does nothing if this is not a cons.

Overrides:
setCdr in class SExpr

getLength

public int getLength()
Description copied from class: SExpr
Returns the length if this is a regular list, otherwise -1.

Overrides:
getLength in class SExpr

nth

public SExpr nth(int i)
Description copied from class: SExpr
Returns the i-th element if this is a regular list, otherwise null.

Overrides:
nth in class SExpr

eq_p

public boolean eq_p(SExpr sexpr)
Description copied from class: SExpr
Returns true iff this is equal to sexpr in the eq? sense.

Specified by:
eq_p in class SExpr

eqv_p

public boolean eqv_p(SExpr sexpr)
Description copied from class: SExpr
Returns true iff this is equal to sexpr in the eqv? sense.

Specified by:
eqv_p in class SExpr

equal_p

public boolean equal_p(SExpr sexpr)
Description copied from class: SExpr
Returns true iff this is equal to sexpr in the equal? sense.

Specified by:
equal_p in class SExpr

equals

public boolean equals(java.lang.Object obj)
Description copied from class: SExpr
Returns true iff this is equal to obj. Normally this returns the same result as SExpr.equal_p(org.rubato.scheme.SExpr).

Specified by:
equals in class SExpr

isCons

public boolean isCons()
Description copied from class: SExpr
Returns true iff this is a cons.

Overrides:
isCons in class SExpr

toString

public java.lang.String toString()
Description copied from class: SExpr
Returns a string representation of this SExpr.

Specified by:
toString in class SExpr

display

public java.lang.String display()
Description copied from class: SExpr
Returns a string representation of this SExpr. This is the representation intended to show the result of an evaluation, and should be a valid Scheme expression if possible.

Specified by:
display in class SExpr