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 ofBreadthFirstIterator
and returns it.Iterator<Node>
getBreadthFirstIterator(boolean directed)
This implementation creates an instance ofBreadthFirstIterator
and returns it.Iterator<Node>
getDepthFirstIterator()
This implementation creates an instance ofDepthFirstIterator
and returns it.Iterator<Node>
getDepthFirstIterator(boolean directed)
This implementation creates an instance ofDepthFirstIterator
and returns it.Edge
getEdgeBetween(int index)
This implementation usesNode.getEdgeBetween(Node)
Edge
getEdgeBetween(String id)
This implementation usesNode.getEdgeBetween(Node)
Edge
getEdgeFrom(int index)
This implementation usesNode.getEdgeFrom(Node)
Edge
getEdgeFrom(String id)
This implementation usesNode.getEdgeFrom(Node)
Edge
getEdgeToward(int index)
This implementation usesNode.getEdgeToward(Node)
Edge
getEdgeToward(String id)
This implementation usesNode.getEdgeToward(Node)
Graph
getGraph()
This implementation returnsgraph
.boolean
isEnteringEdge(Edge e)
Checks if an edge enters this node.boolean
isIncidentEdge(Edge e)
Checks if an edge is incident to this node.boolean
isLeavingEdge(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, toString
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods 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
Methods 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:
getGraph
in interfaceNode
- Returns:
- The graph containing this node or null if unknown.
- See Also:
Node.getGraph()
-
getEdgeToward
This implementation usesNode.getEdgeToward(Node)
- Specified by:
getEdgeToward
in 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:
getEdgeToward
in 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:
getEdgeFrom
in 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:
getEdgeFrom
in 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:
getEdgeBetween
in 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:
getEdgeBetween
in 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 ofBreadthFirstIterator
and returns it.- Specified by:
getBreadthFirstIterator
in 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 ofBreadthFirstIterator
and returns it.- Specified by:
getBreadthFirstIterator
in 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 ofDepthFirstIterator
and returns it.- Specified by:
getDepthFirstIterator
in 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 ofDepthFirstIterator
and returns it.- Specified by:
getDepthFirstIterator
in 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:
true
ife
is 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:
true
ife
is 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:
true
ife
is incident edge for this node.
-