net.sf.arise.piji
Class LeafNode

java.lang.Object
  |
  +--net.sf.arise.piji.AbstractNode
        |
        +--net.sf.arise.piji.LeafNode
All Implemented Interfaces:
Expression, java.io.Serializable

public final class LeafNode
extends AbstractNode

A Scheme tree leaf node

Author:
Kjetil Valstadsve
See Also:
Serialized Form

Constructor Summary
(package private) LeafNode(boolean b)
          A constructor for a leaf with a boolean content
(package private) LeafNode(byte b)
          A constructor for a leaf with a byte content
(package private) LeafNode(char c)
          A constructor for a leaf with a char content
(package private) LeafNode(double d)
          A constructor for a leaf with a double content
(package private) LeafNode(float f)
          A constructor for a leaf with a float content
(package private) LeafNode(int i)
          A constructor for a leaf with an integer content
(package private) LeafNode(long l)
          A constructor for a leaf with a long content
(package private) LeafNode(java.lang.Object content)
          A constructor for a leaf with a general object content
(package private) LeafNode(short s)
          A constructor for a leaf with a short content
 
Method Summary
 boolean equals(java.lang.Object object)
           
 java.lang.Object evaluate(Context context)
          Evaluates the content of this leaf in the given environment.
(package private)  java.lang.Object getContent()
          Get the content of the leaf
(package private)  java.lang.String getStringContent()
           
(package private)  Symbol getSymbolContent()
           
 int hashCode()
           
(package private)  boolean isContentExplicitlyTyped()
           
(package private)  boolean isContentHolder()
           
(package private)  boolean isContentString()
           
(package private)  boolean isContentSymbol()
           
protected  void writeToBuffer(java.lang.StringBuffer buffer, int x, boolean i)
          Returns the string value of the content
 
Methods inherited from class net.sf.arise.piji.AbstractNode
toSchemeString, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LeafNode

LeafNode(java.lang.Object content)
A constructor for a leaf with a general object content


LeafNode

LeafNode(boolean b)
A constructor for a leaf with a boolean content

Parameters:
b - The content

LeafNode

LeafNode(char c)
A constructor for a leaf with a char content

Parameters:
c - The content

LeafNode

LeafNode(int i)
A constructor for a leaf with an integer content

Parameters:
i - The content

LeafNode

LeafNode(long l)
A constructor for a leaf with a long content

Parameters:
l - The content

LeafNode

LeafNode(float f)
A constructor for a leaf with a float content

Parameters:
f - The content

LeafNode

LeafNode(double d)
A constructor for a leaf with a double content

Parameters:
d - The content

LeafNode

LeafNode(byte b)
A constructor for a leaf with a byte content

Parameters:
b - The content

LeafNode

LeafNode(short s)
A constructor for a leaf with a short content

Parameters:
s - The content
Method Detail

isContentExplicitlyTyped

boolean isContentExplicitlyTyped()

isContentSymbol

boolean isContentSymbol()

isContentString

boolean isContentString()

isContentHolder

boolean isContentHolder()

getSymbolContent

Symbol getSymbolContent()

getStringContent

java.lang.String getStringContent()

getContent

java.lang.Object getContent()
Get the content of the leaf

Returns:
The content of the leaf

writeToBuffer

protected void writeToBuffer(java.lang.StringBuffer buffer,
                             int x,
                             boolean i)
Returns the string value of the content

Specified by:
writeToBuffer in class AbstractNode
Parameters:
x - Used to set the indentation for printing, enabling proper tree structuring of the output
Returns:
A string describing the tree

equals

public boolean equals(java.lang.Object object)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

evaluate

public java.lang.Object evaluate(Context context)
                          throws java.lang.Throwable
Evaluates the content of this leaf in the given environment. Iff content is a symbol, look it up in the context

Parameters:
context - The context to evaluate in
Returns:
The value of the content
Throws:
EvaluationException - Thrown iff something bad happens
java.lang.Throwable - iff the evaluation goes awry


All code and documentation is

Copyright (c) : 2000-2003 Kjetil Valstadsve & Maja S. Bratseth