net.sf.arise.piji
Class ListNode

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

public final class ListNode
extends AbstractNode

A class describing a tree node with children in a Scheme tree

Author:
Kjetil Valstadsve
See Also:
Serialized Form

Constructor Summary
(package private) ListNode(ListNodeType type)
          Construct a scheme node a list of subnodes
(package private) ListNode(ListNodeType type, java.util.List nodes)
           
 
Method Summary
 boolean equals(java.lang.Object object)
           
 java.lang.Object evaluate(Context context)
          Evaluates this tree node in the given context.
 Expression get(int i)
           
(package private)  AbstractNode getArgumentNode(int i)
          Get a numbered argument node.
(package private)  AbstractNode getFunNode()
          Get a numbered argument node.
 ListNodeType getType()
           
 int hashCode()
           
 int size()
           
(package private)  ListNode sublist(int offset)
           
(package private)  ListNode sublist(int offset, int length)
           
protected  void writeToBuffer(java.lang.StringBuffer buffer, int x, boolean indent)
          Returns the string value of this tree node
 
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

ListNode

ListNode(ListNodeType type)
Construct a scheme node a list of subnodes


ListNode

ListNode(ListNodeType type,
         java.util.List nodes)
Method Detail

sublist

ListNode sublist(int offset)

sublist

ListNode sublist(int offset,
                 int length)

getType

public ListNodeType getType()

size

public int size()

get

public final Expression get(int i)

getFunNode

final AbstractNode getFunNode()
Get a numbered argument node. Recall that this refers to the numbering of the child nodes preceding the first.

Returns:
Argument node alt. i

getArgumentNode

final AbstractNode getArgumentNode(int i)
Get a numbered argument node. Recall that this refers to the numbering of the child nodes preceding the first.

Parameters:
i - The number of the argument node
Returns:
Argument node alt. i

writeToBuffer

protected void writeToBuffer(java.lang.StringBuffer buffer,
                             int x,
                             boolean indent)
Returns the string value of this tree node

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 final 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 final java.lang.Object evaluate(Context context)
                                throws java.lang.Throwable
Evaluates this tree node in the given context. Evaluates the first child node to a function, then applies it to the remaining child nodes.

Parameters:
context - The context to evaluate in
Returns:
The value of the tree
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