|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.arsdigita.util.GraphSet
A Set-based implementation of the Graph
interface.
Once you've added a node to this graph, you must not mutate the node in a way
that affects its equals(Object)
and hashCode()
methods.
This class permits the null
node.
This implementation is not synchronized..
Nested Class Summary |
Nested classes inherited from class com.arsdigita.util.Graph |
Graph.Edge |
Constructor Summary | |
GraphSet()
|
Method Summary | |
void |
addEdge(Graph.Edge edge)
Adds an edge to the graph. |
void |
addEdge(Object tail,
Object head,
Object label)
A convenient shortcut for addEdge(new Graph.Edge(tail, head,
label)) . |
void |
addNode(Object name)
Adds a node to the graph. |
Graph |
copy()
Creates a copy of this graph. |
List |
getIncomingEdges(Object node)
|
String |
getLabel()
Returns the graph's label. |
List |
getNodes()
Returns a list of nodes that this graph has. |
List |
getOutgoingEdges(Object node)
Returns a list of outgoing edges leaving this node. |
boolean |
hasEdge(Graph.Edge edge)
Returns true if the graph has this edge. |
boolean |
hasNode(Object nodeName)
Returns true if the graph has this node. |
int |
incomingEdgeCount(Object node)
|
int |
nodeCount()
Returns the count of nodes in this graph. |
int |
outgoingEdgeCount(Object node)
Returns the number of outgoing edges this node has. |
void |
removeAll()
Removes all nodes and edges. |
boolean |
removeEdge(Graph.Edge edge)
Removes specified edge. |
boolean |
removeEdge(Object tail,
Object head,
Object label)
A convenient shortcut for removeEdge(new Graph.Edge(tail, head,
label)) . |
boolean |
removeNode(Object nodeName)
Removes specified node and all edges incident to it. |
void |
setLabel(String label)
Sets the graph's label. |
String |
toString()
Returns a printable representation of the graph that has the following form. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public GraphSet()
Method Detail |
public Graph copy()
Graph
copy
in interface Graph
public void setLabel(String label)
Graph
setLabel
in interface Graph
public String getLabel()
Graph
getLabel
in interface Graph
public void addNode(Object name)
Graph
addNode
in interface Graph
public boolean hasNode(Object nodeName)
Graph
true
if the graph has this node.
hasNode
in interface Graph
public boolean hasEdge(Graph.Edge edge)
Graph
true
if the graph has this edge.
hasEdge
in interface Graph
public int nodeCount()
Graph
nodeCount
in interface Graph
public void addEdge(Graph.Edge edge)
Graph
addEdge
in interface Graph
public void addEdge(Object tail, Object head, Object label)
Graph
addEdge(new Graph.Edge(tail, head,
label))
.
addEdge
in interface Graph
Graph.addEdge(Graph.Edge)
public List getNodes()
Graph
getNodes
in interface Graph
public boolean removeNode(Object nodeName)
Graph
removeNode
in interface Graph
public boolean removeEdge(Object tail, Object head, Object label)
Graph
removeEdge(new Graph.Edge(tail, head,
label))
.
removeEdge
in interface Graph
Graph.removeEdge(Graph.Edge)
public boolean removeEdge(Graph.Edge edge)
Graph
removeEdge
in interface Graph
public void removeAll()
Graph
removeAll
in interface Graph
public List getOutgoingEdges(Object node)
Graph
getOutgoingEdges
in interface Graph
public int outgoingEdgeCount(Object node)
Graph
getOutgoingEdges(node).size()
.
outgoingEdgeCount
in interface Graph
Graph.getOutgoingEdges(Object)
public int incomingEdgeCount(Object node)
incomingEdgeCount
in interface Graph
Graph.outgoingEdgeCount(Object)
public List getIncomingEdges(Object node)
getIncomingEdges
in interface Graph
Graph.getOutgoingEdges(Object)
public String toString()
digraph foo { Boston -> New_York [label="214 miles"]; Boston -> Chicago [label="983 miles"]; New_York -> Chicago [label="787 miles"]; Boston -> Westford [label="35 miles"]; Raleigh -> Westford [label="722 miles"]; }
Note that to get a neat printable representation, each node and edge label must have a short printable representation.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |