infovis.tree
Class TreeProxy

java.lang.Object
  extended by infovis.utils.ChangeManager
      extended by infovis.column.AbstractColumn
          extended by infovis.column.ColumnProxy
              extended by infovis.table.TableProxy
                  extended by infovis.table.DynamicTableProxy
                      extended by infovis.tree.TreeProxy
All Implemented Interfaces:
IntComparator, Column, DynamicTable, Metadata, Constants, Table, Tree, RowComparator, Serializable, EventListener, ChangeListener, TableModelListener, TableModel, TreeModel
Direct Known Subclasses:
TreeAsGraph

public class TreeProxy
extends DynamicTableProxy
implements Tree

Version:
$Revision: 1.8 $
Author:
Jean-Daniel Fekete
See Also:
Serialized Form

Field Summary
 
Fields inherited from class infovis.column.AbstractColumn
MODIFIED_ALL, MODIFIED_NONE
 
Fields inherited from interface infovis.Tree
ROOT, TREE_METADATA
 
Fields inherited from interface infovis.Table
FILTER_COLUMN, INTERNAL_PREFIX, NIL, SELECTION_COLUMN
 
Fields inherited from interface infovis.metadata.Constants
CONTRIBUTOR, COVERAGE, CREATOR, DATE, DESCRITION, FORMAT, IDENTIFIER, LANGUAGE, PUBLISHER, RELATION, RIGHTS, SOURCE, SUBJECT, TITLE, TYPE
 
Constructor Summary
TreeProxy(Tree tree)
           
 
Method Summary
 int addNode(int par)
          Adds a node to the tree.
 void addTreeModelListener(TreeModelListener l)
           
 RowIterator childrenIterator(int node)
          Returns the iterator over the children of a node.
 int getChild(int node, int index)
          Returns the nth child of a node.
 Object getChild(Object parent, int index)
           
 int getChildCount(int node)
          Returns the number of children of a node.
 int getChildCount(Object parent)
           
 int getDepth(int node)
          Returns the depth of a node using either a depth column if it has been computed or the computeDepth method.
 int getIndexOfChild(Object parent, Object child)
           
 int getNodeCount()
          Returns the number of proper nodes in the Tree.
 int getParent(int node)
          Returns the parent of a node.
 Object getRoot()
           
 Tree getTree()
           
 boolean isAncestor(int node, int par)
          Returns true if the first node has the second node as ancestor.
 boolean isLeaf(int node)
          Returns true if the node is a leaf_node.
 boolean isLeaf(Object node)
           
 int nextNode()
          Returns the next node to be returned by addNode.
 boolean removeNode(int node)
          Removes a node from the tree.
 void removeTreeModelListener(TreeModelListener l)
           
 void reparent(int node, int newparent)
          Change the parent of a specified node, changing the structure.
 void valueForPathChanged(TreePath path, Object newValue)
           
 
Methods inherited from class infovis.table.DynamicTableProxy
addRow, getDynamicTable, removeRow
 
Methods inherited from class infovis.table.TableProxy
addColumn, addTableModelListener, clear, getColumn, getColumnAt, getColumnClass, getColumnCount, getColumnName, getLastRow, getRowCount, getTable, getValueAt, indexOf, indexOf, isCellEditable, isRowValid, removeColumn, removeTableModelListener, reverseIterator, setColumnAt, setValueAt, tableChanged
 
Methods inherited from class infovis.column.ColumnProxy
addValue, addValueOrNull, capacity, compare, dispose, ensureCapacity, getClientProperty, getFormat, getMaxIndex, getMetadata, getMinIndex, getName, getValueAt, getValueClass, hasUndefinedValue, isEmpty, isInternal, isValueUndefined, iterator, setFormat, setName, setSize, setValueAt, setValueOrNullAt, setValueUndefined, size, stateChanged
 
Methods inherited from class infovis.column.AbstractColumn
addChangeListener, compareValues, computeValueMap, computeValueMap, equalObj, equals, getLastModifiedRow, toString
 
Methods inherited from class infovis.utils.ChangeManager
disableNotify, enableNotify, getModCount, removeChangeListener
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface infovis.DynamicTable
addRow, removeRow
 
Methods inherited from interface infovis.Table
addColumn, clear, getColumn, getColumnAt, getColumnCount, getLastRow, getRowCount, getTable, indexOf, indexOf, isRowValid, removeColumn, reverseIterator, setColumnAt
 
Methods inherited from interface infovis.Column
addChangeListener, addValue, addValueOrNull, capacity, disableNotify, enableNotify, ensureCapacity, getFormat, getMaxIndex, getMinIndex, getName, getValueAt, getValueClass, hasUndefinedValue, isEmpty, isInternal, isValueUndefined, iterator, removeChangeListener, setFormat, setName, setSize, setValueAt, setValueOrNullAt, setValueUndefined, size
 
Methods inherited from interface infovis.Metadata
getClientProperty, getMetadata
 
Methods inherited from interface cern.colt.function.IntComparator
compare, equals
 
Methods inherited from interface javax.swing.table.TableModel
addTableModelListener, getColumnClass, getColumnName, getValueAt, isCellEditable, removeTableModelListener, setValueAt
 

Constructor Detail

TreeProxy

public TreeProxy(Tree tree)
Method Detail

getTree

public Tree getTree()

addNode

public int addNode(int par)
Description copied from interface: Tree
Adds a node to the tree.

Specified by:
addNode in interface Tree
Parameters:
par - the parent of the node.
Returns:
the created node.

childrenIterator

public RowIterator childrenIterator(int node)
Description copied from interface: Tree
Returns the iterator over the children of a node.

Specified by:
childrenIterator in interface Tree
Parameters:
node - the node
Returns:
the iterator over the children of the node

getChild

public int getChild(int node,
                    int index)
Description copied from interface: Tree
Returns the nth child of a node.

Specified by:
getChild in interface Tree
Parameters:
node - the node
index - the index if the requested child
Returns:
the requested child or NIL if node has not so many children.

getChildCount

public int getChildCount(int node)
Description copied from interface: Tree
Returns the number of children of a node.

Specified by:
getChildCount in interface Tree
Parameters:
node - the node.
Returns:
the number of children of a node.

getDepth

public int getDepth(int node)
Description copied from interface: Tree
Returns the depth of a node using either a depth column if it has been computed or the computeDepth method.

Specified by:
getDepth in interface Tree
Parameters:
node - the node.
Returns:
the depth of the node.

getParent

public int getParent(int node)
Description copied from interface: Tree
Returns the parent of a node.

Specified by:
getParent in interface Tree
Parameters:
node - the node
Returns:
the parent or the NIL value if node is the top node

isAncestor

public boolean isAncestor(int node,
                          int par)
Description copied from interface: Tree
Returns true if the first node has the second node as ancestor.

Specified by:
isAncestor in interface Tree
Parameters:
node - the node.
par - the tested ancestor.
Returns:
true if the first node has the second node as ancestor.

isLeaf

public boolean isLeaf(int node)
Description copied from interface: Tree
Returns true if the node is a leaf_node. Use this method rather than degree(node)==0

Specified by:
isLeaf in interface Tree
Parameters:
node - the node
Returns:
true if the node is a leaf_node.

nextNode

public int nextNode()
Description copied from interface: Tree
Returns the next node to be returned by addNode.

Specified by:
nextNode in interface Tree
Returns:
the next node to be returned by addNode.

reparent

public void reparent(int node,
                     int newparent)
Description copied from interface: Tree
Change the parent of a specified node, changing the structure.

Specified by:
reparent in interface Tree
Parameters:
node - the node.
newparent - the new parent.

removeNode

public boolean removeNode(int node)
Description copied from interface: Tree
Removes a node from the tree.

Specified by:
removeNode in interface Tree
Parameters:
node - the node to remove
Returns:
true if the node has been removed.

getNodeCount

public int getNodeCount()
Description copied from interface: Tree
Returns the number of proper nodes in the Tree. Can be different than the value returned by getRowCount if nodes have been removed.

Specified by:
getNodeCount in interface Tree
Returns:
the number of proper nodes in the Tree.

addTreeModelListener

public void addTreeModelListener(TreeModelListener l)
Specified by:
addTreeModelListener in interface TreeModel

getChild

public Object getChild(Object parent,
                       int index)
Specified by:
getChild in interface TreeModel

getChildCount

public int getChildCount(Object parent)
Specified by:
getChildCount in interface TreeModel

getIndexOfChild

public int getIndexOfChild(Object parent,
                           Object child)
Specified by:
getIndexOfChild in interface TreeModel

getRoot

public Object getRoot()
Specified by:
getRoot in interface TreeModel

isLeaf

public boolean isLeaf(Object node)
Specified by:
isLeaf in interface TreeModel

removeTreeModelListener

public void removeTreeModelListener(TreeModelListener l)
Specified by:
removeTreeModelListener in interface TreeModel

valueForPathChanged

public void valueForPathChanged(TreePath path,
                                Object newValue)
Specified by:
valueForPathChanged in interface TreeModel


Copyright © 2005 by Jean-Daniel Fekete and INRIA, France All rights reserved.