Class NestedTreeMap
- java.lang.Object
-
- com.metsci.glimpse.core.painter.treemap.NestedTreeMap
-
public class NestedTreeMap extends Object
The TreeMap datastructure for theAbstractTreeMapPainter
. This contains the structure, size information and text for each node.- Author:
- borkholder
-
-
Constructor Summary
Constructors Constructor Description NestedTreeMap()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChild(int parentId, int childId, double size)
MakesparentId
to the parent ofchildId
.void
addChild(int parentId, int childId, double size, String title)
MakesparentId
to the parent ofchildId
.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)
String
getText(int id)
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, String text)
void
setTitle(int id, String title)
-
-
-
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)
MakesparentId
to the parent ofchildId
.
-
addChild
public void addChild(int parentId, int childId, double size, String title)
MakesparentId
to the parent ofchildId
.
-
setSize
public void setSize(int id, double size)
-
getSize
public double getSize(int id)
-
setTitle
public void setTitle(int id, String title)
-
getTitle
public String getTitle(int id)
-
setText
public void setText(int id, String text)
-
getText
public String getText(int id)
-
getParent
public int getParent(int childId)
Gets the id of the parent of the given node. IfchildId
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()
-
-