mapss.dif.csdf.sdf.mem
Class PartitionBase

java.lang.Object
  extended by mocgraph.Graph
      extended by mapss.dif.csdf.sdf.mem.PartitionBase
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
GraphPartition, PartitionedGraph

public class PartitionBase
extends mocgraph.Graph

A base class for partitioned graph structure. This class provides commonly used methods for GraphPartition and PartitionedGraph. Basically, this class is still an instance of graph because all partition structures are indeed graphs.

Version:
$Id: PartitionBase.java 406 2007-05-10 14:27:07Z plishker $
Author:
Mingyung Ko

Constructor Summary
PartitionBase()
          A constructor.
PartitionBase(mocgraph.Graph graph)
          Constructor for a given graph.
 
Method Summary
protected  void _checkGraphElement(mocgraph.Element element)
           
 java.util.List ascendentListOf(java.util.Collection objects)
          An ascendently ordered list of objects.
 java.util.List descendentListOf(java.util.Collection objects)
          A descendently ordered list of objects.
 int getIndex()
          Return index of this partition base where it is contained.
 boolean removeEdge(mocgraph.Edge edge)
          Remove a graph edge and the associated value.
 boolean removeNode(mocgraph.Node node)
          Remove a graph node and the associated value.
 void setElementValue(mocgraph.Element element, double value)
          Set the value of a graph element.
 void setElementValues(java.util.Map valueMap)
          Set values for graph elements.
 void setIndex(int index)
          Set index of this partition base where it is contained.
 double valueOf(java.lang.Object object)
          Get the value associated with the object.
 
Methods inherited from class mocgraph.Graph
_addEdge, _connect, _connectEdge, _disconnect, _disconnectEdge, _emptyGraph, _initializeAnalyses, _registerChange, _registerEdge, _registerNode, addAnalysis, addEdge, addEdge, addEdge, addEdge, addEdge, addEdges, addGraph, addNode, addNode, addNodes, addNodeWeight, addNodeWeights, changeCount, clone, cloneAs, connectedComponents, containsEdge, containsEdgeWeight, containsNode, containsNodeWeight, edge, edge, edgeCount, edgeLabel, edgeLabel, edges, edges, edges, edgeWeight, equals, hashCode, hidden, hiddenEdgeCount, hiddenEdges, hideEdge, incidentEdgeCount, incidentEdges, neighborEdges, neighbors, node, node, nodeCount, nodeLabel, nodeLabel, nodes, nodes, nodes, nodeWeight, restoreEdge, selfLoopEdgeCount, selfLoopEdgeCount, selfLoopEdges, selfLoopEdges, subgraph, subgraph, toString, validateWeight, validateWeight, validateWeight, validateWeight, validEdgeWeight, validNodeWeight, weightArray
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PartitionBase

public PartitionBase()
A constructor.


PartitionBase

public PartitionBase(mocgraph.Graph graph)
Constructor for a given graph. Construct the partitioned graph by duplicating all nodes and edges.

Parameters:
graph - The graph to construct from.
Method Detail

ascendentListOf

public java.util.List ascendentListOf(java.util.Collection objects)
An ascendently ordered list of objects. It is the associated values, see valueOf(Object), being sorted. The argument comes from nodes()/edges() methods in class Graph or a collection of GraphPartitions.

Parameters:
objects - The objects to be ordered.
Returns:
An ascendent list of the objects.

descendentListOf

public java.util.List descendentListOf(java.util.Collection objects)
A descendently ordered list of objects. It is the associated values, see valueOf(Object), being sorted. The argument comes from nodes()/edges() methods in class Graph or a collection of GraphPartitions.

Parameters:
elements - The objects to be ordered.
Returns:
A descendent list of the objects.

getIndex

public int getIndex()
Return index of this partition base where it is contained.

Returns:
The index number.

removeEdge

public boolean removeEdge(mocgraph.Edge edge)
Remove a graph edge and the associated value.

Overrides:
removeEdge in class mocgraph.Graph
Parameters:
edge - The given edge.
Returns:
True if the edge was removed.

removeNode

public boolean removeNode(mocgraph.Node node)
Remove a graph node and the associated value.

Overrides:
removeNode in class mocgraph.Graph
Parameters:
node - The given node.
Returns:
True if the node was removed.

setElementValue

public void setElementValue(mocgraph.Element element,
                            double value)
Set the value of a graph element. The value must be of type double. The previous value is overwritten if it exists.

Parameters:
element - The given graph element.
value - The associated value double.

setElementValues

public void setElementValues(java.util.Map valueMap)
Set values for graph elements. The previous values are overwritten if they exist.

Parameters:
valueMap - A map of the given elements and values.

setIndex

public void setIndex(int index)
Set index of this partition base where it is contained.

Parameters:
The - desired index number.

valueOf

public double valueOf(java.lang.Object object)
Get the value associated with the object. Valid objects are node, edge, collection of nodes/edges, and graph partition. Validity checking is enforced by throwing exceptions. For graph partitions, the total value of NODEs is returned.

Parameters:
object - The object to get the associated value.
Returns:
The associated value.
Throws:
java.lang.IllegalArgumentException - If object invalid to get value.

_checkGraphElement

protected void _checkGraphElement(mocgraph.Element element)