com.alexmerz.graphviz.objects
Class Edge

java.lang.Object
  extended by com.alexmerz.graphviz.objects.Edge

public class Edge
extends java.lang.Object

This class represents an Edge in a Graph. Each Edge has a source Node and a target Node. Both nodes may contain port information. The type attribute is currently a nice-to-have because only directed edges are only allowed in 'Digraphs', and undirected in 'Graphs'.

Version:
$Id: Edge.java,v 1.3 2006/03/20 16:45:41 Alexander Exp $
Author:
Alexander Merz

Constructor Summary
Edge()
          Creates an empty edge object
Edge(PortNode source, PortNode target, int type)
          Creates an Edge
 
Method Summary
 java.lang.String getAttribute(java.lang.String key)
          Returns the value of an edge attribute
 java.util.Hashtable<java.lang.String,java.lang.String> getAttributes()
          Returns all attributes of this edge
 PortNode getSource()
          Returns the source node of the edge
 PortNode getTarget()
          Returns the target node of the edge
 int getType()
          Returns the type of the edge.
 void setAttribute(java.lang.String key, java.lang.String value)
          Sets the value of an attribute
 void setSource(PortNode source)
          Sets the source node of the edge
 void setTarget(PortNode target)
          Sets the target node of the edge
 void setType(int type)
          Sets the type of the edge
 java.lang.String toString()
          Returns the String representation of the edge
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Edge

public Edge()
Creates an empty edge object


Edge

public Edge(PortNode source,
            PortNode target,
            int type)
Creates an Edge

Parameters:
source - the source Node
target - the target Node
type - the edge type
Method Detail

getSource

public PortNode getSource()
Returns the source node of the edge

Returns:
the source node

setSource

public void setSource(PortNode source)
Sets the source node of the edge

Parameters:
source - the source node

getTarget

public PortNode getTarget()
Returns the target node of the edge

Returns:
the target node

setTarget

public void setTarget(PortNode target)
Sets the target node of the edge

Parameters:
target - the target Node

getType

public int getType()
Returns the type of the edge.

Returns:
the type of the edge
See Also:
Graph.UNDIRECTED, Graph.DIRECTED

setType

public void setType(int type)
Sets the type of the edge

Parameters:
type - the type of the edge
See Also:
Graph.UNDIRECTED, Graph.DIRECTED

toString

public java.lang.String toString()
Returns the String representation of the edge

Overrides:
toString in class java.lang.Object
Returns:
the string representation

getAttribute

public java.lang.String getAttribute(java.lang.String key)
Returns the value of an edge attribute

Parameters:
key - the name of the attribute
Returns:
the value of the attribute

setAttribute

public void setAttribute(java.lang.String key,
                         java.lang.String value)
Sets the value of an attribute

Parameters:
key - the name of the attribute
value - the value of the attribute

getAttributes

public java.util.Hashtable<java.lang.String,java.lang.String> getAttributes()
Returns all attributes of this edge

Returns:
the attributes