com.pow2.structures.tree
Class Node

java.lang.Object
  extended bycom.pow2.structures.tree.Node

public class Node
extends Object

Tree Node class.

Author:
particle (www.theparticle.com), Luca Fossato

Field Summary
protected  Object data
          node data object
protected  int depth
          node depth level
protected  String id
          node identifier
protected  Node left
          left node
protected  boolean open
          child nodes visibility
protected  Node parent
          parent node
protected  Node right
          right node
 
Constructor Summary
Node()
          Default constructor for Node object.
Node(Object data)
          Constructor for the Node object.
Node(Object data, int depth)
          Constructor for the Node object.
Node(String id, Object data)
          Constructor for the Node object
 
Method Summary
 void finalize()
          Finalize this node.
 Object getData()
          Gets the data attribute of the Node object
 int getDepth()
          Gets the depth attribute of the Node object
 String getId()
          Gets the id attribute of the ItemNode object
 Node getLeft()
          Gets the left attribute of the Node object
 Node getParent()
          Gets the parent attribute of the Node object
 Node getRight()
          Gets the right attribute of the Node object
 boolean isOpen()
          Test if the node is open.
 void setData(Object d)
          Sets the data attribute of the Node object
 void setDepth(int depth)
          Sets the depth attribute of the Node object
 void setId(long v)
          Sets the id attribute of the Node object
 void setId(String v)
          Sets the id attribute of the Node object
 void setLeft(Node l)
          Sets the left attribute of the Node object
 void setOpening(boolean open)
          Set the node orifice.
 void setParent(Node p)
          Sets the parent attribute of the Node object
 void setRight(Node r)
          Sets the right attribute of the Node object
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

protected String id
node identifier


data

protected Object data
node data object


left

protected Node left
left node


right

protected Node right
right node


parent

protected Node parent
parent node


depth

protected int depth
node depth level


open

protected boolean open
child nodes visibility

Constructor Detail

Node

public Node()
Default constructor for Node object.


Node

public Node(Object data)
Constructor for the Node object. Instance a new Node object, setting its data object.

Parameters:
data - the node data object

Node

public Node(Object data,
            int depth)
Constructor for the Node object. Instance a new Node object, setting its depth level and its data object.

Parameters:
data - the node data object
depth - the node depth

Node

public Node(String id,
            Object data)
Constructor for the Node object

Parameters:
id - the node identifier
Method Detail

setId

public void setId(long v)
Sets the id attribute of the Node object

Parameters:
v - The new id value

setId

public void setId(String v)
Sets the id attribute of the Node object

Parameters:
v - The new id value

getId

public String getId()
Gets the id attribute of the ItemNode object

Returns:
The id value

setLeft

public void setLeft(Node l)
Sets the left attribute of the Node object

Parameters:
l - The new left value

setRight

public void setRight(Node r)
Sets the right attribute of the Node object

Parameters:
r - The new right value

setParent

public void setParent(Node p)
Sets the parent attribute of the Node object

Parameters:
p - The new parent value

setData

public void setData(Object d)
Sets the data attribute of the Node object

Parameters:
d - The new data value

getLeft

public Node getLeft()
Gets the left attribute of the Node object

Returns:
The left value

getRight

public Node getRight()
Gets the right attribute of the Node object

Returns:
The right value

getParent

public Node getParent()
Gets the parent attribute of the Node object

Returns:
The parent value

getData

public Object getData()
Gets the data attribute of the Node object

Returns:
The data value

isOpen

public boolean isOpen()
Test if the node is open.

Returns:
true if the node is open, false otherwise.

setOpening

public void setOpening(boolean open)
Set the node orifice.

Parameters:
open - true to set the open attribute to true; false otherwise.

getDepth

public int getDepth()
Gets the depth attribute of the Node object

Returns:
The depth value

setDepth

public void setDepth(int depth)
Sets the depth attribute of the Node object

Parameters:
depth - The new depth value

finalize

public void finalize()
Finalize this node.
Clear all the node references.



Copyright © 2002-2004 Power Of Two S.R.L. All Rights Reserved.