prefuse.data.tree
Interface DeclarativeTree<N extends Node<?,?>,E extends Edge<?,?>>

Type Parameters:
N -
E -
All Known Implementing Classes:
AbstractDeclarativeTree, FilteredDeclarativeTree, NodeBasedDeclarativeTree, SpanningTree, Tree, VisualTree

public interface DeclarativeTree<N extends Node<?,?>,E extends Edge<?,?>>

This is intended to be a lightweight means of defining a Tree across an existing Graph.

Implementors can define arbitrary tree structures within their Graphs. SpanningTree implements this interface, and other interfaces can easily be defined.

This interface could be used in user-defined layouts.

Author:
Anton Marsden
See Also:
SpanningTree, NodeBasedDeclarativeTree, DeclarativeTreeLayout

Method Summary
 java.util.List<E> childEdges(N n)
          Get all the edges connecting a child to the parent node.
 java.util.List<N> children(N parent)
          Get all the children of the parent node.
 int getDepth(N n)
          Get the depth of the given node in the tree.
 N getNextSibling(N node)
          Get the next sibling of the given node.
 int getNodeCount()
          Get the number of nodes in this graph.
 N getParent(N child)
          Get a node's parent node
 E getParentEdge(N child)
          Get the edge to the given node's parent.
 N getPreviousSibling(N node)
          Get the previous sibling of the given node.
 N getRoot()
          Get the root node.
 

Method Detail

getRoot

N getRoot()
Get the root node.

Returns:
the root Node

children

java.util.List<N> children(N parent)
Get all the children of the parent node.

Parameters:
n - the parent node
Returns:
an list of the child nodes of the parent node

childEdges

java.util.List<E> childEdges(N n)
Get all the edges connecting a child to the parent node.

Parameters:
n - the parent node
Returns:
an list of the child edge nodes of the parent node

getDepth

int getDepth(N n)
Get the depth of the given node in the tree.

Parameters:
n - a node in the tree
Returns:
the depth of the node in tree. The root node is at a depth level of 0, with each child at a greater depth level. -1 is returned if the input node id is not in the tree.

getParent

N getParent(N child)
Get a node's parent node

Parameters:
n - the child node
Returns:
the parent node, or null if there is no parent

getParentEdge

E getParentEdge(N child)
Get the edge to the given node's parent.

Parameters:
n - a Node instance
Returns:
the parent Edge connecting the given node to its parent

getPreviousSibling

N getPreviousSibling(N node)
Get the previous sibling of the given node.

Parameters:
node - a node
Returns:
the previous sibling, or null if there is no previous sibling

getNextSibling

N getNextSibling(N node)
Get the next sibling of the given node.

Parameters:
node - a node
Returns:
the next sibling, or null if there is no next sibling

getNodeCount

int getNodeCount()
Get the number of nodes in this graph.

Returns:
the number of nodes


Copyright © 2008 Regents of the University of California