Package org.graffiti.graph
Interface Edge
- All Superinterfaces:
Attributable,Comparable<GraphElement>,GraphElement
- All Known Implementing Classes:
AbstractEdge,AdjListEdge
public interface Edge extends GraphElement
Provides an interfaces for a
GraphEdge. An
Edge consists of source and target, directed edges point from
source to target. Source, target and Edge must belong to the
same Graph. Otherwise the copy-methods of the interface
org.grafitti.graph.Graph have to be used.- Version:
- $Revision: 1.4 $
- See Also:
GraphElement,Node,Graph
-
Field Summary
Fields Modifier and Type Field Description static booleanDIRECTEDIndicates that anEdgeis directed.static booleanUNDIRECTEDIndicates that anEdgeis undirected. -
Method Summary
Modifier and Type Method Description NodegetSource()Returns the source of the currentEdge.NodegetTarget()Returns the target of the currentEdge.booleanisDirected()Returnstrue, if theEdgeis directed,falseotherwise.voidreverse()Changes source and target of theEdge, that means if theEdgeis directed the direction will be changed.voidsetDirected(boolean directed)Determines if anEdgeis directed (true) or not.voidsetGraph(Graph graph)voidsetSource(Node source)Sets the source of the currentEdgeto source.voidsetTarget(Node target)Sets the target of the currentEdgeto target.Methods inherited from interface org.graffiti.attributes.Attributable
addAttribute, addBoolean, addByte, addDouble, addFloat, addInteger, addLong, addShort, addString, changeBoolean, changeByte, changeDouble, changeFloat, changeInteger, changeLong, changeShort, changeString, getAttribute, getAttributes, getBoolean, getByte, getDouble, getFloat, getInteger, getListenerManager, getLong, getShort, getString, removeAttribute, setBoolean, setByte, setDouble, setFloat, setInteger, setLong, setShort, setStringMethods inherited from interface java.lang.Comparable
compareTo
-
Field Details
-
DIRECTED
static final boolean DIRECTEDIndicates that anEdgeis directed.- See Also:
- Constant Field Values
-
UNDIRECTED
static final boolean UNDIRECTEDIndicates that anEdgeis undirected.- See Also:
- Constant Field Values
-
-
Method Details
-
setDirected
void setDirected(boolean directed)Determines if anEdgeis directed (true) or not.- Parameters:
directed-true, if theEdgeis destined to be directed,falseotherwise.
-
isDirected
boolean isDirected()Returnstrue, if theEdgeis directed,falseotherwise.- Returns:
true, if theEdgeis directed,falseotherwise.
-
setSource
Sets the source of the currentEdgeto source.sourcemust be contained in the sameGraphas the currentEdge. Informs the ListenerManager about the change.- Parameters:
source- the source to be set.- Throws:
GraphElementNotFoundException- if source cannot be found in theGraph.IllegalArgumentException- if source belongs to a differentGraph.
-
getSource
Node getSource()Returns the source of the currentEdge.- Returns:
- the source of the current
Edge.
-
setTarget
Sets the target of the currentEdgeto target.targetmust be contained in the sameGraphas theEdge. Informs the ListenerManager about the change.- Parameters:
target- the target to be set.- Throws:
GraphElementNotFoundException- if the target cannot be found in theGraph.IllegalArgumentException- if target belongs to a differentGraph.
-
getTarget
Node getTarget()Returns the target of the currentEdge.- Returns:
- the target of the current
Edge.
-
reverse
void reverse()Changes source and target of theEdge, that means if theEdgeis directed the direction will be changed. -
setGraph
- Parameters:
graph-
-