|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ColorableGraph
ColorableGraph
extends
GraphColoring.Graph
with methods
that are useful for a graph-coloring system. Two main pieces of
state are added:
addNode(Object)
.
Nested Class Summary | |
---|---|
static class |
ColorableGraph.AlreadyColoredException
AlreadyColoredException will be thrown on attempt to call g.setColor(node,color) when n is present in the
node -> color mapping. |
static class |
ColorableGraph.AlreadyHiddenException
AlreadyHiddenException will be thrown on attempt to call g.addNode(n) while n is a member of the set of
hidden nodes in g . |
static class |
ColorableGraph.IllegalColor
IllegalColor will be thrown on an attempt to color a node with a color that for some reason is not legal for that node in this graph. |
Method Summary | |
---|---|
boolean |
addNode(Object node)
Ensures that this graph contains node (optional operation). |
Color |
getColor(Object node)
Returns the color of node . |
void |
hide(Object node)
Temporarily removes node from graph. |
Object |
replace()
Replaces the last hidden node into the graph. |
void |
replaceAll()
Replaces all hidden nodes in graph. |
void |
resetColors()
Reverts the graph's color mapping to its initial state. |
void |
setColor(Object n,
Color c)
Sets the color of n . |
void |
unsetColor(Object n)
Removes n from the Node -> Color mapping. |
Methods inherited from interface harpoon.Analysis.GraphColoring.Graph |
---|
addEdge, edges, edgesFor, getDegree, neighborsOf, nodeSet |
Method Detail |
---|
boolean addNode(Object node)
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
UnsupportedOperationException
- addNode is not supported
by this graph.
ClassCastException
- class of specified element prevents
it from being added to this graph.
ColorableGraph.AlreadyHiddenException
- node is part of the set of
hidden nodes in this
IllegalArgumentException
- some aspect of
node
prevents it from being added to the
node-set for this graph.void resetColors()
this
void setColor(Object n, Color c) throws ColorableGraph.IllegalColor
n
.
c
!= null
this
IllegalArgumentException
- n
is not
present in the node set for this
. No
modification to this
.
ColorableGraph.AlreadyColoredException
- n
is already
present in the Node -> Color mapping. No modification to
this
.
ColorableGraph.IllegalColor
- c
is not an appropriate
Color
for n
in this graph. No
modification to this
.void unsetColor(Object n)
n
from the Node -> Color mapping.
this
IllegalArgumentException
- n
is not present
in the node set for this
. No modification
to this
.Color getColor(Object node)
node
.
node
in the Node -> Color mapping, or null
if there is no entry in the mapping for
node
.
IllegalArgumentException
- If node
is not
present in the node set for this
.void hide(Object node)
node
from graph.
this
, node
node
and
node
's associated edges from
this
, pushing it onto hidden-nodes stack
for later replacement in the graph. Also updates all
edges and nodes of this
to reflect that
node
has been hidden.
IllegalArgumentException
- If node
is not
present in the node set for this
.Object replace()
this
this
to reflect that n has been
replaced.
Returns n.
void replaceAll()
this
this
to reflect that n has been
replaced.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |