Package org.graffiti.graph
Class AbstractEdge
java.lang.Object
org.graffiti.attributes.AbstractAttributable
org.graffiti.graph.AbstractGraphElement
org.graffiti.graph.AbstractEdge
- All Implemented Interfaces:
Comparable<GraphElement>
,Attributable
,Edge
,GraphElement
- Direct Known Subclasses:
AdjListEdge
public abstract class AbstractEdge extends AbstractGraphElement implements Edge
Provides default implementations of methods on edges.
- Version:
- $Revision: 1.6 $
-
Field Summary
Fields inherited from interface org.graffiti.graph.Edge
DIRECTED, UNDIRECTED
-
Constructor Summary
Constructors Constructor Description AbstractEdge(Graph graph)
Constructs a newAbstractEdge
.AbstractEdge(Graph graph, CollectionAttribute coll)
Constructs a newAbstractEdge
. -
Method Summary
Modifier and Type Method Description void
reverse()
Swaps source and target of the edge.void
setDirected(boolean directed)
Determines if anEdge
is directed (true
) or not.void
setSource(Node source)
Sets the source of the currentEdge
tosource
.void
setTarget(Node target)
Sets the target of the currentEdge
to target.Methods inherited from class org.graffiti.graph.AbstractGraphElement
compareTo, getGraph, getID, getListenerManager, getViewID, setID, setViewID
Methods inherited from class org.graffiti.attributes.AbstractAttributable
addAttribute, addBoolean, addByte, addDouble, addFloat, addInteger, addLong, addShort, addString, changeBoolean, changeByte, changeDouble, changeFloat, changeInteger, changeLong, changeShort, changeString, getAttribute, getAttributes, getBoolean, getByte, getDouble, getFloat, getInteger, getLong, getShort, getString, removeAttribute, setBoolean, setByte, setDouble, setFloat, setInteger, setLong, setShort, setString
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
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
Methods inherited from interface org.graffiti.graph.Edge
getSource, getTarget, isDirected, setGraph
-
Constructor Details
-
AbstractEdge
Constructs a newAbstractEdge
. Also sets the graph.- Parameters:
graph
- theGraph
theAbstractGraphElement
belongs to.
-
AbstractEdge
Constructs a newAbstractEdge
. Sets the graph of the newAbstractEdge
.- Parameters:
graph
- theGraph
the newAbstractEdge
instance shall belong to.coll
- theCollectionAttribute
of the newly createdAbstractEdge
instance.
-
-
Method Details
-
setDirected
public void setDirected(boolean directed)Determines if anEdge
is directed (true
) or not. Informs the ListenerManager that the direction has been modified.- Specified by:
setDirected
in interfaceEdge
- Parameters:
directed
-true
, if theEdge
is destined to be directed,false
otherwise.
-
setSource
Sets the source of the currentEdge
tosource
.source
must be contained in the sameGraph
as the currentEdge
. Informs the ListenerManager about the change.- Specified by:
setSource
in interfaceEdge
- Parameters:
source
- the source to be set.- Throws:
GraphElementNotFoundException
- if source cannot be found in theGraph
.
-
setTarget
Sets the target of the currentEdge
to target. Target must be contained in the sameGraph
as theEdge
. Informs the ListenerManager about the change.- Specified by:
setTarget
in interfaceEdge
- Parameters:
target
- the target to be set.- Throws:
GraphElementNotFoundException
- if the target cannot be found in theGraph
.
-
reverse
public void reverse()Swaps source and target of the edge. Informs the listtenerManager about the change.
-