|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectharpoon.Analysis.GraphColoring.AbstractGraph
harpoon.Analysis.GraphColoring.SparseGraph
public class SparseGraph
SparseGraph is an implementation of a
ColorableGraph object. Nodes are represented by a
list SparseNodes, and edges are represented by the
references SparseNodes store internally.
| Nested Class Summary | |
|---|---|
protected static class |
ColorableGraphImpl.HiddenFilteringEnum
Deprecated. Wrapper class for Enumeration that filters out hidden nodes. |
| Nested classes/interfaces inherited from interface harpoon.Analysis.GraphColoring.ColorableGraph |
|---|
ColorableGraph.AlreadyColoredException, ColorableGraph.AlreadyHiddenException, ColorableGraph.IllegalColor |
| Field Summary | |
|---|---|
protected UniqueVector |
nodes
Deprecated. |
| Constructor Summary | |
|---|---|
SparseGraph()
Creates a SparseGraph. |
|
| Method Summary | |
|---|---|
void |
addEdge(Node from,
Node to)
Deprecated. Adds an edge from from to to. |
void |
addNode(Node n)
Wrapper method that calls super.addNode(n). |
protected void |
checkNode(Node node)
Ensures that only SparseNodes are added to this. |
Enumeration |
getChildrenOf(Node node)
Constructs an enumeration for the children of a specific node. |
Color |
getColor(Object node)
Returns the color of node. |
int |
getDegree(Node node)
Returns the degree of node. |
Enumeration |
getNeighborsOf(Node node)
Constructs an enumeration for the parents of a specific node. |
Enumeration |
getNodes()
Deprecated. Constructs an enumeration for all the nodes. |
protected UniqueVector |
getNodeVector()
Deprecated. Nodes accessor method for subclass use. |
Enumeration |
getParentsOf(Node node)
Constructs an enumeration for the parents of a specific node. |
void |
hide(Object node)
Temporarily removes node from graph. |
boolean |
isModifiable()
Modifiability check. |
void |
makeEdge(Node from,
Node to)
Generates an edge from from to to. |
Collection |
neighborsOf(Object node)
Returns a collection view for the neighbors of a specific node. |
Set |
nodeSet()
Returns a set view of the nodes in this. |
Object |
replace()
Replaces the last hidden node into the graph. |
void |
replaceAll()
Replaces all hidden nodes in graph. |
void |
resetColors()
Reverts the graph to an uncolored state. |
void |
resetGraph()
Returns all nodes in graph to their original 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 class harpoon.Analysis.GraphColoring.AbstractGraph |
|---|
addEdge, addNode, edges, edgesFor, getDegree |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface harpoon.Analysis.GraphColoring.ColorableGraph |
|---|
addNode |
| Methods inherited from interface harpoon.Analysis.GraphColoring.Graph |
|---|
addEdge, edges, edgesFor, getDegree |
| Field Detail |
|---|
protected UniqueVector nodes
| Constructor Detail |
|---|
public SparseGraph()
SparseGraph.
| Method Detail |
|---|
protected void checkNode(Node node)
SparseNodes are added to this.
node is an instance of a
SparseNode
public void makeEdge(Node from,
Node to)
from to to.
from and to
are present in this and are
valid targets for a new edge
(SparseGraph does not allow
multiple edges or circular edges).
from, to
from to
to.
public int getDegree(Node node)
node.
node is present in
this.
ColorableNodes that
node is connected to.
public Enumeration getChildrenOf(Node node)
node is present in
this.
Enumeration of
the Nodes that have an edge
from node to them that are
not hidden.
this is not modified while
the Enumeration returned is
still in use.
public Enumeration getParentsOf(Node node)
throws NodeNotPresentInGraphException
Enumeration of
the nodes that have an edge from them to
node.
this is not modified while
the Enumeration returned is
still in use.
NodeNotPresentInGraphException
public Enumeration getNeighborsOf(Node node)
throws NodeNotPresentInGraphException
node is present in
this.
Enumeration of
the nodes that have an edge between
node and them.
this is not modified while
the Enumeration returned is
still in use.
NodeNotPresentInGraphExceptionpublic boolean isModifiable()
this is allowed to be modified,
returns true. Else returns false.
public void addNode(Node n)
super.addNode(n).
Needed to resolve ambiguity in method resolution at
compile-time.
public void resetGraph()
this
this is otherwise unchanged.
public void resetColors()
this
resetColors in interface ColorableGraph
public void setColor(Object n,
Color c)
n.
c is null, then
removes n from the Node -> Color mapping.
Else puts (n, c) in the Node -> Color mapping.
setColor in interface ColorableGraphIllegalArgumentException - If n is not
present in the node set for this or
n has already been colored.public void unsetColor(Object n)
ColorableGraphn from the Node -> Color mapping.
this
unsetColor in interface ColorableGraphpublic Color getColor(Object node)
node.
node in the Node -> Color mapping, or null
if there is no entry in the mapping for
node.
getColor in interface ColorableGraphIllegalArgumentException - If node is not
present in the node set for this.public 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.
hide in interface ColorableGraphIllegalArgumentException - If node is not
present in the node set for this.public Object replace()
this
this to reflect that n has been
replaced.
Returns n.
replace in interface ColorableGraphpublic void replaceAll()
this
this to reflect that n has been
replaced.
replaceAll in interface ColorableGraphpublic Set nodeSet()
this.
Set of
the Objects that have been successfully
added to this.
nodeSet in interface GraphnodeSet in class AbstractGraphpublic Collection neighborsOf(Object node)
Collection of
Objects that have an edge between
node and them.
node is not removed from
this while the returned
Collection is in use.
neighborsOf in interface GraphneighborsOf in class AbstractGraphIllegalArgumentException - node is not
present in the node set for this.public Enumeration getNodes()
Enumeration of
the ColorableNodes that have
been successfully added to
this that are not currently
hidden.
this is not modified while
the Enumeration returned is
in use.
public void addEdge(Node from,
Node to)
from to to.
from and to
are present in this and are
valid targets for a new edge.
this.
protected UniqueVector getNodeVector()
UniqueVector of the
Nodes that have been
successfully added to this.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||