|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object infovis.utils.ChangeManager infovis.column.AbstractColumn infovis.column.BasicColumn infovis.column.BasicObjectColumn infovis.column.ColumnColumn infovis.table.DefaultTable infovis.table.DefaultDynamicTable infovis.tree.DefaultTree
public class DefaultTree
Default implementation of the Tree interface.
A DefaultTree
is a Table
proxy, not a
Table
itself (it references a table).
Topology is build using four internal IntColumn
s:
#child
contains the index of the first child of a node
or NIL if the node is a leaf
#next
contains the index of the next sibling of a node
#last
contains the index of the last child of a node
Field Summary | |
---|---|
static String |
CHILD_COLUMN
Name of the IntColumn referencing the first child of a node. |
static String |
LAST_COLUMN
Name of the IntColumn referencing the last child of a node. |
static String |
NEXT_COLUMN
Name of the IntColumn referencing the next sibling of a node. |
static String |
PARENT_COLUMN
Name of the IntColumn referencing the parent of a node. |
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 | |
---|---|
DefaultTree()
Creates a new DefaultTree object. |
Method Summary | |
---|---|
int |
addNode(int par)
Adds a node to the tree. |
int |
addRow()
Creates a new row and returns it. |
void |
addTreeModelListener(TreeModelListener l)
|
Object[] |
buildPath(int node)
|
int[] |
children(int node)
Returns a table of children of this node. |
RowIterator |
childrenIterator(int node)
Returns the iterator over the children of a node. |
void |
clear()
Removes all of the elements from this column. The Column will be empty after this call returns. WARNING: if there is an associated format that maintains a status, such as a CategoricalFormat , it
is not cleared so results may not be what you expected. The
CategoricalFormat can be cleared explicitely if
needed. |
int |
computeDegree(int node)
Returns the degree of a node, i˙e˙ the number of children. |
int |
computeDepth(int node)
Computes the depth of the node in the tree and return it. |
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 degree of a node using either a degree column if it has been computed or the computeDegree method. |
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 |
getFirstChild(int node)
Returns the first child of a node. |
int |
getIndexOfChild(int node)
|
int |
getIndexOfChild(Object parent,
Object child)
|
int |
getLastChild(int node)
Returns the last child of a node. |
int |
getNextSibling(int node)
Returns the next sibling of a node. |
int |
getNodeCount()
Returns the number of proper nodes in the Tree. |
int |
getParent(int node)
Returns the parent of a node. |
Object |
getRoot()
|
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)
|
infovis.tree.DefaultTree.LeafIterator |
leafIterator()
|
int |
nextNode()
Returns the next node to be returned by addNode. |
boolean |
removeNode(int node)
Removes a node from the tree. |
void |
removeRow(int row)
Removes a specified row. |
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)
|
void |
visit(BreadthFirst.Visitor visitor)
Traverse the tree with a depth first traversal, calling the visitor at each node. |
void |
visit(DepthFirst.Visitor visitor)
Traverse the tree with a depth first traversal, calling the visitor at each node. |
void |
visit(DepthFirst.Visitor visitor,
int root)
Traverse the tree with a depth first traversal, calling the visitor at each node from a specified root. |
Methods inherited from class infovis.table.DefaultDynamicTable |
---|
getLastRow, getRowCount, isRowValid, iterator, reverseIterator |
Methods inherited from class infovis.column.ColumnColumn |
---|
add, compare, compare, definedValue, fill, findColumn, get, getColumn, getColumn, getValueClass, set, setExtend |
Methods inherited from class infovis.column.BasicObjectColumn |
---|
add, capacity, compare, compareValues, ensureCapacity, fill, format, getObjectAt, getOrder, getValueAt, getValueReference, hasUndefinedValue, indexOf, isValueUndefined, parse, remove, remove, setExtend, setObjectAt, setOrder, setSize, setValueAt, setValueUndefined, size |
Methods inherited from class infovis.column.BasicColumn |
---|
addValue, addValueOrNull, firstValidRow, getClientProperty, getFormat, getMaxIndex, getMetadata, getMinIndex, getName, isEmpty, isInternal, lastValidRow, setFormat, setName, setValueOrNullAt, toString |
Methods inherited from class infovis.column.AbstractColumn |
---|
addChangeListener, computeValueMap, computeValueMap, equalObj, equals, getLastModifiedRow |
Methods inherited from class infovis.utils.ChangeManager |
---|
getModCount, removeChangeListener |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface infovis.Table |
---|
addColumn, 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 |
Field Detail |
---|
public static final String CHILD_COLUMN
public static final String NEXT_COLUMN
public static final String LAST_COLUMN
public static final String PARENT_COLUMN
Constructor Detail |
---|
public DefaultTree()
Method Detail |
---|
public void clear()
DefaultDynamicTable
CategoricalFormat
, it
is not cleared so results may not be what you expected. The
CategoricalFormat
can be cleared explicitely if
needed.
clear
in interface Column
clear
in interface Table
clear
in class DefaultDynamicTable
Table.clear()
public int addRow()
DefaultDynamicTable
addRow
in interface DynamicTable
addRow
in class DefaultDynamicTable
public void removeRow(int row)
DefaultDynamicTable
removeRow
in interface DynamicTable
removeRow
in class DefaultDynamicTable
row
- the row to remove.public int getChild(int node, int index)
Tree
getChild
in interface Tree
node
- the nodeindex
- the index if the requested child
Tree.getChild(int, int)
public int getParent(int node)
getParent
in interface Tree
node
- the node
public RowIterator childrenIterator(int node)
childrenIterator
in interface Tree
node
- the node
public infovis.tree.DefaultTree.LeafIterator leafIterator()
public int addNode(int par)
addNode
in interface Tree
par
- the parent of the node.
ArrayIndexOutOfBoundsException
- DOCUMENT ME!public int getNodeCount()
Tree
getNodeCount
in interface Tree
public boolean removeNode(int node)
Tree
removeNode
in interface Tree
node
- the node to remove
public int nextNode()
nextNode
in interface Tree
public void reparent(int node, int newparent)
reparent
in interface Tree
node
- the node.newparent
- the new parent.
RuntimeException
- if the node is an ancestor of the parent.public boolean isAncestor(int node, int par)
isAncestor
in interface Tree
node
- the node.par
- the tested ancestor.
public int getIndexOfChild(int node)
public int getDepth(int node)
getDepth
in interface Tree
node
- the node.
public int getChildCount(int node)
getChildCount
in interface Tree
node
- the node.
public int getFirstChild(int node)
node
- the node
public int getNextSibling(int node)
node
- the node
public int getLastChild(int node)
node
- the node
public int computeDepth(int node)
node
- the node.
public int computeDegree(int node)
node
- the node
public boolean isLeaf(int node)
isLeaf
in interface Tree
node
- the node
public int[] children(int node)
node
- the node.
public void visit(DepthFirst.Visitor visitor)
visitor
- the DepthFirstVisitor
.public void visit(DepthFirst.Visitor visitor, int root)
visitor
- the DepthFirstVisitor
.root
- the starting node.public void visit(BreadthFirst.Visitor visitor)
visitor
- the DepthFirstVisitor
.public Object getRoot()
getRoot
in interface TreeModel
public Object getChild(Object parent, int index)
getChild
in interface TreeModel
public int getChildCount(Object parent)
getChildCount
in interface TreeModel
public boolean isLeaf(Object node)
isLeaf
in interface TreeModel
public void valueForPathChanged(TreePath path, Object newValue)
valueForPathChanged
in interface TreeModel
public int getIndexOfChild(Object parent, Object child)
getIndexOfChild
in interface TreeModel
public void addTreeModelListener(TreeModelListener l)
addTreeModelListener
in interface TreeModel
public void removeTreeModelListener(TreeModelListener l)
removeTreeModelListener
in interface TreeModel
public Object[] buildPath(int node)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |