N
- Node class of the GraphE
- Edge class of the graphpublic class TreeGraph<N extends javax.swing.tree.DefaultMutableTreeNode,E> extends DirectedGraph<N,E>
Modifier and Type | Class and Description |
---|---|
static class |
TreeGraph.EdgePolicy
Determines whether an edge is acceptible to add to a TreeGraph
|
Constructor and Description |
---|
TreeGraph()
Instantiates a new empty tree graph with an EdgePolicy of ANY.
|
TreeGraph(Graph<? extends N,? extends E> graph)
Instantiates a new tree graph with data copied from the specified graph,
and an edge policy of ANY
|
TreeGraph(TreeGraph.EdgePolicy policy)
Instantiates a new tree graph with a specified edge policy
|
TreeGraph(TreeGraph.EdgePolicy policy,
Graph<? extends N,? extends E> graph)
Instantiates a new tree graph with data copied from the specified graph,
and the specified edge policy
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(N node)
Add a tree node to the graph.
|
boolean |
addEdge(E edge,
N orig,
N dest)
Add an edge to the graph.
|
TreeGraph<N,E> |
getChildGraph(N parent)
Gets the child graph.
|
TreeGraph.EdgePolicy |
getEdgePolicy()
Gets the edge policy.
|
boolean |
remove(java.lang.Object obj)
Remove the node from the graph.
|
java.lang.String |
toString()
Return a string representation of this graph
|
getEdge, getEdgeSegment, getEdgeSet, getNodeSet, getSegmentSet, isDirected
addAll, clear, contains, containsEdge, edgeIterator, equals, getNodeEdges, hashCode, isEmpty, iterator, order, removeEdge, size
public TreeGraph()
public TreeGraph(TreeGraph.EdgePolicy policy)
policy
- the edge policypublic TreeGraph(TreeGraph.EdgePolicy policy, Graph<? extends N,? extends E> graph)
policy
- the edge policygraph
- the graph to copy data frompublic boolean add(N node)
public boolean addEdge(E edge, N orig, N dest)
addEdge
in interface Graph<N extends javax.swing.tree.DefaultMutableTreeNode,E>
addEdge
in class DirectedGraph<N extends javax.swing.tree.DefaultMutableTreeNode,E>
edge
- The edgeorig
- the origin nodedest
- the destination nodepublic TreeGraph<N,E> getChildGraph(N parent)
parent
- the parentpublic TreeGraph.EdgePolicy getEdgePolicy()
public boolean remove(java.lang.Object obj)
remove
in interface Graph<N extends javax.swing.tree.DefaultMutableTreeNode,E>
remove
in class AbstractGraph<N extends javax.swing.tree.DefaultMutableTreeNode,E>
obj
- the node to removepublic java.lang.String toString()
toString
in class DirectedGraph<N extends javax.swing.tree.DefaultMutableTreeNode,E>