net.sf.jtreemap.ktreemap
Class TreeMapNodeBuilder

java.lang.Object
  extended by net.sf.jtreemap.ktreemap.TreeMapNodeBuilder
Direct Known Subclasses:
BuilderTM3, BuilderXML

public abstract class TreeMapNodeBuilder
extends java.lang.Object

Tree builder for a KTreeMap.

 

Constructor Summary
TreeMapNodeBuilder()
           
 
Method Summary
 TreeMapNode buildBranch(java.lang.Object value, TreeMapNode parent)
          Add a branch to the tree.
 TreeMapNode buildLeaf(java.lang.Object value, TreeMapNode parent)
          add a leaf to the tree.
 TreeMapNode getRoot()
          get the build tree.
abstract  double getWeight(java.lang.Object value)
          Return the weight of an Object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeMapNodeBuilder

public TreeMapNodeBuilder()
Method Detail

buildBranch

public TreeMapNode buildBranch(java.lang.Object value,
                               TreeMapNode parent)
Add a branch to the tree.
If the parent is null, the build node become the root if and only if the tree have no root yet. If the parent is null and if the root is already build, the node will NOT be added to the tree.

Parameters:
value - Value of the branch
parent - father of the branch
Returns:
the created node

buildLeaf

public TreeMapNode buildLeaf(java.lang.Object value,
                             TreeMapNode parent)
add a leaf to the tree.
If the parent is null, the build node become the root if and only if the tree have no root yet. If the parent is null and if the root is already build, the node will NOT be added to the tree.

Parameters:
value - Value of the leaf
parent - father of the leaf
Returns:
the created node

getRoot

public TreeMapNode getRoot()
get the build tree.

Returns:
the root of the tree

getWeight

public abstract double getWeight(java.lang.Object value)
Return the weight of an Object.
This method have to be extended

Parameters:
value - the object (generaly, the TreeMapNode.getValue())
Returns:
the weight of the value