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 voidreverse()Swaps source and target of the edge.voidsetDirected(boolean directed)Determines if anEdgeis directed (true) or not.voidsetSource(Node source)Sets the source of the currentEdgetosource.voidsetTarget(Node target)Sets the target of the currentEdgeto target.Methods inherited from class org.graffiti.graph.AbstractGraphElement
compareTo, getGraph, getID, getListenerManager, getViewID, setID, setViewIDMethods 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, setStringMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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
compareToMethods inherited from interface org.graffiti.graph.Edge
getSource, getTarget, isDirected, setGraph
-
Constructor Details
-
AbstractEdge
Constructs a newAbstractEdge. Also sets the graph.- Parameters:
graph- theGraphtheAbstractGraphElementbelongs to.
-
AbstractEdge
Constructs a newAbstractEdge. Sets the graph of the newAbstractEdge.- Parameters:
graph- theGraphthe newAbstractEdgeinstance shall belong to.coll- theCollectionAttributeof the newly createdAbstractEdgeinstance.
-
-
Method Details
-
setDirected
public void setDirected(boolean directed)Determines if anEdgeis directed (true) or not. Informs the ListenerManager that the direction has been modified.- Specified by:
setDirectedin interfaceEdge- Parameters:
directed-true, if theEdgeis destined to be directed,falseotherwise.
-
setSource
Sets the source of the currentEdgetosource.sourcemust be contained in the sameGraphas the currentEdge. Informs the ListenerManager about the change.- Specified by:
setSourcein interfaceEdge- Parameters:
source- the source to be set.- Throws:
GraphElementNotFoundException- if source cannot be found in theGraph.
-
setTarget
Sets the target of the currentEdgeto target. Target must be contained in the sameGraphas theEdge. Informs the ListenerManager about the change.- Specified by:
setTargetin 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.
-