|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--grtree.Tree
Tree is a class representing a kind of generalized tree that the user wishes to draw on a graphics plane or print on some page (or graphics plane). A tree of this kind has data and any number of children. The data is simply a String and the children is a Vector of Tree's. A Tree can draw itself on any appropriate graphics plane using its drawTree method. A Tree can print itself at TTY (or elsewhere) via its toString method.
Field Summary | |
private java.awt.Color |
background
|
java.util.Vector |
children
|
java.lang.String |
data
A Tree has data and children. |
private java.awt.Color |
edgeColor
|
private java.awt.Font |
font
|
private java.awt.Color |
fontColor
|
private java.awt.Color |
leafColor
|
Constructor Summary | |
Tree(java.lang.String s)
Construct a Tree using (simple) String. |
Method Summary | |
void |
addChild(Tree t)
Add a child to this tree. |
void |
drawNode(java.awt.Graphics g,
int x,
int y)
|
void |
drawTree(java.awt.Graphics g,
int x,
int y)
drawTree draws the tree in the Graphics plane using upper-left corner x,y (for box containing the tree). |
int |
getNodeHeight(java.awt.Graphics g)
|
int |
getNodeWidth(java.awt.Graphics g)
How wide/high is the root node of this tree when drawn? |
int |
getTreeHeight(java.awt.Graphics g)
|
int |
getTreeWidth(java.awt.Graphics g)
|
boolean |
isLeaf()
Is this a leaf? |
static void |
main(java.lang.String[] args)
|
void |
removeChild(Tree t)
Remove a child from this tree. |
java.lang.String |
toString()
.toString() .toString(int) Generate a String representation for the entire tree This is the familiar cascaded (tabbed tree) form. |
java.lang.String |
toString(int tab)
|
java.lang.String |
toTreeExpression()
Return TreeExpression for this tree. |
Methods inherited from class java.lang.Object |
|
Field Detail |
public java.lang.String data
public java.util.Vector children
private java.awt.Font font
private java.awt.Color background
private java.awt.Color leafColor
private java.awt.Color fontColor
private java.awt.Color edgeColor
Constructor Detail |
public Tree(java.lang.String s)
Method Detail |
public void addChild(Tree t)
public void removeChild(Tree t)
public boolean isLeaf()
public java.lang.String toString()
public java.lang.String toString(int tab)
public java.lang.String toTreeExpression()
public int getNodeWidth(java.awt.Graphics g)
public int getNodeHeight(java.awt.Graphics g)
public void drawNode(java.awt.Graphics g, int x, int y)
public int getTreeWidth(java.awt.Graphics g)
public int getTreeHeight(java.awt.Graphics g)
public void drawTree(java.awt.Graphics g, int x, int y)
public static void main(java.lang.String[] args)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |