dochelper
Class ResultNode

java.lang.Object
  extended by dochelper.ResultNode

public class ResultNode
extends java.lang.Object

The ResultNode class holds the result of the execution of DocHelper. A tree structure is made with the match results for a document definition execution. The tree structure is then passed to a Rendered For Output Creation. The tree may be modified by Processors before beign passed for Rendering.


Field Summary
private  java.util.ArrayList<ResultNode> _children
          Node Children
 java.lang.String _name
          Node name.
private  java.util.HashMap _params
          Parameters available to node.
private  java.lang.String _value
          Node value.
 
Constructor Summary
ResultNode(java.lang.String value, java.util.HashMap params, java.lang.String name)
          Creates a new instance of ResultNode
 
Method Summary
 void addChild(ResultNode node)
          Add a child to this node.
 ResultNode find(java.lang.String nodeName)
          Retrieve the ResultNode which _name equals to nodeName.
 java.util.List<ResultNode> getChildren()
          Return the list of children if any in this node.
 java.util.HashMap getParams()
          Retrieve the params from the node
 java.lang.String getValue()
          Return the value of the node if any
 boolean hasLeaf()
          Retrieve a boolean that indicates whether this node has leafs as children.
 boolean isLeaf()
          Retrieve a boolean that indicates whether this node is a Leaf
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_params

private java.util.HashMap _params
Parameters available to node.


_children

private java.util.ArrayList<ResultNode> _children
Node Children


_value

private java.lang.String _value
Node value. TODO: Default to String?


_name

public java.lang.String _name
Node name.

Constructor Detail

ResultNode

public ResultNode(java.lang.String value,
                  java.util.HashMap params,
                  java.lang.String name)
Creates a new instance of ResultNode

Parameters:
value -
params -
name -
Method Detail

addChild

public void addChild(ResultNode node)
Add a child to this node.

Parameters:
node - ResultNode child to add.

getChildren

public java.util.List<ResultNode> getChildren()
Return the list of children if any in this node.

Returns:
List of children.

getValue

public java.lang.String getValue()
Return the value of the node if any

Returns:
Node Value : A transformed match

getParams

public java.util.HashMap getParams()
Retrieve the params from the node

Returns:
params Paramters set for this node. For use during rendering.

find

public ResultNode find(java.lang.String nodeName)
Retrieve the ResultNode which _name equals to nodeName.

Returns:
nodeName Name of the node to be looked for.

hasLeaf

public boolean hasLeaf()
Retrieve a boolean that indicates whether this node has leafs as children. This method will return true if at least one of the children of this node is a leaf.

Returns:
boolean Indicates node has leafs.

isLeaf

public boolean isLeaf()
Retrieve a boolean that indicates whether this node is a Leaf

Returns:
boolean Indicates node is a leaf

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object