Class AbstractNode
java.lang.Object
org.graphstream.graph.implementations.AbstractElement
org.graphstream.graph.implementations.AbstractNode
- Direct Known Subclasses:
AdjacencyListNode
public abstract class AbstractNode extends AbstractElement implements Node
This class provides a basic implementation of Node interface, to
minimize the effort required to implement this interface.
This class implements all the methods of
AbstractElement and most of the
methods of Node (there are "only" ten abstract
methods). In addition to these, subclasses must provide implementations for
addEdgeCallback(AbstractEdge) and
removeEdgeCallback(AbstractEdge) which are called by the parent
graph when an edge incident to this node is added to or removed from the
graph. This class has a low memory overhead (one reference as field).
-
Nested Class Summary
Nested classes/interfaces inherited from class org.graphstream.graph.implementations.AbstractElement
AbstractElement.AttributeChangeEvent -
Method Summary
Modifier and Type Method Description Iterator<Node>getBreadthFirstIterator()This implementation creates an instance ofBreadthFirstIteratorand returns it.Iterator<Node>getBreadthFirstIterator(boolean directed)This implementation creates an instance ofBreadthFirstIteratorand returns it.Iterator<Node>getDepthFirstIterator()This implementation creates an instance ofDepthFirstIteratorand returns it.Iterator<Node>getDepthFirstIterator(boolean directed)This implementation creates an instance ofDepthFirstIteratorand returns it.EdgegetEdgeBetween(int index)This implementation usesNode.getEdgeBetween(Node)EdgegetEdgeBetween(String id)This implementation usesNode.getEdgeBetween(Node)EdgegetEdgeFrom(int index)This implementation usesNode.getEdgeFrom(Node)EdgegetEdgeFrom(String id)This implementation usesNode.getEdgeFrom(Node)EdgegetEdgeToward(int index)This implementation usesNode.getEdgeToward(Node)EdgegetEdgeToward(String id)This implementation usesNode.getEdgeToward(Node)GraphgetGraph()This implementation returnsgraph.booleanisEnteringEdge(Edge e)Checks if an edge enters this node.booleanisIncidentEdge(Edge e)Checks if an edge is incident to this node.booleanisLeavingEdge(Edge e)Checks if an edge leaves this node.Methods inherited from class org.graphstream.graph.implementations.AbstractElement
attributeKeys, clearAttributes, getAttribute, getAttribute, getAttributeCount, getFirstAttributeOf, getFirstAttributeOf, getId, getIndex, hasAttribute, hasAttribute, removeAttribute, setAttribute, toStringMethods 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, setAttributesMethods inherited from interface org.graphstream.graph.Node
edges, enteringEdges, getDegree, getEdge, getEdgeBetween, getEdgeFrom, getEdgeToward, getEnteringEdge, getInDegree, getLeavingEdge, getOutDegree, hasEdgeBetween, hasEdgeBetween, hasEdgeBetween, hasEdgeFrom, hasEdgeFrom, hasEdgeFrom, hasEdgeToward, hasEdgeToward, hasEdgeToward, iterator, leavingEdges, neighborNodes, toString
-
Method Details
-
getGraph
This implementation returnsgraph.- Specified by:
getGraphin interfaceNode- Returns:
- The graph containing this node or null if unknown.
- See Also:
Node.getGraph()
-
getEdgeToward
This implementation usesNode.getEdgeToward(Node)- Specified by:
getEdgeTowardin interfaceNode- Parameters:
index- Index of the target node.- Returns:
- Directed edge going from this node to the parameter node, or undirected edge if it exists, else null.
- See Also:
Node.getEdgeToward(int)
-
getEdgeToward
This implementation usesNode.getEdgeToward(Node)- Specified by:
getEdgeTowardin interfaceNode- Parameters:
id- Identifier of the target node.- Returns:
- Directed edge going from this node to 'id', or undirected edge if it exists, else null.
- See Also:
Node.getEdgeToward(java.lang.String)
-
getEdgeFrom
This implementation usesNode.getEdgeFrom(Node)- Specified by:
getEdgeFromin interfaceNode- Parameters:
index- Index of the source node.- Returns:
- Directed edge going from the parameter node to this node, or undirected edge if it exists, else null.
- See Also:
Node.getEdgeFrom(int)
-
getEdgeFrom
This implementation usesNode.getEdgeFrom(Node)- Specified by:
getEdgeFromin interfaceNode- Parameters:
id- Identifier of the source node.- Returns:
- Directed edge going from node 'id' to this node, or undirected edge if it exists, else null.
- See Also:
Node.getEdgeFrom(java.lang.String)
-
getEdgeBetween
This implementation usesNode.getEdgeBetween(Node)- Specified by:
getEdgeBetweenin interfaceNode- Parameters:
index- The index of the opposite node.- Returns:
- Edge between node with index i and this node if it exists, else null.
- See Also:
Node.getEdgeBetween(int)
-
getEdgeBetween
This implementation usesNode.getEdgeBetween(Node)- Specified by:
getEdgeBetweenin interfaceNode- Parameters:
id- Identifier of the opposite node.- Returns:
- Edge between node 'id' and this node if it exists, else null.
- See Also:
Node.getEdgeBetween(java.lang.String)
-
getBreadthFirstIterator
This implementation creates an instance ofBreadthFirstIteratorand returns it.- Specified by:
getBreadthFirstIteratorin interfaceNode- Returns:
- An iterator able to explore the graph in a breadth first way starting at this node.
- See Also:
Node.getBreadthFirstIterator()
-
getBreadthFirstIterator
This implementation creates an instance ofBreadthFirstIteratorand returns it.- Specified by:
getBreadthFirstIteratorin interfaceNode- Parameters:
directed- If false, the iterator will ignore edge orientation (the default is "True").- Returns:
- An iterator able to explore the graph in a breadth first way starting at this node.
- See Also:
Node.getBreadthFirstIterator(boolean)
-
getDepthFirstIterator
This implementation creates an instance ofDepthFirstIteratorand returns it.- Specified by:
getDepthFirstIteratorin interfaceNode- Returns:
- An iterator able to explore the graph in a depth first way starting at this node.
- See Also:
Node.getDepthFirstIterator()
-
getDepthFirstIterator
This implementation creates an instance ofDepthFirstIteratorand returns it.- Specified by:
getDepthFirstIteratorin interfaceNode- Parameters:
directed- If false, the iterator will ignore edge orientation (the default is "True").- Returns:
- An iterator able to explore the graph in a depth first way starting at this node.
- See Also:
Node.getDepthFirstIterator(boolean)
-
isEnteringEdge
Checks if an edge enters this node. Utility method that can be useful in subclasses.- Parameters:
e- an edge- Returns:
trueifeis entering edge for this node.
-
isLeavingEdge
Checks if an edge leaves this node. Utility method that can be useful in subclasses.- Parameters:
e- an edge- Returns:
trueifeis leaving edge for this node.
-
isIncidentEdge
Checks if an edge is incident to this node. Utility method that can be useful in subclasses.- Parameters:
e- an edge- Returns:
trueifeis incident edge for this node.
-