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
Method Summary |
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 |
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. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, wait, wait, wait |
TreeNodeObject
public TreeNodeObject(TreeNode node)
- Constructor
- Parameters:
node
- the treenode to be stored
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 valuev
- 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
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 valuev
- the value to receive the value- Returns:
- true if the named field was found and updated, false otherwise
- 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
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 methodargs
- an array of arguments to the methodret
- 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 errorsjava.lang.NoSuchMethodException
- if the method could not be foundjava.lang.RuntimeException
- if there was an error running the code