|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.wilmascope.graph.GraphElement
org.wilmascope.graph.Node
org.wilmascope.graph.Cluster
public class Cluster
a Cluster is a set of Nodes (Node) and Edges (Edge)
sharing the same (LayoutEngine). This class is the main interface
to the graph package for adding GraphElements to a graph hierarchy.
| Field Summary |
|---|
| Fields inherited from class org.wilmascope.graph.GraphElement |
|---|
layout, owner, view, visible |
| Constructor Summary | |
|---|---|
Cluster()
The default constructor - an empty cluster |
|
Cluster(Cluster original)
Creates a new cluster with duplicate nodes and edges to the argument. |
|
Cluster(NodeView view)
Create a new cluster with the specified NodeView |
|
| Method Summary | |
|---|---|
void |
addBalancedEventListener(BalancedEventListener l)
|
void |
addEdge(Edge e)
Add an Edgeto the Cluster Note that the edge may not finish up
being added to this cluster, it will be added to the lowest common ancestor
of the two ends of the edge. |
protected void |
addInternalEdgeHere(Edge e)
Add an internal edge to this cluster... |
float |
addMass(float newMass)
On adding or removing a node from the cluster the mass of the cluster will change, and a positive or negative contribution to the mass will have to be added, not only to this cluster, but to parent clusters as well. |
void |
addNode(Node node)
Add a Nodeto the Cluster |
void |
addNodes(NodeList startNodes)
Add the specified nodes to this cluster |
boolean |
applyLayout()
applies the layout changes calculated in calculateLayout()to the contents of
this cluster and all subclusters |
void |
calculateLayout()
Find a new layout for the nodes according to the current graph and layout engine |
void |
collapse()
|
void |
delete()
delete a cluster and its contents |
void |
draw()
draw the element if it's visible |
void |
expand(GraphCanvas graphCanvas)
|
EdgeList |
getAcyclicEdgeSet_EnhancedGreedy()
Uses a tricky heuristic (Eades et al. |
EdgeList |
getAcyclicEdgeSet_Greedy()
Finds an acyclic subset Ea of this cluster's edges E such that |Ea|>=|E|/2 using a simple greedy heuristic (Berger and Shor, 1990). |
NodeList |
getAllNodes()
|
EdgeList |
getInternalEdges()
Get the edges internal to this cluster, ie, only those edges connecting a pair of nodes that are both inside this cluster |
LayoutEngine |
getLayoutEngine()
Get the LayoutEngineused by the cluster |
NodeList |
getNodes()
|
Node |
getPortalNode(Edge edge)
An external edge is one which has one end in this cluster and one end in another cluster that is not a child (or descendent) of this cluster. |
void |
hideChildren()
|
boolean |
isAncestor(Node node)
Check if the specified node is a child of this cluster or one of this cluster's child clusters etc recursively |
boolean |
isBalanced()
|
boolean |
isExpanded()
|
void |
moveToParent(Node n)
shift a Node up from this Cluster to its parent cluster |
protected void |
remove(GraphElement e)
remove a graph element (ie node or edge) from this cluster |
protected void |
removeEdge(Edge e)
Remove an Edgefrom the Cluster. |
protected void |
removeExternalEdge(Edge e)
remove an edge that is external to this cluster. |
protected void |
removeNode(Node n)
remove a Node up from this Cluster |
void |
setLayoutEngine(LayoutEngine l)
Set the LayoutEnginefor the cluster |
void |
setMass(float newMass)
When the mass of this cluster changes, due to an addition or removal of a node from the cluster or by a user call to this method, the mass of the parent cluster must also be recalculated |
void |
showChildren(GraphCanvas gc)
|
| Methods inherited from class org.wilmascope.graph.Node |
|---|
getCommonAncestor, getCommonEdges, getDegree, getEdges, getInDegree, getInEdges, getLayout, getMass, getNeighbours, getOutDegree, getOutEdges, getPosition, getProperties, getView, isNeighbour, reposition, setEdges, setLayout, setPosition, setProperties, setView |
| Methods inherited from class org.wilmascope.graph.GraphElement |
|---|
getOwner, getUserData, hide, isVisible, setOwner, show, storeUserData |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Cluster()
public Cluster(Cluster original)
original - public Cluster(NodeView view)
NodeView
| Method Detail |
|---|
public NodeList getNodes()
public void addNode(Node node)
Nodeto the Cluster
node - the Node to addpublic EdgeList getInternalEdges()
Node.getEdges()public boolean isAncestor(Node node)
node - node ancestory of
public void moveToParent(Node n)
Node up from this Cluster to its parent cluster
n - which Node to removeprotected void removeNode(Node n)
Node up from this Cluster
n - which Node to removepublic void addEdge(Edge e)
Edgeto the Cluster Note that the edge may not finish up
being added to this cluster, it will be added to the lowest common ancestor
of the two ends of the edge.
addEdge in class Nodee - the edge to addpublic Node getPortalNode(Edge edge)
edge - an edge external to this clusterprotected void addInternalEdgeHere(Edge e)
protected void remove(GraphElement e)
protected void removeEdge(Edge e)
Edgefrom the Cluster. Will work with either an internal
or external edge.
removeEdge in class Nodeprotected void removeExternalEdge(Edge e)
removeEdge(org.wilmascope.graph.Edge)
removeEdge(org.wilmascope.graph.Edge)public boolean isExpanded()
public void draw()
GraphElement
draw in class GraphElementpublic void setLayoutEngine(LayoutEngine l)
LayoutEnginefor the cluster
public LayoutEngine getLayoutEngine()
LayoutEngineused by the cluster
public void hideChildren()
public void showChildren(GraphCanvas gc)
public NodeList getAllNodes()
public void collapse()
public void expand(GraphCanvas graphCanvas)
public void calculateLayout()
public boolean applyLayout()
calculateLayout()to the contents of
this cluster and all subclusters
public void delete()
delete in class Nodepublic void addNodes(NodeList startNodes)
public float addMass(float newMass)
setMass(float)
public void setMass(float newMass)
setMass in class Nodepublic void addBalancedEventListener(BalancedEventListener l)
public boolean isBalanced()
public EdgeList getAcyclicEdgeSet_Greedy()
public EdgeList getAcyclicEdgeSet_EnhancedGreedy()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||