Class AbstractEdge
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.graphstream.graph.implementations.AbstractElement
AbstractElement.AttributeChangeEvent -
Method Summary
Modifier and Type Method Description NodegetNode0()First node of the edge.NodegetNode1()Second node of the edge.NodegetOpposite(Node node)When knowing one node and one edge of this node, this method return the node at the other end of the edge.NodegetSourceNode()Start node.NodegetTargetNode()End node.booleanisDirected()Is the edge directed ?.booleanisLoop()Does the source and target of this edge identify the same node ?.StringtoString()Override the Object methodMethods inherited from class org.graphstream.graph.implementations.AbstractElement
attributeKeys, clearAttributes, getAttribute, getAttribute, getAttributeCount, getFirstAttributeOf, getFirstAttributeOf, getId, getIndex, hasAttribute, hasAttribute, removeAttribute, setAttributeMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.graphstream.graph.Element
attributeKeys, clearAttributes, getArray, getAttribute, getAttribute, getAttributeCount, getFirstAttributeOf, getFirstAttributeOf, getId, getIndex, getLabel, getMap, getNumber, getVector, hasArray, hasAttribute, hasAttribute, hasLabel, hasMap, hasNumber, hasVector, removeAttribute, setAttribute, setAttributes
-
Method Details
-
toString
Description copied from class:AbstractElementOverride the Object method- Overrides:
toStringin classAbstractElement
-
getNode0
Description copied from interface:EdgeFirst node of the 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.- Specified by:
getNode0in interfaceEdge- Returns:
- The first node of the edge.
- See Also:
Edge.getNode1(),Edge.getSourceNode()
-
getNode1
Description copied from interface:EdgeSecond node of the 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.- Specified by:
getNode1in interfaceEdge- Returns:
- The second node of the edge.
- See Also:
Edge.getNode0(),Edge.getTargetNode()
-
getOpposite
Description copied from interface:EdgeWhen knowing one node and one edge of this node, this method return the node at the other end of the edge.Return null if the given node is not at any end of the edge.
- Specified by:
getOppositein interfaceEdge- Parameters:
node- The node we search the opposite of.- Returns:
- the opposite node of the given node.
-
getSourceNode
Description copied from interface:EdgeStart node.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 theEdge.getNode0()method but may be clearer in the source code if the graph you are using is directed.- Specified by:
getSourceNodein interfaceEdge- Returns:
- The origin node of the edge.
- See Also:
Edge.getNode0(),Edge.getTargetNode()
-
getTargetNode
Description copied from interface:EdgeEnd node.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 theEdge.getNode1()method but may be clearer in the source code if the graph you are using is directed.- Specified by:
getTargetNodein interfaceEdge- Returns:
- The destination node of the edge.
- See Also:
Edge.getNode1(),Edge.getSourceNode()
-
isDirected
public boolean isDirected()Description copied from interface:EdgeIs the edge directed ?.- Specified by:
isDirectedin interfaceEdge- Returns:
- True if the edge is directed.
-
isLoop
public boolean isLoop()Description copied from interface:EdgeDoes the source and target of this edge identify the same node ?.
-