org.wilmascope.graph
Class Edge

java.lang.Object
  extended by org.wilmascope.graph.GraphElement
      extended by org.wilmascope.graph.Edge

public class Edge
extends GraphElement

An Edge links two nodes


Field Summary
 
Fields inherited from class org.wilmascope.graph.GraphElement
layout, owner, view, visible
 
Constructor Summary
Edge()
           
Edge(Node start, Node end)
          Creates an edge between two nodes
Edge(Node start, Node end, EdgeView view)
          Creates an edge between two nodes, and sets the view
 
Method Summary
 void collapse(Cluster cluster, Node node)
          used to temporarily change the edge to point to cluster instead of node (assuming node is one of the edge's nodes).
 void delete()
          Delete all references to this edge...
 void expand(Cluster cluster)
          undoes the effect of collapse(org.wilmascope.graph.Cluster, org.wilmascope.graph.Node) for a given cluster
 Node getEnd()
           
 EdgeLayout getLayout()
           
 float getLength()
           
 Node getNeighbour(Node node)
          If node is one of the nodes connected by the edge, this method returns it's partner.
 java.util.Properties getProperties()
          Any properties loaded or saved in files con be stored in a Properties object.
 Node getStart()
           
 javax.vecmath.Vector3f getVector()
           
 EdgeView getView()
           
 float getWeight()
           
 boolean hasVertices(Node u, Node v)
          Undirected comparison of the ends of this edge against the specified nodes
 boolean isDirected()
           
 void recalculate()
           
 void recalculateMultiEdgeOffsets()
          When multiple edges exist between a pair of nodes we want them offset from each other by a small amount so that they are both visible.
 void reverseDirection()
          swap the start and end nodes so that the edge effectively reverses direction
 void setEnd(Node newEnd)
          Sets a new end Node for this edge.
 void setLayout(EdgeLayout layout)
          Associates an EdgeLayout object with this edge
 void setProperties(java.util.Properties p)
           
 void setStart(Node newStart)
          Sets a new start Node for this edge.
 void setVector(javax.vecmath.Vector3f v)
           
 void setView(EdgeView view)
          Associates a (EdgeView) view object with this edge.
 void setWeight(float weight)
           
 
Methods inherited from class org.wilmascope.graph.GraphElement
draw, 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

Edge

public Edge()

Edge

public Edge(Node start,
            Node end)
Creates an edge between two nodes

Parameters:
start - Node
end - Node

Edge

public Edge(Node start,
            Node end,
            EdgeView view)
Creates an edge between two nodes, and sets the view

Parameters:
start - Node
end - Node
view - EdgeView
Method Detail

setView

public void setView(EdgeView view)
Associates a (EdgeView) view object with this edge. (For any edge, there can be only one view object)

Parameters:
view - EdgeView

recalculateMultiEdgeOffsets

public void recalculateMultiEdgeOffsets()
When multiple edges exist between a pair of nodes we want them offset from each other by a small amount so that they are both visible.


getView

public EdgeView getView()
Returns:
the EdgeView for the edge object. (For any edge object, there can be only one view object)

setLayout

public void setLayout(EdgeLayout layout)
Associates an EdgeLayout object with this edge


getLayout

public EdgeLayout getLayout()
Returns:
EdgeLayout object for this Edge.

getStart

public Node getStart()
Returns:
the start node for this edge

setStart

public void setStart(Node newStart)
Sets a new start Node for this edge.

Parameters:
newStart - - a replacement Node

setEnd

public void setEnd(Node newEnd)
Sets a new end Node for this edge.

Parameters:
newEnd - - a replacement Node

getEnd

public Node getEnd()
Returns:
the End node of this edge.

reverseDirection

public void reverseDirection()
swap the start and end nodes so that the edge effectively reverses direction


getLength

public float getLength()
Returns:
the length of this edge.

getNeighbour

public Node getNeighbour(Node node)
If node is one of the nodes connected by the edge, this method returns it's partner. If node is not a immediately part of the edge, but it is a cluster and one end of the edge is a child or descendant of the cluster then the other end is returned. If all else fails null is returned. It would not be real useful to call this method if node is a Cluster and both ends of the edge are members of the cluster, it will simply always return end in this case.


collapse

public void collapse(Cluster cluster,
                     Node node)
used to temporarily change the edge to point to cluster instead of node (assuming node is one of the edge's nodes). expand(Cluster) undoes the effect.


expand

public void expand(Cluster cluster)
undoes the effect of collapse(org.wilmascope.graph.Cluster, org.wilmascope.graph.Node) for a given cluster


hasVertices

public boolean hasVertices(Node u,
                           Node v)
Undirected comparison of the ends of this edge against the specified nodes

Parameters:
u - either the start or end vertex
v - if u=start then v=end else u=end v=start
Returns:
true if above conditions are met

delete

public void delete()
Delete all references to this edge... make it go away... forever!

Specified by:
delete in class GraphElement

recalculate

public void recalculate()

setVector

public void setVector(javax.vecmath.Vector3f v)

getVector

public javax.vecmath.Vector3f getVector()

isDirected

public boolean isDirected()

setWeight

public void setWeight(float weight)

getWeight

public float getWeight()

getProperties

public java.util.Properties getProperties()
Description copied from class: GraphElement
Any properties loaded or saved in files con be stored in a Properties object. This method is called to extract the GraphElement's properties when the file is created.

Specified by:
getProperties in class GraphElement
Returns:
Custom properties associated with this GraphElement.

setProperties

public void setProperties(java.util.Properties p)
Specified by:
setProperties in class GraphElement