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
Graph
Edge
. 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 boolean
DIRECTED
Indicates that anEdge
is directed.static boolean
UNDIRECTED
Indicates that anEdge
is undirected. -
Method Summary
Modifier and Type Method Description Node
getSource()
Returns the source of the currentEdge
.Node
getTarget()
Returns the target of the currentEdge
.boolean
isDirected()
Returnstrue
, if theEdge
is directed,false
otherwise.void
reverse()
Changes source and target of theEdge
, that means if theEdge
is directed the direction will be changed.void
setDirected(boolean directed)
Determines if anEdge
is directed (true
) or not.void
setGraph(Graph graph)
void
setSource(Node source)
Sets the source of the currentEdge
to source.void
setTarget(Node target)
Sets the target of the currentEdge
to 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, setString
Methods inherited from interface java.lang.Comparable
compareTo
-
Field Details
-
DIRECTED
static final boolean DIRECTEDIndicates that anEdge
is directed.- See Also:
- Constant Field Values
-
UNDIRECTED
static final boolean UNDIRECTEDIndicates that anEdge
is undirected.- See Also:
- Constant Field Values
-
-
Method Details
-
setDirected
void setDirected(boolean directed)Determines if anEdge
is directed (true
) or not.- Parameters:
directed
-true
, if theEdge
is destined to be directed,false
otherwise.
-
isDirected
boolean isDirected()Returnstrue
, if theEdge
is directed,false
otherwise.- Returns:
true
, if theEdge
is directed,false
otherwise.
-
setSource
Sets the source of the currentEdge
to source.source
must be contained in the sameGraph
as 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 currentEdge
to target.target
must be contained in the sameGraph
as 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 theEdge
is directed the direction will be changed. -
setGraph
- Parameters:
graph
-
-