|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javaslam.tjt.graph.Node
A node in a graph. The equals
and
hashCode
methods are implemented exactly as
in the Object
class. Thus, it is not possible to
have two representations of the same node.
Field Summary | |
protected Map |
edges
A mapping from neighbor Node s to the Edge s to them. |
Constructor Summary | |
Node()
Default constructor. |
Method Summary | |
void |
addEdge(Edge e)
Adds an edge from this node to another node. |
Collection |
edges()
Returns (an unmodifiable view of) the set of Edge s
incident from this node. |
boolean |
equals(Object o)
Finalizes the definition of equals so that two nodes
are equal iff they are the same object. |
Edge |
getEdge(Node n)
Gets the edge from this node to the supplied node; if no such edge exists, null is returned. |
List |
getShortestPath(NodeFilter f)
Computes the shortest path from this node to another node satisfying a particular property. |
int |
hashCode()
Finalizes the definition of hashCode to be the same as
that of hashCode . |
void |
removeEdge(Edge e)
Removes the supplied edge from this node to the supplied node (if such an edge exists). |
void |
swingEdge(Edge e,
Node n)
Changes an edge emanating from this node so that it emanates from the supplied node. |
void |
swingEdgesTo(Node n)
Changes the origin of all (directed and undirected) edges emanating from this node to the supplied node. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected Map edges
Node
s to the Edge
s to them.
Constructor Detail |
public Node()
Method Detail |
public void addEdge(Edge e)
from
field is not this
, then it is
set to this
.
e
- the edge to add to this node's list of outward edges
IllegalArgumentException
- if the edge's
to
field is equal to this
.public void swingEdge(Edge e, Node n)
e
- the edge to swingn
- the new terminus of e
public void swingEdgesTo(Node n)
n
- the new origin of all edges emanating from this nodepublic Edge getEdge(Node n)
null
is returned.
n
- the neighbor of this node
n
, or
null
if n
is not a neighbor of this
nodepublic void removeEdge(Edge e)
e
- an edge emanating from this nodepublic Collection edges()
Edge
s
incident from this node.
Edge
s
emanating from this nodepublic List getShortestPath(NodeFilter f)
List
of Edge
objects. If there are no
nodes reachable from this node that satisfy the filter, then
null
is returned.
f
- a filter identifying nodes that have a particular property
null
if no node
satisfying the property is reachable from this node).public final boolean equals(Object o)
equals
so that two nodes
are equal iff they are the same object.
equals
in class Object
o
- another object
true
iff o == this
public final int hashCode()
hashCode
to be the same as
that of hashCode
.
hashCode
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |