|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.graphstream.graph.implementations.AbstractElement
org.graphstream.graph.implementations.AbstractNode
public abstract class AbstractNode
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
org.graphstream.graph.implementations
and most of the
methods of org.graphstream.graph
(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 | ||
---|---|---|
|
getBreadthFirstIterator()
This implementation creates an instance of org.graphstream.graph and returns it. |
|
|
getBreadthFirstIterator(boolean directed)
This implementation creates an instance of org.graphstream.graph and returns it. |
|
abstract int |
getDegree()
Total number of relations with other nodes or this node. |
|
|
getDepthFirstIterator()
This implementation creates an instance of org.graphstream.graph and returns it. |
|
|
getDepthFirstIterator(boolean directed)
This implementation creates an instance of org.graphstream.graph and returns it. |
|
|
getEachEdge()
This implementation uses getEdgeIterator() |
|
|
getEachEnteringEdge()
This implementation uses getEnteringEdgeIterator() |
|
|
getEachLeavingEdge()
This implementation uses getLeavingEdgeIterator() |
|
abstract
|
getEdge(int i)
I-th edge. |
|
|
getEdgeBetween(int index)
This implementation uses getEdgeBetween(Node) |
|
abstract
|
getEdgeBetween(Node node)
Retrieves an edge between this node and and another node if one exists. |
|
|
getEdgeBetween(String id)
This implementation uses getEdgeBetween(Node) |
|
|
getEdgeFrom(int index)
This implementation uses getEdgeFrom(Node) |
|
abstract
|
getEdgeFrom(Node node)
Retrieves an edge that leaves given node toward this node. |
|
|
getEdgeFrom(String id)
This implementation uses getEdgeFrom(Node) |
|
abstract
|
getEdgeIterator()
Iterator on the set of connected edges. |
|
|
getEdgeSet()
This implementation uses getEdgeIterator() and
getDegree() |
|
|
getEdgeToward(int index)
This implementation uses getEdgeToward(Node) |
|
abstract
|
getEdgeToward(Node node)
Retrieves an edge that leaves this node toward another node. |
|
|
getEdgeToward(String id)
This implementation uses getEdgeToward(Node) |
|
abstract
|
getEnteringEdge(int i)
I-th entering edge. |
|
abstract
|
getEnteringEdgeIterator()
Iterator only on leaving edges. |
|
|
getEnteringEdgeSet()
This implementation uses getEnteringEdgeIterator() and
#geIntDegree() |
|
Graph |
getGraph()
This implementation returns graph . |
|
abstract int |
getInDegree()
Number of entering edges. |
|
abstract
|
getLeavingEdge(int i)
I-th leaving edge. |
|
abstract
|
getLeavingEdgeIterator()
Iterator only on entering edges. |
|
|
getLeavingEdgeSet()
This implementation uses #getLeavingIterator() and
#geOuttDegree() |
|
|
getNeighborNodeIterator()
This implementation uses getEdgeIterator() and stores the
visited nodes in a set. |
|
abstract int |
getOutDegree()
Number of leaving edges. |
|
boolean |
hasEdgeBetween(int index)
This implementation returns true if getEdgeBetween(int)
is not null . |
|
boolean |
hasEdgeBetween(Node node)
This implementation returns true if getEdgeBetween(Node)
is not null . |
|
boolean |
hasEdgeBetween(String id)
This implementation returns true if getEdgeBetween(Node)
is not null . |
|
boolean |
hasEdgeFrom(int index)
This implementation returns true if getEdgeFrom(int) is
not null . |
|
boolean |
hasEdgeFrom(Node node)
This implementation returns true if getEdgeFrom(Node) is
not null . |
|
boolean |
hasEdgeFrom(String id)
This implementation returns true if getEdgeFrom(Node) is
not null . |
|
boolean |
hasEdgeToward(int index)
This implementation returns true if getEdgeToward(int)
is not null . |
|
boolean |
hasEdgeToward(Node node)
This implementation returns true if getEdgeToward(Node)
is not null . |
|
boolean |
hasEdgeToward(String id)
This implementation returns true if getEdgeToward(Node)
is not null . |
|
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. |
|
Iterator<Edge> |
iterator()
This implementation uses getEdgeIterator() |
Methods inherited from class org.graphstream.graph.implementations.AbstractElement |
---|
addAttribute, addAttributes, changeAttribute, clearAttributes, getArray, getAttribute, getAttribute, getAttributeCount, getAttributeKeyIterator, getAttributeKeySet, getEachAttributeKey, getFirstAttributeOf, getFirstAttributeOf, getHash, getId, getIndex, getLabel, getNumber, getVector, hasArray, hasAttribute, hasAttribute, hasHash, hasLabel, hasNumber, hasVector, removeAttribute, setAttribute, toString |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.graphstream.graph.Node |
---|
toString |
Methods inherited from interface org.graphstream.graph.Element |
---|
addAttribute, addAttributes, changeAttribute, clearAttributes, getArray, getAttribute, getAttribute, getAttributeCount, getAttributeKeyIterator, getAttributeKeySet, getFirstAttributeOf, getFirstAttributeOf, getHash, getId, getIndex, getLabel, getNumber, getVector, hasArray, hasAttribute, hasAttribute, hasHash, hasLabel, hasNumber, hasVector, removeAttribute, setAttribute |
Method Detail |
---|
public Graph getGraph()
graph
.
getGraph
in interface Node
Node.getGraph()
public abstract int getDegree()
Node
getDegree
in interface Node
public abstract int getInDegree()
Node
getInDegree
in interface Node
public abstract int getOutDegree()
Node
getOutDegree
in interface Node
public boolean hasEdgeToward(Node node)
true
if getEdgeToward(Node)
is not null
.
hasEdgeToward
in interface Node
node
- The target node.
Node.getEdgeToward(org.graphstream.graph.Node)
public boolean hasEdgeToward(int index)
true
if getEdgeToward(int)
is not null
.
hasEdgeToward
in interface Node
index
- Index of the target node.
Node.hasEdgeToward(int)
public boolean hasEdgeToward(String id)
true
if getEdgeToward(Node)
is not null
.
hasEdgeToward
in interface Node
id
- Identifier of the target node.
Node.hasEdgeToward(java.lang.String)
public boolean hasEdgeFrom(Node node)
true
if getEdgeFrom(Node)
is
not null
.
hasEdgeFrom
in interface Node
node
- The source node.
Node.hasEdgeFrom(org.graphstream.graph.Node)
public boolean hasEdgeFrom(int index)
true
if getEdgeFrom(int)
is
not null
.
hasEdgeFrom
in interface Node
index
- Index of the source node.
Node.hasEdgeFrom(int)
public boolean hasEdgeFrom(String id)
true
if getEdgeFrom(Node)
is
not null
.
hasEdgeFrom
in interface Node
id
- Identifier of the source node.
Node.hasEdgeFrom(java.lang.String)
public boolean hasEdgeBetween(Node node)
true
if getEdgeBetween(Node)
is not null
.
hasEdgeBetween
in interface Node
node
- Another node.
Node.hasEdgeBetween(org.graphstream.graph.Node)
public boolean hasEdgeBetween(int index)
true
if getEdgeBetween(int)
is not null
.
hasEdgeBetween
in interface Node
index
- Index of another node.
Node.hasEdgeBetween(int)
public boolean hasEdgeBetween(String id)
true
if getEdgeBetween(Node)
is not null
.
hasEdgeBetween
in interface Node
id
- Identifier of another node.
Node.hasEdgeBetween(java.lang.String)
public abstract <T extends Edge> T getEdgeToward(Node node)
Node
This method selects only edges leaving this node an pointing at the parameter node (this also selects undirected edges).
This method is implicitly generic and returns something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :
ExtendedEdge e = node.getEdgeToward(...);the method will return an ExtendedEdge. If no left part exists, method will just return an Edge.
getEdgeToward
in interface Node
node
- The target node.
public <T extends Edge> T getEdgeToward(int index)
getEdgeToward(Node)
getEdgeToward
in interface Node
index
- Index of the target node.
Node.getEdgeToward(int)
public <T extends Edge> T getEdgeToward(String id)
getEdgeToward(Node)
getEdgeToward
in interface Node
id
- Identifier of the target node.
Node.getEdgeToward(java.lang.String)
public abstract <T extends Edge> T getEdgeFrom(Node node)
Node
This method selects only edges leaving the other node an pointing at this node (this also selects undirected edges).
This method is implicitly generic and returns something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :
ExtendedEdge e = node.getEdgeFrom(...);the method will return an ExtendedEdge. If no left part exists, method will just return an Edge.
getEdgeFrom
in interface Node
node
- The source node.
public <T extends Edge> T getEdgeFrom(int index)
getEdgeFrom(Node)
getEdgeFrom
in interface Node
index
- Index of the source node.
Node.getEdgeFrom(int)
public <T extends Edge> T getEdgeFrom(String id)
getEdgeFrom(Node)
getEdgeFrom
in interface Node
id
- Identifier of the source node.
Node.getEdgeFrom(java.lang.String)
public abstract <T extends Edge> T getEdgeBetween(Node node)
Node
This method selects directed or undirected edges. If the edge is directed, its direction is not important and leaving or entering edges will be selected.
This method is implicitly generic and return something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :
ExtendedEdge e = node.getEdgeBetween(...);the method will return an ExtendedEdge. If no left part exists, method will just return an Edge.
getEdgeBetween
in interface Node
node
- The opposite node.
public <T extends Edge> T getEdgeBetween(int index)
getEdgeBetween(Node)
getEdgeBetween
in interface Node
index
- The index of the opposite node.
Node.getEdgeBetween(int)
public <T extends Edge> T getEdgeBetween(String id)
getEdgeBetween(Node)
getEdgeBetween
in interface Node
id
- Identifier of the opposite node.
Node.getEdgeBetween(java.lang.String)
public abstract <T extends Edge> Iterator<T> getEdgeIterator()
Node
This iterator iterates on all edges leaving and entering (this includes any non-directed edge present, and a non-directed edge is only iterated once).
This method is implicitly generic and return an Iterator over something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :
Iterator<ExtendedEdge> ite = node.getEdgeIterator();the method will return an Iterator<ExtendedEdge>. If no left part exists, method will just return an Iterator<Edge>.
getEdgeIterator
in interface Node
public abstract <T extends Edge> Iterator<T> getEnteringEdgeIterator()
Node
This iterator iterates only on directed edges going from this node to others (non-directed edges are included in the iteration).
This method is implicitly generic and return an Iterator over something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :
Iterator<ExtendedEdge> ite = node.getEnteringEdgeIterator();the method will return an Iterator<ExtendedEdge>. If no left part exists, method will just return an Iterator<Edge>.
getEnteringEdgeIterator
in interface Node
public abstract <T extends Edge> Iterator<T> getLeavingEdgeIterator()
Node
This iterator iterates only on directed edges going from other nodes toward this node (non-directed edges are included in the iteration).
This method is implicitly generic and return an Iterator over something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :
Iterator<ExtendedEdge> ite = node.getLeavingEdgeIterator();the method will return an Iterator<ExtendedEdge>. If no left part exists, method will just return an Iterator<Edge>.
getLeavingEdgeIterator
in interface Node
public <T extends Edge> Iterable<T> getEachEdge()
getEdgeIterator()
getEachEdge
in interface Node
Node.getEachEdge()
public <T extends Edge> Iterable<T> getEachEnteringEdge()
getEnteringEdgeIterator()
getEachEnteringEdge
in interface Node
Node.getEachEnteringEdge()
public <T extends Edge> Iterable<T> getEachLeavingEdge()
getLeavingEdgeIterator()
getEachLeavingEdge
in interface Node
Node.getEachLeavingEdge()
public <T extends Edge> Collection<T> getEdgeSet()
getEdgeIterator()
and
getDegree()
getEdgeSet
in interface Node
Node.getEdgeSet()
public <T extends Edge> Collection<T> getEnteringEdgeSet()
getEnteringEdgeIterator()
and
#geIntDegree()
getEnteringEdgeSet
in interface Node
Node.getEnteringEdgeSet()
public <T extends Edge> Collection<T> getLeavingEdgeSet()
#getLeavingIterator()
and
#geOuttDegree()
getLeavingEdgeSet
in interface Node
Node.getLeavingEdgeSet()
public Iterator<Edge> iterator()
getEdgeIterator()
iterator
in interface Iterable<Edge>
Iterable.iterator()
public abstract <T extends Edge> T getEdge(int i)
Node
However this method allows to iterate very quickly on all edges, or to choose a given edge with direct access.
This method is implicitly generic and return something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :
ExtendedEdge e = node.getEdge(i);the method will return an ExtendedEdge. If no left part exists, method will just return an Edge.
getEdge
in interface Node
i
- Index of the edge.
public abstract <T extends Edge> T getEnteringEdge(int i)
Node
However this method allows to iterate very quickly on all entering edges, or to choose a given entering edge with direct access.
This method is implicitly generic and return something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :
ExtendedEdge e = node.getEnteringEdge(i);the method will return an ExtendedEdge. If no left part exists, method will just return an Edge.
getEnteringEdge
in interface Node
i
- Index of the edge.
public abstract <T extends Edge> T getLeavingEdge(int i)
Node
However this method allows to iterate very quickly on all leaving edges, or to choose a given leaving edge with direct access.
This method is implicitly generic and return something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :
ExtendedEdge e = node.getLeavingEdge(i);the method will return an ExtendedEdge. If no left part exists, method will just return an Edge.
getLeavingEdge
in interface Node
i
- Index of the edge.
public <T extends Node> Iterator<T> getNeighborNodeIterator()
getEdgeIterator()
and stores the
visited nodes in a set. In this way it ensures that each neighbor will be
visited exactly once, even in multi-graph.
getNeighborNodeIterator
in interface Node
Node.getNeighborNodeIterator()
public <T extends Node> Iterator<T> getBreadthFirstIterator()
org.graphstream.graph
and returns it.
getBreadthFirstIterator
in interface Node
Node.getBreadthFirstIterator()
public <T extends Node> Iterator<T> getBreadthFirstIterator(boolean directed)
org.graphstream.graph
and returns it.
getBreadthFirstIterator
in interface Node
directed
- If false, the iterator will ignore edge orientation (the
default is "True").
Node.getBreadthFirstIterator(boolean)
public <T extends Node> Iterator<T> getDepthFirstIterator()
org.graphstream.graph
and returns it.
getDepthFirstIterator
in interface Node
Node.getDepthFirstIterator()
public <T extends Node> Iterator<T> getDepthFirstIterator(boolean directed)
org.graphstream.graph
and returns it.
getDepthFirstIterator
in interface Node
directed
- If false, the iterator will ignore edge orientation (the
default is "True").
Node.getDepthFirstIterator(boolean)
public boolean isEnteringEdge(Edge e)
e
- an edge
true
if e
is entering edge for this node.public boolean isLeavingEdge(Edge e)
e
- an edge
true
if e
is leaving edge for this node.public boolean isIncidentEdge(Edge e)
e
- an edge
true
if e
is incident edge for this node.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |