com.metsci.glimpse.painter.treemap
Class NestedTreeMap

java.lang.Object
  extended by com.metsci.glimpse.painter.treemap.NestedTreeMap

public class NestedTreeMap
extends java.lang.Object

The TreeMap datastructure for the AbstractTreeMapPainter. This contains the structure, size information and text for each node.

Author:
borkholder

Constructor Summary
NestedTreeMap()
           
 
Method Summary
 void addChild(int parentId, int childId, double size)
          Makes parentId to the parent of childId.
 void addChild(int parentId, int childId, double size, java.lang.String title)
          Makes parentId to the parent of childId.
 int[] getChildren(int id)
           
 int getLevel(int id)
          Gets the level in the tree, root is 0 and the level increases from there.
 int getParent(int childId)
          Gets the id of the parent of the given node.
 int getRoot()
           
 double getSize(int id)
           
 double[] getSizesOfChildren(int id)
           
 java.lang.String getText(int id)
           
 java.lang.String getTitle(int id)
           
 boolean isEmpty()
           
 boolean isLeaf(int id)
          Returns true if there are no children of this node.
 void removeChild(int childId)
          Removes the child and all descendants.
 void setRoot(int id)
          Clears the tree if there is any data and creates a new root.
 void setSize(int id, double size)
           
 void setText(int id, java.lang.String text)
           
 void setTitle(int id, java.lang.String title)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NestedTreeMap

public NestedTreeMap()
Method Detail

getRoot

public int getRoot()

setRoot

public void setRoot(int id)
Clears the tree if there is any data and creates a new root.


getLevel

public int getLevel(int id)
Gets the level in the tree, root is 0 and the level increases from there.


addChild

public void addChild(int parentId,
                     int childId,
                     double size)
Makes parentId to the parent of childId.


addChild

public void addChild(int parentId,
                     int childId,
                     double size,
                     java.lang.String title)
Makes parentId to the parent of childId.


setSize

public void setSize(int id,
                    double size)

getSize

public double getSize(int id)

setTitle

public void setTitle(int id,
                     java.lang.String title)

getTitle

public java.lang.String getTitle(int id)

setText

public void setText(int id,
                    java.lang.String text)

getText

public java.lang.String getText(int id)

getParent

public int getParent(int childId)
Gets the id of the parent of the given node. If childId is the root, childId is returned.


removeChild

public void removeChild(int childId)
Removes the child and all descendants.


isLeaf

public boolean isLeaf(int id)
Returns true if there are no children of this node.


getChildren

public int[] getChildren(int id)

getSizesOfChildren

public double[] getSizesOfChildren(int id)

isEmpty

public boolean isEmpty()


Copyright © 2012 Metron, Inc.. All Rights Reserved.