public class AbstractEdge extends AbstractElement implements Edge
This class provides a basic implementation of Edge interface, to
minimize the effort required to implement this interface.
Although this class is abstract it implements all the methods of
Edge and
AbstractElement. It has a low
memory overhead (3 references and a boolean as fields). All Edge
methods are executed in O(1) time.
AbstractElement.AttributeChangeEvent| Modifier and Type | Method and Description |
|---|---|
Node |
getNode0()
First node of the edge.
|
Node |
getNode1()
Second node of the edge.
|
Node |
getOpposite(Node node)
When knowing one node and one edge of this node, this method return the node
at the other end of the edge.
|
Node |
getSourceNode()
Start node.
|
Node |
getTargetNode()
End node.
|
boolean |
isDirected()
Is the edge directed ?.
|
boolean |
isLoop()
Does the source and target of this edge identify the same node ?.
|
java.lang.String |
toString()
Override the Object method
|
attributeKeys, clearAttributes, getAttribute, getAttribute, getAttributeCount, getFirstAttributeOf, getFirstAttributeOf, getId, getIndex, hasAttribute, hasAttribute, removeAttribute, setAttributeequals, getClass, hashCode, notify, notifyAll, wait, wait, waitattributeKeys, clearAttributes, getArray, getAttribute, getAttribute, getAttributeCount, getFirstAttributeOf, getFirstAttributeOf, getId, getIndex, getLabel, getMap, getNumber, getVector, hasArray, hasAttribute, hasAttribute, hasLabel, hasMap, hasNumber, hasVector, removeAttribute, setAttribute, setAttributespublic java.lang.String toString()
AbstractElementtoString in class AbstractElementpublic Node getNode0()
Edge
This is equivalent to the Edge.getSourceNode() method, but may be clearer
in the source code if the graph you are using is not directed.
getNode0 in interface EdgeEdge.getNode1(),
Edge.getSourceNode()public Node getNode1()
Edge
This is equivalent to the Edge.getTargetNode() method, but may be clearer
in the source code if the graph you are using is not directed.
getNode1 in interface EdgeEdge.getNode0(),
Edge.getTargetNode()public Node getOpposite(Node node)
EdgeReturn null if the given node is not at any end of the edge.
getOpposite in interface Edgenode - The node we search the opposite of.public Node getSourceNode()
Edge
When the edge is directed this is the source node, in this case you can get
the opposite node using Edge.getTargetNode(). This is equivalent to the
Edge.getNode0() method but may be clearer in the source code if the graph
you are using is directed.
getSourceNode in interface EdgeEdge.getNode0(),
Edge.getTargetNode()public Node getTargetNode()
Edge
When the edge is directed this is the target node, in this case you can get
the opposite node using Edge.getSourceNode(). This is equivalent to the
Edge.getNode1() method but may be clearer in the source code if the graph
you are using is directed.
getTargetNode in interface EdgeEdge.getNode1(),
Edge.getSourceNode()public boolean isDirected()
EdgeisDirected in interface Edge