|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.isi.pegasus.planner.partitioner.graph.MapGraph
public class MapGraph
An implementation of the Graph that is backed by a Map.
| Nested Class Summary | |
|---|---|
protected class |
MapGraph.MapGraphIterator
An inner iterator class that traverses through the Graph. |
| Field Summary | |
|---|---|
private LogManager |
mLogger
The handle to the logging manager. |
protected Map |
mStore
The map indexed by the id of the GraphNode, used for storing
the nodes of the Graph. |
| Fields inherited from interface edu.isi.pegasus.planner.partitioner.graph.Graph |
|---|
VERSION |
| Constructor Summary | |
|---|---|
MapGraph()
The default constructor. |
|
| Method Summary | |
|---|---|
void |
addEdge(String parent,
String child)
Adds an edge between two already existing nodes in the graph. |
void |
addEdges(String child,
List parents)
A convenience method that allows for bulk addition of edges between already existing nodes in the graph. |
void |
addNode(GraphNode node)
Adds a node to the Graph. |
void |
addRoot(GraphNode root)
Adds a single root node to the Graph. |
Object |
clone()
Returns a copy of the object. |
Object |
get(Object key)
It returns the value associated with the key in the map. |
List |
getLeaves()
Returns the leaf nodes of the Graph. |
GraphNode |
getNode(String identifier)
Returns the node matching the id passed. |
List |
getRoots()
Returns the root nodes of the Graph. |
boolean |
isEmpty()
Returns a boolean if there are no nodes in the graph. |
Iterator |
iterator()
Returns an iterator that traverses through the graph using a graph traversal algorithm. |
Iterator |
nodeIterator()
Returns an iterator for the nodes in the Graph. |
boolean |
remove(String identifier)
Removes a node from the Graph. |
int |
size()
Returns the number of nodes in the graph. |
Iterator<GraphNode> |
topologicalSortIterator()
Returns an iterator for the graph that traverses in topological sort order. |
String |
toString()
The textual representation of the graph node. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected Map mStore
GraphNode, used for storing
the nodes of the Graph. The value for each key is the corresponding
GraphNode of the class.
private LogManager mLogger
| Constructor Detail |
|---|
public MapGraph()
| Method Detail |
|---|
public void addNode(GraphNode node)
addNode in interface Graphnode - the node to be added to the Graph.public GraphNode getNode(String identifier)
getNode in interface Graphidentifier - the id of the node.
public void addRoot(GraphNode root)
addRoot in interface Graphroot - the GraphNode to be added as a root.
RuntimeException - if a node with the same id already exists.public boolean remove(String identifier)
remove in interface Graphidentifier - the id of the node to be removed.
public List getRoots()
getRoots in interface GraphGraphNode corressponding to the
root nodes.public List getLeaves()
getLeaves in interface GraphGraphNode corressponding to the
leaf nodes.
public void addEdge(String parent,
String child)
addEdge in interface Graphparent - the parent node ID.child - the child node ID.
public void addEdges(String child,
List parents)
addEdges in interface Graphchild - the child node IDparents - list of parent identifiers as String.public int size()
size in interface Graphpublic Iterator nodeIterator()
nodeIterator in interface Graphpublic Iterator iterator()
iterator in interface Graphpublic Iterator<GraphNode> topologicalSortIterator()
topologicalSortIterator in interface Graphpublic String toString()
toString in class Objectpublic boolean isEmpty()
isEmpty in interface Graphpublic Object clone()
clone in class Objectpublic Object get(Object key)
key - the key to the entry in the map.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||