it.unitn.disi.smatch.data.trees
Interface INode

All Superinterfaces:
IIndexedObject, javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode
All Known Implementing Classes:
Node

public interface INode
extends javax.swing.tree.MutableTreeNode, IIndexedObject

An interface to a node.

Author:

Method Summary
 void addChild(INode child)
          Adds a child to the given node as the last child.
 void addChild(int index, INode child)
          Adds child to the receiver at index.
 void addTreeStructureChangedListener(ITreeStructureChangedListener l)
          Adds a listener l to the the listener list.
 INode createChild()
          Creates a child to the given node as the last child.
 INode createChild(java.lang.String name)
          Creates a child with a name to the given node as the last child.
 void fireTreeStructureChanged(INode node)
          Fires the tree structure changed event.
 int getAncestorCount()
          Returns the count of ancestor nodes.
 java.util.Iterator<INode> getAncestors()
          Returns ancestors of the receiver.
 java.util.List<INode> getAncestorsList()
          Returns unmodifiable list of receivers ancestors.
 INode getChildAt(int childIndex)
          Returns the child node at index childIndex.
 int getChildCount()
          Returns the number of children INodes.
 int getChildIndex(INode child)
          Returns the index of node in the receivers children.
 java.util.Iterator<INode> getChildren()
          Returns the iterator over the children of the receiver.
 java.util.List<INode> getChildrenList()
          Returns unmodifiable list of receivers children.
 int getDescendantCount()
          Returns the count of descendant nodes.
 java.util.Iterator<INode> getDescendants()
          Returns descendants of the receiver.
 java.util.List<INode> getDescendantsList()
          Returns unmodifiable list of receivers descendants.
 int getLevel()
          Returns the number of levels above this node -- the distance from the root to this node.
 INodeData getNodeData()
          Returns interface to the node metadata.
 INode getParent()
          Returns the parent of the receiver.
 boolean hasParent()
          Returns true if the receiver has a parent and false otherwise.
 boolean isLeaf()
          Returns true if the receiver is a leaf.
 void removeChild(INode node)
          Removes node from the receiver.
 void removeChild(int index)
          Removes the child at index from the receiver.
 void removeFromParent()
          Removes the subtree rooted at this node from the tree, giving this node a null parent.
 void removeTreeStructureChangedListener(ITreeStructureChangedListener l)
          Removes a listener l from the listeners list.
 void setParent(INode newParent)
          Sets the parent of the receiver to newParent.
 
Methods inherited from interface javax.swing.tree.MutableTreeNode
insert, remove, remove, setParent, setUserObject
 
Methods inherited from interface javax.swing.tree.TreeNode
children, getAllowsChildren, getIndex
 
Methods inherited from interface it.unitn.disi.smatch.data.matrices.IIndexedObject
getIndex, setIndex
 

Method Detail

getChildAt

INode getChildAt(int childIndex)
Returns the child node at index childIndex.

Specified by:
getChildAt in interface javax.swing.tree.TreeNode

getChildCount

int getChildCount()
Returns the number of children INodes.

Specified by:
getChildCount in interface javax.swing.tree.TreeNode

getChildIndex

int getChildIndex(INode child)
Returns the index of node in the receivers children. If the receiver does not contain node, -1 will be returned.

Parameters:
child - a node to search for
Returns:
the index of node in the receivers children

getChildren

java.util.Iterator<INode> getChildren()
Returns the iterator over the children of the receiver.

Returns:
the iterator over the children of the receiver

getChildrenList

java.util.List<INode> getChildrenList()
Returns unmodifiable list of receivers children.

Returns:
unmodifiable list of receivers children

createChild

INode createChild()
Creates a child to the given node as the last child.

Returns:
a newly created child

createChild

INode createChild(java.lang.String name)
Creates a child with a name to the given node as the last child.

Parameters:
name - a name for a new child
Returns:
a newly created child

addChild

void addChild(INode child)
Adds a child to the given node as the last child.

Parameters:
child - node to add

addChild

void addChild(int index,
              INode child)
Adds child to the receiver at index.

Parameters:
index - index where the child will be added
child - node to add

removeChild

void removeChild(int index)
Removes the child at index from the receiver.

Parameters:
index - index of a child to remove

removeChild

void removeChild(INode node)
Removes node from the receiver.

Parameters:
node - child to remove

getParent

INode getParent()
Returns the parent of the receiver.

Specified by:
getParent in interface javax.swing.tree.TreeNode

setParent

void setParent(INode newParent)
Sets the parent of the receiver to newParent.

Parameters:
newParent - new parent

hasParent

boolean hasParent()
Returns true if the receiver has a parent and false otherwise.

Returns:
true if the receiver has a parent and false otherwise

removeFromParent

void removeFromParent()
Removes the subtree rooted at this node from the tree, giving this node a null parent. Does nothing if this node is the root of its tree.

Specified by:
removeFromParent in interface javax.swing.tree.MutableTreeNode

isLeaf

boolean isLeaf()
Returns true if the receiver is a leaf.

Specified by:
isLeaf in interface javax.swing.tree.TreeNode
Returns:
true if the receiver is a leaf

getAncestorCount

int getAncestorCount()
Returns the count of ancestor nodes.

Returns:
the count of ancestor nodes

getAncestors

java.util.Iterator<INode> getAncestors()
Returns ancestors of the receiver. The returned list is ordered from the parent node to the root.

Returns:
ancestors of the receiver

getAncestorsList

java.util.List<INode> getAncestorsList()
Returns unmodifiable list of receivers ancestors.

Returns:
unmodifiable list of receivers ancestors

getLevel

int getLevel()
Returns the number of levels above this node -- the distance from the root to this node. If this node is the root, returns 0.

Returns:
the number of levels above this node

getDescendantCount

int getDescendantCount()
Returns the count of descendant nodes.

Returns:
the count of descendant nodes

getDescendants

java.util.Iterator<INode> getDescendants()
Returns descendants of the receiver. The descendants are ordered breadth first.

Returns:
descendants of the receiver

getDescendantsList

java.util.List<INode> getDescendantsList()
Returns unmodifiable list of receivers descendants.

Returns:
unmodifiable list of receivers descendants

getNodeData

INodeData getNodeData()
Returns interface to the node metadata.

Returns:
interface to the node metadata

addTreeStructureChangedListener

void addTreeStructureChangedListener(ITreeStructureChangedListener l)
Adds a listener l to the the listener list.

Parameters:
l - listener

removeTreeStructureChangedListener

void removeTreeStructureChangedListener(ITreeStructureChangedListener l)
Removes a listener l from the listeners list.

Parameters:
l - listener

fireTreeStructureChanged

void fireTreeStructureChanged(INode node)
Fires the tree structure changed event.

Parameters:
node - the root of the tree which is changed


© 2010-2011 Knowdive @ DISI