|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectharpoon.Analysis.GraphColoring.AbstractGraph
public abstract class AbstractGraph
AbstractGraph
is a skeletal implementation of the
Graph
interface, to minimize the effort required to
implement this interface.
To implement an unmodifiable graph, the programmer needs only to
extend this class and provide implementations for the
nodeSet
and neighborsOf
methods.
To implement a modifiable graph, the programmer must additionally
override this class's addNode
and addEdge
methods (which otherwise throws UnsupportedOperationException).
Constructor Summary | |
---|---|
AbstractGraph()
Creates a AbstractGraph . |
Method Summary | |
---|---|
boolean |
addEdge(Object m,
Object n)
Ensures that this graph contains an edge between m and n (optional operation). |
boolean |
addNode(Object n)
Ensures that this graph contains node (optional operation). |
Collection |
edges()
Returns a collection view of the edges contained in this graph. |
Collection |
edgesFor(Object n)
Returns a collection view of the edges joining node to nodes in the graph. |
int |
getDegree(Object n)
Returns the degree of node . |
abstract Collection |
neighborsOf(Object n)
Returns a collection view for the neighbors of a specific node. |
abstract Set |
nodeSet()
Returns a set view of the nodes in this . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractGraph()
AbstractGraph
.
Method Detail |
---|
public abstract Set nodeSet()
Graph
this
.
Set
of
the Object
s that have been successfully
added to this
.
nodeSet
in interface Graph
public abstract Collection neighborsOf(Object n)
Graph
Collection
of
Object
s that have an edge between
node
and them.
node
is not removed from
this
while the returned
Collection
is in use.
neighborsOf
in interface Graph
public boolean addNode(Object n)
Graph
node
(optional operation).
this
node
will be present in the node-set for
this
. Returns true if this graph
changed as a result of the call, false
otherwise.
addNode
in interface Graph
public boolean addEdge(Object m, Object n)
Graph
m
and n
(optional operation).
this
.
m
and n
will be in
this
. Returns true if
this
changed as a result of the call.
addEdge
in interface Graph
public int getDegree(Object n)
Graph
node
.
Object
s that node
is joined
with.
getDegree
in interface Graph
public Collection edgesFor(Object n)
Graph
node
to nodes in the graph.
Collection
of
two-element Collection
s (known as
pairs) where each pair corresponds to an edge
{ node, n } in this. If the graph is modified while an
iteration over the collection is in progress, the results
of the iteration are undefined. Order may or may not be
significant in the pairs returned.
edgesFor
in interface Graph
public Collection edges()
Graph
Collection
of
two-element Collection
s (known as
pairs) where each pair corresponds to an edge
{ n1, n2 } in this. If the graph is modified while an
iteration over the collection is in progress, the results
of the iteration are undefined. Order may or
may not be significant in the pairs returned.
edges
in interface Graph
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |