|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectciips.animation.Drawable
ciips.animation.tree.TreeNode
BNode
Field Summary | |
protected java.awt.Font |
bigFont
|
protected BNode[] |
child
subtree array |
protected int |
height
height of node |
protected java.awt.Color |
highlightColor
|
protected java.awt.Font |
hugeFont
|
protected int[] |
key
key array |
protected java.awt.Color |
labelColor
|
protected int |
max_children
maximum number of children |
protected int |
max_key
maximum number of key |
protected java.awt.Color |
nodeColor
|
protected static Nodespace |
nodespace
|
Fields inherited from class ciips.animation.tree.TreeNode |
DEF_TREENODE_COL, depth, highlightLeft, highlightRight, last_dx, last_dy, left, right, weight |
Fields inherited from class ciips.animation.Drawable |
colour, DEFAULT_START, grey, highlight, label, x, y |
Constructor Summary | |
BNode(int max_key)
Create a new leaf node with multiple weight and children. |
|
BNode(int weight,
int max_key)
Create a new node with multiple weight and children with weight to insert |
Method Summary | |
void |
appendKey(int newkey)
Adds a new key in appropriate position |
void |
deleteKey(int index)
Delete specific key(at index) return current key count |
void |
draw(java.awt.Graphics g)
This method draws the node on the corresponding graphical context normally passed in from the drawing panel. |
void |
drawEdge(java.awt.Graphics g,
BNode child)
|
void |
expandSize(float factor)
Adjust the node size by a factor |
int |
findChildPosition(int specifickey)
find child position which has spechfic key |
int |
findKey(int specifickey)
Find specific key in this Node Return founded position(index) return -1, if didn't find |
java.lang.String |
getAllKeyString()
return all key as string |
BNode |
getChild(int index)
return child at index |
int |
getChildCount()
return actual child number |
java.awt.Color |
getColour()
|
java.awt.Dimension |
getEdgeXY(BNode child)
|
int |
getFilledkeywidth()
return actual node size which was filled by inserted key |
java.awt.Dimension |
getHeadXY()
|
int |
getHeight()
return height in the tree |
int |
getKey(int index)
return key at index |
int |
getKeyCount()
return actual key number |
java.lang.String |
getLabel()
|
int |
getMaxKey()
Get Maximum key in this Node |
java.awt.Dimension |
getNodesize()
return maximum node size |
void |
initColors(java.awt.Color nodeColor)
Set the color of the node. |
void |
initFonts(java.awt.Font hugeFont,
java.awt.Font bigFont)
Assign some font instances to reduce initialization over during redraw. |
void |
insertKey(int specifickey,
BNode left,
BNode right)
insert specifickey and set two children on the left of weight and right of weight. |
boolean |
isLeaf()
return true if it is leaf |
boolean |
isSentinel(int index)
return true if child is null at index |
void |
move(int x,
int y)
Move the node and all its branches based on the parameters. |
void |
moveTreeNode(int dx,
int dy)
Move the tree starting with node dx pixels to the right and dy pixels down. |
void |
setChild(BNode newnode)
Adds a new node |
void |
setChild(int index,
BNode newnode)
Adds a new node at index |
void |
setColour(java.awt.Color x)
|
void |
setHighlight(java.awt.Graphics g)
|
void |
setKey(int index,
int newkey)
Adds a new key at index |
void |
setKeyCount(int key_cnt)
set actual key number |
void |
setLabel(java.lang.String label)
|
void |
setLabelColour(java.awt.Color x)
|
void |
setNodespace(Nodespace nodespace)
|
void |
setPosition(int x,
int y,
int dx,
int dy)
Start at a node and set the positions for the sub-tree elements |
void |
setPosition(int x,
int y,
int dx,
int dy,
int height)
Start at a node and set the positions for the sub-tree elements |
java.lang.String |
toString()
return all key and height as string |
void |
Unhighlight_Node()
|
Methods inherited from class ciips.animation.tree.TreeNode |
getDepth, getLeft, getLeftTreeNode, getNodeSize, getRight, getRightTreeNode, getWeight, setDepth, setLeft, setLeftTreeNode, setRight, setRightTreeNode, setWeight |
Methods inherited from class ciips.animation.Drawable |
getCurrentColour, getX, getY, setGrey, setHighlight, setText |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected int[] key
protected BNode[] child
protected int max_children
protected int max_key
protected int height
protected static Nodespace nodespace
protected java.awt.Color nodeColor
protected java.awt.Color labelColor
protected java.awt.Color highlightColor
protected java.awt.Font hugeFont
protected java.awt.Font bigFont
Constructor Detail |
public BNode(int max_key)
public BNode(int weight, int max_key)
Method Detail |
public void insertKey(int specifickey, BNode left, BNode right)
public void setKey(int index, int newkey)
public void appendKey(int newkey)
public void setNodespace(Nodespace nodespace)
public void setChild(BNode newnode)
public void setChild(int index, BNode newnode)
public java.lang.String getLabel()
public int getMaxKey()
public int findKey(int specifickey)
public int findChildPosition(int specifickey)
public void deleteKey(int index)
public int getChildCount()
public BNode getChild(int index)
public int getKeyCount()
public void setKeyCount(int key_cnt)
public boolean isLeaf()
public boolean isSentinel(int index)
public java.awt.Dimension getNodesize()
public int getFilledkeywidth()
public int getHeight()
public java.lang.String getAllKeyString()
public java.lang.String toString()
public int getKey(int index)
public void setPosition(int x, int y, int dx, int dy)
public void setPosition(int x, int y, int dx, int dy, int height)
public void move(int x, int y)
x
- The horizontal destination position of this node.y
- The vertical destination position of this node.public void moveTreeNode(int dx, int dy)
dx
- The change in x direction.dy
- The change in y direction.public void initFonts(java.awt.Font hugeFont, java.awt.Font bigFont)
public void initColors(java.awt.Color nodeColor)
nodeColor
- new color of the node.public void setLabel(java.lang.String label)
public void setColour(java.awt.Color x)
public java.awt.Color getColour()
public void setLabelColour(java.awt.Color x)
public void setHighlight(java.awt.Graphics g)
public void Unhighlight_Node()
public void expandSize(float factor)
factor
- - expansion factor: factor > 1.0 => expansion,
factor < 1.0 => shrinkage
public void drawEdge(java.awt.Graphics g, BNode child)
public java.awt.Dimension getHeadXY()
public java.awt.Dimension getEdgeXY(BNode child)
public void draw(java.awt.Graphics g)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |