|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.synchronoss.cpo.Node
public class Node
This is a general Node class to be used to build different types of trees. There are very few rules in this class as they should be implemented by users of this class.
Constructor Summary | |
---|---|
protected |
Node()
This is the default constructor for the Node class. |
protected |
Node(int nodeType)
This constructor allows you to create a composite or component node based on the node_type. |
Method Summary | |
---|---|
boolean |
acceptBFVisitor(INodeVisitor nv)
Implements the visitor pattern. |
boolean |
acceptDFVisitor(INodeVisitor nv)
Implements the visitor pattern. |
void |
addChild(Node node)
This function adds a child to the linked-list of children for this node. |
void |
addChildSort(Node node)
This function adds a child to the linked-list of children for this node. |
void |
addChildSort(Node node,
java.util.Comparator<Node> c)
|
java.lang.Object |
clone()
|
int |
compareTo(Node o)
|
static Node |
createNode(int nodeType)
This is the factory method for creating Node objects. |
protected int |
doCompare(Node n1,
Node n2,
java.util.Comparator<Node> c)
|
boolean |
equals(Node o)
|
boolean |
getAllowChildren()
|
int |
getChildCount()
|
java.util.List<Node> |
getChildList()
|
Node |
getFirstChild()
Gets the first child node in the linked-list of children. |
Node |
getNextSibling()
Gets the next sibling for this node in the linked list of Nodes. |
Node |
getParentNode()
Gets the parent node for this node |
Node |
getPrevSibling()
Gets the previous sibling for this node in the linked list of Nodes. |
boolean |
hasParent()
Checks to see if this node has a parent. |
void |
insertParentAfter(Node node)
Inserts a new Parent Node as a child of this node and moves all pre-existing children to be children of the new Parent Node. |
void |
insertParentBefore(Node node)
Inserts a new Parent into the tree structure and adds this node as its child. |
void |
insertSiblingAfter(Node node)
Adds a Sibling immediately following this Node. |
void |
insertSiblingBefore(Node node)
Inserts a Sibling into the linked list just prior to this Node |
boolean |
isLeaf()
Checks to see if this node is a leaf node, that is, if it has no children. |
void |
release()
Resets all the attributes to their default state. |
void |
removeAll()
Remove this node and all its children from the tree. |
boolean |
removeChild(Node node)
Searches for an immediate child node and if found removes it from the linked-list of children. |
void |
removeChildNode()
Remove just this node from the tree. |
protected void |
setAllowChildren(boolean ac)
|
void |
setFirstChild(Node node)
Sets the first child node in the linked-list of children. |
void |
setNextSibling(Node node)
Sets the NextSibling for this node. |
void |
setParent(Node node)
Sets the Parent Node for this Node. |
void |
setPrevSibling(Node node)
Sets the PrevSibling for this node. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected Node()
protected Node(int nodeType)
nodeType
- nodeType can be one of two values:
Node.ParentNode
Node.ChildNodeMethod Detail |
---|
public static Node createNode(int nodeType)
nodeType
- nodeType can be one of two values:
Node.ParentNode
Node.ChildNode
public void release()
protected void setAllowChildren(boolean ac)
public boolean getAllowChildren()
public void setParent(Node node)
node
- The node that will become the parent.Node
,
Node
,
Node
public void setPrevSibling(Node node)
node
- The node that will become the previous Siblingpublic void setNextSibling(Node node)
node
- The node that will become the next Siblingpublic Node getParentNode()
public Node getPrevSibling()
public Node getNextSibling()
public boolean hasParent()
public boolean isLeaf()
public void addChild(Node node) throws ChildNodeException
node
- Node that is the node to be added as a child of
this Node.
NodeException
ChildNodeException
public void addChildSort(Node node) throws ChildNodeException
node
- Node that is the node to be added as a child of
this Node.
NodeException
ChildNodeException
public void addChildSort(Node node, java.util.Comparator<Node> c) throws ChildNodeException
ChildNodeException
protected int doCompare(Node n1, Node n2, java.util.Comparator<Node> c)
public void insertSiblingBefore(Node node) throws ChildNodeException
node
- Node to be made the prevSibling
ChildNodeException
public void insertSiblingAfter(Node node)
node
- Node to be made the next siblingpublic void insertParentBefore(Node node) throws ChildNodeException
node
- Node that will become this nodes new Parent.
ChildNodeException
public void insertParentAfter(Node node) throws ChildNodeException
node
- Node to become a child of this node and parent to
all pre-existing children of this node.
ChildNodeException
public boolean removeChild(Node node) throws ChildNodeException
node
- Node to be searched for and removed if found.
ChildNodeException
public void removeChildNode() throws ChildNodeException
ChildNodeException
public void removeAll() throws ChildNodeException
ChildNodeException
public Node getFirstChild()
public void setFirstChild(Node node) throws ChildNodeException
node
- Node which will be made the first child node in
the linked-list of children.
ChildNodeException
public boolean acceptDFVisitor(INodeVisitor nv) throws java.lang.Exception
nv
- INodeVisitor to call upon reaching a node
when traversing the tree.
java.lang.Exception
INodeVisitor
public boolean acceptBFVisitor(INodeVisitor nv) throws java.lang.Exception
nv
- INodeVisitor to call upon reaching a node
when traversing the tree.
java.lang.Exception
INodeVisitor
public int getChildCount()
public java.util.List<Node> getChildList()
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public int compareTo(Node o)
compareTo
in interface java.lang.Comparable<Node>
public boolean equals(Node o)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |