|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectJaCoP.constraints.knapsack.TreeNode
public class TreeNode
It contains information required by an internal node of the item tree.
| Field Summary | |
|---|---|
TreeNode |
left
It specifies the left child. |
TreeNode |
leftNeighbor
It specifies the left neighbor. |
TreeNode |
parent
It specifies the parent of this node. |
TreeNode |
right
It specifies the right child. |
TreeNode |
rightNeighbor
It specifies the right neighbor. |
| Constructor Summary | |
|---|---|
TreeNode()
The constructor used by tree leaves. |
|
TreeNode(TreeNode left,
TreeNode right)
It constructs a node of the item tree. |
|
| Method Summary | |
|---|---|
int |
getPSum()
It does not recompute sum of profits. |
int |
getWMax()
It does not recompute the maximum of weights. |
int |
getWSum()
It does not recompute sum of weights. |
boolean |
isLeaf()
|
java.lang.String |
nodeToString()
It generates description of the node only. |
void |
recomputeDown(Tree tree)
This function recomputes the attributes of this node after recomputing the left and right subtree. |
void |
recomputeUp(Tree tree)
This function is used to recompute the attributes of all nodes on the way to root from this node. |
void |
setLeftNeighbor(TreeNode leftNeighbor)
It sets the left neighbor of this tree node. |
void |
setRightNeighbor(TreeNode rightNeighbor)
It sets the right neighbor of this tree node. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public TreeNode parent
public final TreeNode left
public final TreeNode right
public TreeNode leftNeighbor
public TreeNode rightNeighbor
| Constructor Detail |
|---|
public TreeNode()
public TreeNode(TreeNode left,
TreeNode right)
left - left childright - right child| Method Detail |
|---|
public void setLeftNeighbor(TreeNode leftNeighbor)
leftNeighbor - left neighbor of this node.public void setRightNeighbor(TreeNode rightNeighbor)
rightNeighbor - right neighbor of this node.public boolean isLeaf()
public int getWMax()
public int getWSum()
public int getPSum()
public java.lang.String toString()
toString in class java.lang.Objectpublic void recomputeUp(Tree tree)
tree - only added to be in agreement with the function template
for leaf which need information about tree it belongs to.public void recomputeDown(Tree tree)
tree - It is required by leaves so tree atributes like alreadyUsedCapacity are properly updated.public java.lang.String nodeToString()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||