simkin
Class TreeNodeObject

java.lang.Object
  |
  +--simkin.ExecutableRoot
        |
        +--simkin.TreeNodeObject
All Implemented Interfaces:
Executable
Direct Known Subclasses:
ScriptedExecutable

public class TreeNodeObject
extends ExecutableRoot

This class provides and Executable interface to a TreeNode

The method getValue, setValue and method all search for matching child labels within the TreeNode object. Only the first matching tag is used.


Constructor Summary
TreeNodeObject(TreeNode node)
          Constructor
 
Method Summary
 void dump()
          This method writes the entire node tree to stdout
 TreeNodeObjectEnumerator enumerate()
          This method returns an object which can iterate over all the immediate child node of this node
 TreeNodeObjectEnumerator enumerate(java.lang.String label)
          This method returns an object which can iterate over all the immediate child nodes of this node whose label matches the one given
 boolean equals(java.lang.Object o)
           
 TreeNode getNode()
           
 java.lang.Object getValue(java.lang.String s, java.lang.String attribute)
          this method retrieves a value from the in-memory treenode object.
 java.lang.Object getValueAt(java.lang.Object array_index, java.lang.String attribute)
          this method retrieves a value from the in-memory treenode object.
 java.lang.Object method(java.lang.String s, java.lang.Object[] args)
          this method attempts to find the named method within the in-memory treenode object.
 void setValue(java.lang.String s, java.lang.String attribute, java.lang.Object v)
          this method stores a value in the in-memory treenode object.
 void setValueAt(java.lang.Object array_index, java.lang.String attribute, java.lang.Object v)
          this method stores a value in the in-memory treenode object.
 java.lang.String toString()
           
 
Methods inherited from class simkin.ExecutableRoot
setTracer
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TreeNodeObject

public TreeNodeObject(TreeNode node)
Constructor
Parameters:
node - the treenode to be stored
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
the value of the treenode data as a string

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object
Returns:
true if the data in both nodes is the same

getNode

public TreeNode getNode()
Returns:
the underlying treenode

setValue

public void setValue(java.lang.String s,
                     java.lang.String attribute,
                     java.lang.Object v)
              throws java.lang.RuntimeException,
                     java.lang.NoSuchFieldException
this method stores a value in the in-memory treenode object. If the value is of treenode type, the treenode is first copied and then stored
Overrides:
setValue in class ExecutableRoot
Parameters:
s - the name of the value
v - the value itself
Throws:
java.lang.RuntimeException - - if there was a problem running the script (such as not having permission to access a field)
java.lang.NoSuchFieldException - - if the field could not be found

setValueAt

public void setValueAt(java.lang.Object array_index,
                       java.lang.String attribute,
                       java.lang.Object v)
                throws java.lang.RuntimeException
this method stores a value in the in-memory treenode object. If the value is of treenode type, the treenode is first copied and then stored
Overrides:
setValueAt in class ExecutableRoot
Parameters:
array_index - the index of the item to update
v - the value itself
Throws:
java.lang.RuntimeException - - if there was a problem running the script (such as not having permission to access a field)

getValueAt

public java.lang.Object getValueAt(java.lang.Object array_index,
                                   java.lang.String attribute)
                            throws java.lang.RuntimeException
this method retrieves a value from the in-memory treenode object. If the value retrieved is a treenode type, it is *not* copied
Overrides:
getValueAt in class ExecutableRoot
Parameters:
array_index - the name of the value
Returns:
the value or null
Throws:
java.lang.RuntimeException - - if there was a problem running the script (such as not having permission to access a field)

getValue

public java.lang.Object getValue(java.lang.String s,
                                 java.lang.String attribute)
                          throws java.lang.RuntimeException,
                                 java.lang.NoSuchFieldException
this method retrieves a value from the in-memory treenode object. If the value retrieved is a treenode type, it is *not* copied
Overrides:
getValue in class ExecutableRoot
Parameters:
s - the name of the value
Returns:
the value or null
Throws:
java.lang.RuntimeException - - if there was a problem running the script (such as not having permission to access a field)
java.lang.NoSuchFieldException - - if the field could not be found

enumerate

public TreeNodeObjectEnumerator enumerate()
This method returns an object which can iterate over all the immediate child node of this node

enumerate

public TreeNodeObjectEnumerator enumerate(java.lang.String label)
This method returns an object which can iterate over all the immediate child nodes of this node whose label matches the one given

dump

public void dump()
This method writes the entire node tree to stdout

method

public java.lang.Object method(java.lang.String s,
                               java.lang.Object[] args)
                        throws ParseException,
                               java.lang.RuntimeException,
                               java.lang.NoSuchMethodException
this method attempts to find the named method within the in-memory treenode object. If it is found, the Interpreter is used to execute the method
Overrides:
method in class ExecutableRoot
Parameters:
s - the name of the method
args - an array of arguments to the method
ret - the object to receive the result of the method call
Returns:
true if the method was found, false otherwise
Throws:
ParseException - if the code contained syntax errors
java.lang.NoSuchMethodException - if the method could not be found
java.lang.RuntimeException - if there was an error running the code