Package com.alexmerz.graphviz.objects
Class Edge
- java.lang.Object
-
- com.alexmerz.graphviz.objects.Edge
-
public class Edge extends 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'.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetAttribute(String key)Returns the value of an edge attributeHashtable<String,String>getAttributes()Returns all attributes of this edgePortNodegetSource()Returns the source node of the edgePortNodegetTarget()Returns the target node of the edgeintgetType()Returns the type of the edge.voidsetAttribute(String key, String value)Sets the value of an attributevoidsetSource(PortNode source)Sets the source node of the edgevoidsetTarget(PortNode target)Sets the target node of the edgevoidsetType(int type)Sets the type of the edgeStringtoString()Returns the String representation of the edge
-
-
-
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 String toString()
Returns the String representation of the edge
-
getAttribute
public String getAttribute(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(String key, String value)
Sets the value of an attribute- Parameters:
key- the name of the attributevalue- the value of the attribute
-
-