|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.pow2.structures.tree.BinaryTree com.pow2.structures.tree.ItemTree
ItemsTree class.
Field Summary | |
protected HashMap |
map
Node hashMap. |
protected boolean |
traverseAllNodes
set to true to navigate all the nodes; to false to navigate only the open nodes; |
Fields inherited from class com.pow2.structures.tree.BinaryTree |
cat, INTRAVERSE, nodeVisitor, POSTRAVERSE, PRETRAVERSE, root, traverseMode |
Constructor Summary | |
ItemTree()
Constructor for the ItemsTree object |
Method Summary | |
boolean |
addLeft(Node p,
Node c)
Add a new left node to the parent node left node list. |
boolean |
addRight(Node p,
Node c)
Add a new right node to the parent node right node list. |
Node |
getNode(String id)
Get the node referenced by the input id. |
boolean |
insertLeft(Node p,
Node c)
Insert a new left node into the tree. |
boolean |
insertRight(Node p,
Node c)
Insert a new right node into the tree. |
boolean |
isTraverseAllNodes()
Gets the traverseAllNodes attribute of the ItemTree object |
void |
move(String pId,
String id,
boolean left)
Move the c node identified by the input pId
indentifier over the new parent p node. |
protected void |
pretrav(Node p)
Traverse the tree, using pre-order algorithm, starting from the input node; visit only open nodes. |
protected void |
remove(Node n)
Remove the input node from the tree, rearranging the parent and the child nodes references. |
void |
setTraverseAllNodes(boolean traverseAllNodes)
Sets the traverseAllNodes attribute of the ItemTree object |
Methods inherited from class com.pow2.structures.tree.BinaryTree |
build, getData, getLeft, getNodeVisitor, getRight, getRoot, getTraverseMode, intrav, isEmpty, move, postrav, remove, setData, setNodeVisitor, setRoot, setTraverseMode, traverse, visit |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected HashMap map
protected boolean traverseAllNodes
Constructor Detail |
public ItemTree()
Method Detail |
public void setTraverseAllNodes(boolean traverseAllNodes)
traverseAllNodes
- The new traverseAllNodes valuepublic boolean isTraverseAllNodes()
public void move(String pId, String id, boolean left)
c
node identified by the input pId
indentifier over the new parent p
node.
pId
- the identifier of the parent c
nodeid
- the identifier of the c
node to moveleft
- true if the c
node must be inserted
as left node of p
;
false if c
must be inserted as right
node of p
protected void remove(Node n)
remove
in class BinaryTree
n
- the node to remove.public Node getNode(String id)
id
- the node id
protected void pretrav(Node p) throws Exception
pretrav
in class BinaryTree
p
- the node where to start the tree traversing
Exception
- if any error occurspublic boolean insertLeft(Node p, Node c)
insertLeft
in class BinaryTree
p
- the parent node where to insert the new left nodec
- the new left node to add to the parent node
public boolean insertRight(Node p, Node c)
insertRight
in class BinaryTree
p
- the parent node where to insert the new right nodec
- the new right node to add to the parent node
public boolean addLeft(Node p, Node c)
addLeft
in class BinaryTree
p
- the parent nodec
- the left node to add to the parent node left node list
public boolean addRight(Node p, Node c)
addRight
in class BinaryTree
p
- the parent nodec
- the right node to add to the parent node right node list
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |