mapss.dif
Class DIFGraph

java.lang.Object
  extended by mocgraph.Graph
      extended by mocgraph.DirectedGraph
          extended by mapss.dif.DIFGraph
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
BDFGraph, CSDFGraph, MDSDFGraph, PSDFGraph, PSDFSpecificationGraph

public class DIFGraph
extends mocgraph.DirectedGraph

Information associated with an DIF graph. This class caches frequently-used data associated with DIF graphs. It is also useful for intermediate DIF graph representations that do not correspond to Ptolemy II models, and performing graph transformations (e.g. conversion to and manipulation of single-rate graphs). It is intended for use with analysis/synthesis algorithms that operate on generic graph representations of CSDF models.

The attribute mechanism in this class can be used to bind arbitrary attributes to elements (mocgraph.Node and mocgraph.Edge) or the graph itself. Implementation details of this mechanism can be found in AttributeContainer and DIFAttribute.

DIF supports parameterizing values as parameters. The parameter mechanism of DIFGraph handles this task. Implementation details can be found in DIFParameter.

Containers for AttributeContainer and containers for DIFParameter are implemented as LinkedHashMap. The "HashMap" property provides a good way to retrive contents and the "linked" property maintains the order of insertion.

Version:
$Id: DIFGraph.java 409 2007-05-13 19:47:16Z plishker $
Author:
Chia-Jui Hsu, Fuat Keceli, Michael Rinehart, Shuvra S. Bhattacharyya
See Also:
DIFEdgeWeight, DIFNodeWeight, AttributeContainer, DIFAttribute, DIFParameter

Constructor Summary
DIFGraph()
          Construct an empty DIF graph.
DIFGraph(int nodeCount)
          Construct an empty DIF graph with enough storage allocated for the specified number of nodes.
DIFGraph(int nodeCount, int edgeCount)
          Construct an empty DIF graph with enough storage allocated for the specified number of edges, and number of nodes.
 
Method Summary
protected  AttributeContainer _getAttributeContainer(java.lang.Object object)
          Returns a container in which attributes of an edge, a node or the graph are stored.
protected  void _registerEdge(mocgraph.Edge edge)
          Register a new edge in the graph.
protected  void _registerNode(mocgraph.Node node)
          Register a new node in the graph.
protected  AttributeContainer _removeAttributeContainer(java.lang.Object object)
          Remove the AttributeContainer of graph itself or graph element.
protected  java.util.LinkedList _removeReferenceFromAttributes(java.lang.Object refObj)
          If any attribute in graph or elements of graph contains refObj as value, remove that element object from the attribute.
protected  AttributeContainer _setAttributeContainer(java.lang.Object object, AttributeContainer container)
          Sets a container for this object in which attributes of an edge, a node or the graph can be stored.
 mocgraph.Edge addEdge(mocgraph.Node node1, mocgraph.Node node2)
          This operation is unsupported and always throws a GraphWeightException.
 java.util.Collection addEdge(java.lang.Object weight1, java.lang.Object weight2)
          This operation is unsupported and always throws a GraphWeightException.
 boolean equals(java.lang.Object graph)
          Test if a graph is equal to this one.
 DIFAttribute getAttribute(mocgraph.Element element, java.lang.String name)
          Returns the DIFAttribute associated with the element.
 DIFAttribute getAttribute(java.lang.String name)
          Returns the DIFAttribute associated with this graph.
 DIFAttribute getAttributeByContent(mocgraph.Element element, java.lang.Object value)
          Returns the first DIFAttribute of the element that contains the given value.
 DIFAttribute getAttributeByContent(java.lang.Object value)
          Returns the first DIFAttribute of this graph that contains the given value object.
 java.lang.String getAttributeDescriptions()
          Returns the description of the graph attributes as defined in getAttributeDescriptions(Element).
 java.lang.String getAttributeDescriptions(mocgraph.Element element)
          Returns the description of a graph element (node/edge) with its attributes.This description contains the name of the object as defined by setName(java.lang.String) method, names and values of the attributes.
 java.util.LinkedList getAttributeNames()
          Returns a list of attribute names that can be found associated with this graph.
 java.util.LinkedList getAttributeNames(mocgraph.Element element)
          Returns a list of attribute names that can be found associated with this element.
 java.util.LinkedList getAttributes()
          Returns a LinkedList of DIFAttribute associated with this graph.
 java.util.LinkedList getAttributes(mocgraph.Element element)
          Returns a LinkedList of DIFAttribute associated with this element.
 java.util.LinkedList getAttributesByContent(mocgraph.Element element, java.lang.Object value)
          Returns the DIFAttributes of the element that contain the given value object.
 java.util.LinkedList getAttributesByContent(java.lang.Object value)
          Returns the DIFAttributes in this graph that contain the given value object.
 mocgraph.Edge getEdge(java.lang.String name)
          Returns the edge by name.
 java.lang.String getName()
          Returns the name of this graph which is assigned by the setName(java.lang.String) method.
 java.lang.String getName(mocgraph.Element element)
          Returns the name of this edge/node which is assigned by the setName(java.lang.String) method.
 mocgraph.Node getNode(java.lang.String name)
          Returns the node by name.
 java.lang.Object getObject(java.lang.String name)
          Returns the first object that has this name specified by getName method.
 DIFParameter getParameter(java.lang.String name)
          Returns the DIFParameter with the given name.
 java.util.LinkedList getParameterNames()
          Returns all the parameter names based on the order of insertion.
 java.util.LinkedList getParameters()
          Returns all DIFParameters.
 int hashCode()
          Returns the hash code for this graph.
 boolean hideEdge(mocgraph.Edge edge)
          Hide an edge in this graph.
 boolean mergeGraph(mocgraph.Graph graph)
          Merge graph into this graph.
 DIFGraph mirror()
          Mirror this graph.
 DIFGraph mirror(java.util.Map mirrorMap)
          Mirror this graph.
 void removeAllAttributes()
          Remove all DIFAttribute from the AttributeContainer associated with this graph.
 void removeAllAttributes(mocgraph.Element element)
          Remove all DIFAttribute from the AttributeContainer associated with this element.
 DIFAttribute removeAttribute(DIFAttribute attribute)
          Removes the DIFAttribute from the attribute container of the graph.
 DIFAttribute removeAttribute(mocgraph.Element element, DIFAttribute attribute)
          Removes the DIFAttribute from the attribute container of the element.
 DIFAttribute removeAttribute(mocgraph.Element element, java.lang.String name)
          Removes the DIFAttribute with the given name from the attribute container of this element.
 DIFAttribute removeAttribute(java.lang.String name)
          Removes the DIFAttribute with the given name from the attribute container of the graph.
 boolean removeEdge(mocgraph.Edge edge)
          Remove an edge from this graph.
 boolean removeNode(mocgraph.Node node)
          Remove a node from this graph.
 DIFParameter removeParameter(java.lang.String name)
          Removes the parameter defined by the given name from the parameter list.
 boolean restoreEdge(mocgraph.Edge edge)
          Restore an edge in this graph.
 void setAttribute(DIFAttribute attribute)
          Sets an attribute of the graph.
 void setAttribute(mocgraph.Element element, DIFAttribute attribute)
          Sets an attribute of an element.
 java.lang.String setName(mocgraph.Element element, java.lang.String name)
          Sets the name of this edge/node.
 java.lang.String setName(java.lang.String name)
          Sets the name of this graph.
 DIFParameter setParameter(DIFParameter parameter)
          Add a DIFParameter to the graph.
 mocgraph.Graph subgraph(java.util.Collection nodes)
          Overrides the method in mocgraph.Graph to copy the attributes as well.
 mocgraph.Graph subgraph(java.util.Collection nodeCollection, java.util.Collection edgeCollection)
          Overrides the method in mocgraph.Graph to copy the attributes as well.
 boolean validEdgeWeight(java.lang.Object object)
          Returns true if the given object is a valid edge weight for this graph.
 boolean validNodeWeight(java.lang.Object object)
          Returns true if the given object is a valid node weight for this graph.
 
Methods inherited from class mocgraph.DirectedGraph
_connect, _connectedSubGraph, _disconnect, _initializeAnalyses, backwardReachableNodes, backwardReachableNodes, backwardReachableNodes, backwardReachableNodes, cycleNodeCollection, cycleNodes, edgeExists, edgeExists, inputEdgeCount, inputEdges, isAcyclic, outputEdgeCount, outputEdges, predecessorEdges, predecessors, reachableNodes, reachableNodes, reachableNodes, reachableNodes, sccDecomposition, selfLoopEdgeCount, sinkNodeCount, sinkNodes, sourceNodeCount, sourceNodes, subgraphs, successorEdges, successors, toDirectedAcyclicGraph, topologicalSort, topologicalSort, transitiveClosure
 
Methods inherited from class mocgraph.Graph
_addEdge, _connectEdge, _disconnectEdge, _emptyGraph, _registerChange, addAnalysis, 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, hidden, hiddenEdgeCount, hiddenEdges, incidentEdgeCount, incidentEdges, neighborEdges, neighbors, node, node, nodeCount, nodeLabel, nodeLabel, nodes, nodes, nodes, nodeWeight, selfLoopEdgeCount, selfLoopEdges, selfLoopEdges, toString, validateWeight, validateWeight, validateWeight, validateWeight, weightArray
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DIFGraph

public DIFGraph()
Construct an empty DIF graph. Default name of the graph is "_graph". Default names of elements are n + label for nodes and e + label for edges.


DIFGraph

public DIFGraph(int nodeCount)
Construct an empty DIF graph with enough storage allocated for the specified number of nodes. Default name of the graph is "_graph". Default names of elements are n + label for nodes and e + label for edges.

Parameters:
nodeCount - The number of nodes.

DIFGraph

public DIFGraph(int nodeCount,
                int edgeCount)
Construct an empty DIF graph with enough storage allocated for the specified number of edges, and number of nodes. Default name of the graph is "_graph". Default names of elements are n + label for nodes and e + label for edges.

Parameters:
nodeCount - The integer specifying the number of nodes
edgeCount - The integer specifying the number of edges
Method Detail

addEdge

public java.util.Collection addEdge(java.lang.Object weight1,
                                    java.lang.Object weight2)
This operation is unsupported and always throws a GraphWeightException. This is because unweighted edges in DIFGraphs are not allowed.

Overrides:
addEdge in class mocgraph.Graph
Throws:
mocgraph.GraphWeightException - Always thrown.

addEdge

public mocgraph.Edge addEdge(mocgraph.Node node1,
                             mocgraph.Node node2)
This operation is unsupported and always throws a GraphWeightException. This is because unweighted edges in DIFGraphs are not allowed.

Overrides:
addEdge in class mocgraph.Graph
Throws:
mocgraph.GraphWeightException - Always thrown.

equals

public boolean equals(java.lang.Object graph)
Test if a graph is equal to this one. It is equal if it is of the same class, and has the same sets of nodes/edges and all the attributes are the same. For two attributes to be the same they should have the same names and same values but not necessarily the same objects. If parameters and attributes refer to other objects, it may not "equal" because comparing refered objects are hard to implemented.

Overrides:
equals in class mocgraph.Graph
Parameters:
graph - The graph with which to compare this graph.
Returns:
True if the graph is equal to this one.

getAttribute

public DIFAttribute getAttribute(java.lang.String name)
Returns the DIFAttribute associated with this graph.

Parameters:
name - The name of this DIFAttribute.
Returns:
The DIFAttribute with the given name. Null if the attribute doesn't exist.
See Also:
DIFAttribute, AttributeContainer

getAttribute

public DIFAttribute getAttribute(mocgraph.Element element,
                                 java.lang.String name)
Returns the DIFAttribute associated with the element.

Parameters:
element - An edge or node in this graph.
name - The name of this DIFAttribute. use #getAttribute(String, String).
Returns:
The DIFAttribute with the given name. Null if the attribute doesn't exist.
Throws:
mocgraph.GraphElementException - If the element is not contained in the graph.
See Also:
DIFAttribute, AttributeContainer

getAttributes

public java.util.LinkedList getAttributes()
Returns a LinkedList of DIFAttribute associated with this graph.

Returns:
A LinkedList of DIFAttribute associated with this graph.
See Also:
AttributeContainer

getAttributes

public java.util.LinkedList getAttributes(mocgraph.Element element)
Returns a LinkedList of DIFAttribute associated with this element.

Parameters:
element - An edge or node in this graph.
Returns:
A LinkedList of DIFAttribute associated with this element.
See Also:
AttributeContainer

getAttributeByContent

public DIFAttribute getAttributeByContent(java.lang.Object value)
Returns the first DIFAttribute of this graph that contains the given value object.

Parameters:
value - The value object (token or object reference) contained by this DIFAttribute.
Returns:
The DIFAttribute if found, otherwise, null.

getAttributesByContent

public java.util.LinkedList getAttributesByContent(java.lang.Object value)
Returns the DIFAttributes in this graph that contain the given value object.

Parameters:
value - The value object.
Returns:
The LinkedList of DIFAttributes containes the value. Or an empty LinkedList if not found.

getAttributeByContent

public DIFAttribute getAttributeByContent(mocgraph.Element element,
                                          java.lang.Object value)
Returns the first DIFAttribute of the element that contains the given value.

Parameters:
element - An edge or node in this graph.
value - The value object (token or object reference) contained by this DIFAttribute.
Returns:
attribute if found, otherwise, null.

getAttributesByContent

public java.util.LinkedList getAttributesByContent(mocgraph.Element element,
                                                   java.lang.Object value)
Returns the DIFAttributes of the element that contain the given value object.

Parameters:
value - The value object.
Returns:
The LinkedList of DIFAttributes containes the value. Or an empty LinkedList if not found.

getAttributeDescriptions

public java.lang.String getAttributeDescriptions()
Returns the description of the graph attributes as defined in getAttributeDescriptions(Element).

Returns:
Attribute description of the graph.

getAttributeDescriptions

public java.lang.String getAttributeDescriptions(mocgraph.Element element)
Returns the description of a graph element (node/edge) with its attributes.This description contains the name of the object as defined by setName(java.lang.String) method, names and values of the attributes.

Parameters:
element - An edge or node in this graph.
Returns:
Attribute description of the object.
Throws:
mocgraph.GraphElementException - If the element is not contained in the graph.

getAttributeNames

public java.util.LinkedList getAttributeNames()
Returns a list of attribute names that can be found associated with this graph. The list will be sorted.

Returns:
A list of Strings.

getAttributeNames

public java.util.LinkedList getAttributeNames(mocgraph.Element element)
Returns a list of attribute names that can be found associated with this element. The list will be sorted.

Parameters:
element - An edge or node in this graph.
Returns:
A list of Strings.
Throws:
mocgraph.GraphElementException - If the element is not contained in the graph.

getEdge

public mocgraph.Edge getEdge(java.lang.String name)
Returns the edge by name. Returns null if no such edge.

Parameters:
name - A name string.
Returns:
An edge or null.

getName

public java.lang.String getName()
Returns the name of this graph which is assigned by the setName(java.lang.String) method. If no name or null was assigned as the name it is set to empty string.

Returns:
The name of this graph.

getName

public java.lang.String getName(mocgraph.Element element)
Returns the name of this edge/node which is assigned by the setName(java.lang.String) method. If no name or null was assigned as the name it is set to empty string.

Parameters:
element - An edge or node in this graph.
Returns:
The name of this object.
Throws:
mocgraph.GraphElementException - If the element is not contained in the graph.

getNode

public mocgraph.Node getNode(java.lang.String name)
Returns the node by name. Returns null if no such node.

Parameters:
name - A name string.
Returns:
A node or null.

getObject

public java.lang.Object getObject(java.lang.String name)
Returns the first object that has this name specified by getName method. Returns null if no such object is found.

Parameters:
name - A string.
Returns:
A node/edge in this graph or this graph itself. Null if name is not found.

getParameter

public DIFParameter getParameter(java.lang.String name)
Returns the DIFParameter with the given name.

Parameters:
name - The name of the parameter.
Returns:
The DIFParameter that is defined by the given parameter name. Null if not found.

getParameterNames

public java.util.LinkedList getParameterNames()
Returns all the parameter names based on the order of insertion.

Returns:
A list of Strings.

getParameters

public java.util.LinkedList getParameters()
Returns all DIFParameters.

Returns:
A list of Strings.

hashCode

public int hashCode()
Returns the hash code for this graph.

Overrides:
hashCode in class mocgraph.Graph
Returns:
The hash code for this graph.

hideEdge

public boolean hideEdge(mocgraph.Edge edge)
Hide an edge in this graph. The AttributeContainer of this edge and all attributes in this graph that contains thie edge as value can be recovered.

Overrides:
hideEdge in class mocgraph.Graph
Parameters:
edge - The edge to be removed.
Returns:
True if the edge was removed.
See Also:
Graph.hideEdge(mocgraph.Edge)

mergeGraph

public boolean mergeGraph(mocgraph.Graph graph)
Merge graph into this graph. Nodes, edges, node attributes, and edge attributes are transferred/ merged (not copied) to this graph. Self attributes and parameters of graph are also transferred/merged (not copied) but their names are all prefixed by the graph name.

Note that after performing this method, use of the original graph is not recommended since certain cross references are set to this graph.

Parameters:
graph - The graph to add.
Returns:
True if this graph changed as a result of this call.
Throws:
mocgraph.GraphConstructionException - If a node or edge in the source graph already exists in this graph.

mirror

public DIFGraph mirror()
Mirror this graph. For completely mirroring, please use DIFHierarchy.mirror().


mirror

public DIFGraph mirror(java.util.Map mirrorMap)
Mirror this graph. For completely mirroring, please use DIFHierarchy.mirror().

Parameters:
mirrorMap - external mappings of elements in hierarchy. This method will also put mappings of graph elements, parameters, attribute containers into mirrorMap.
Returns:
The mirrored graph

removeAllAttributes

public void removeAllAttributes()
Remove all DIFAttribute from the AttributeContainer associated with this graph.


removeAllAttributes

public void removeAllAttributes(mocgraph.Element element)
Remove all DIFAttribute from the AttributeContainer associated with this element.

Parameters:
element - An edge or node in this graph.

removeAttribute

public DIFAttribute removeAttribute(DIFAttribute attribute)
Removes the DIFAttribute from the attribute container of the graph.

Parameters:
attribute - The DIFAttribute object.
Returns:
Previous DIFAttribute if it exists, null otherwise.
See Also:
AttributeContainer

removeAttribute

public DIFAttribute removeAttribute(java.lang.String name)
Removes the DIFAttribute with the given name from the attribute container of the graph.

Parameters:
name - The name of the DIFAttribute to be deleted.
Returns:
Previous DIFAttribute if it exists, null otherwise.
See Also:
AttributeContainer

removeAttribute

public DIFAttribute removeAttribute(mocgraph.Element element,
                                    DIFAttribute attribute)
Removes the DIFAttribute from the attribute container of the element.

Parameters:
element - An edge or node in this graph.
attribute - The DIFAttribute object.
Returns:
Previous DIFAttribute if it exists, null otherwise.
See Also:
AttributeContainer

removeAttribute

public DIFAttribute removeAttribute(mocgraph.Element element,
                                    java.lang.String name)
Removes the DIFAttribute with the given name from the attribute container of this element.

Parameters:
element - An edge or node in this graph.
name - The name of the attribute to be deleted.
Returns:
Previous attribute if it exists, null otherwise.
Throws:
mocgraph.GraphElementException - If the element is not contained in the graph.
See Also:
AttributeContainer

restoreEdge

public boolean restoreEdge(mocgraph.Edge edge)
Restore an edge in this graph. The AttributeContainer of this edge and all attributes in this graph that contains thie edge as value can be recovered.

Overrides:
restoreEdge in class mocgraph.Graph
Parameters:
edge - The edge to be removed.
Returns:
True if the edge was removed.
See Also:
Graph.hideEdge(mocgraph.Edge)

removeEdge

public boolean removeEdge(mocgraph.Edge edge)
Remove an edge from this graph. An edge that is removed from a graph can be re-inserted into the graph at a later time (using Graph.addEdge(Edge)), provided that the incident nodes are still in the graph. However previous attributes of the edge won't be recovered.

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

removeNode

public boolean removeNode(mocgraph.Node node)
Remove a node from this graph. All edges incident to the node are also removed.

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

removeParameter

public DIFParameter removeParameter(java.lang.String name)
Removes the parameter defined by the given name from the parameter list.

Parameters:
name - Name of the interval to be removed.
Returns:
Removed parameter if it exists, null otherwise.

setAttribute

public void setAttribute(DIFAttribute attribute)
Sets an attribute of the graph. If there exist another attribute with the same name and type, the previous attribute is overridden.

Parameters:
attribute - A DIFAttribute.
Throws:
java.lang.IllegalArgumentException - If the name of attribute is null.

setAttribute

public void setAttribute(mocgraph.Element element,
                         DIFAttribute attribute)
Sets an attribute of an element. If there exist another attribute with the same name previous value is overridden.

Parameters:
element - An edge or node in this graph.
attribute - A DIFAttribute.
Throws:
mocgraph.GraphElementException - If the element is not contained in the graph.
java.lang.IllegalArgumentException - If the name of attribute is null.

setName

public java.lang.String setName(java.lang.String name)
Sets the name of this graph. If it is not set default is "_graph".

Parameters:
name - Name string. See {link mapss.dif.AttributeContainer#setName} for restrictions imposed on the name.
Returns:
Previous name associated with this graph. Null if no name was assigned previously.
Throws:
java.lang.IllegalArgumentException - If Conventions.labelConvention(java.lang.String) returns an error.

setName

public java.lang.String setName(mocgraph.Element element,
                                java.lang.String name)
Sets the name of this edge/node. Default names of elements are n + label for nodes and e + label for edges.

Parameters:
element - An edge or node in this graph.
name - Name string.
Returns:
Previous name associated with this object. Null if no name was assigned previously.
Throws:
mocgraph.GraphElementException - If the element is not contained in the graph.
java.lang.IllegalArgumentException - Conventions.labelConvention(java.lang.String) returns an error.

setParameter

public DIFParameter setParameter(DIFParameter parameter)
Add a DIFParameter to the graph.

Parameters:
parameter - A DIFParameter with a name.
Returns:
Old DIFParameter with the same name, null otherwise.

subgraph

public mocgraph.Graph subgraph(java.util.Collection nodes)
Overrides the method in mocgraph.Graph to copy the attributes as well. For each element copied, attributes will be copied together. Special attention should be given that parameter values are not copied therefore values of the parameterized attributes should be copied from the original graph manually (if desired).

Overrides:
subgraph in class mocgraph.Graph
Parameters:
nodes - The collection of nodes; each element is a Node.
Returns:
The induced subgraph with a runtime type of DIFGraph.

subgraph

public mocgraph.Graph subgraph(java.util.Collection nodeCollection,
                               java.util.Collection edgeCollection)
Overrides the method in mocgraph.Graph to copy the attributes as well. For each element copied, attributes will be copied together. Special attention should be given that parameter values are not copied therefore values of the parameterized attributes should be copied from the original graph manually (if desired).

Overrides:
subgraph in class mocgraph.Graph
Parameters:
nodeCollection - The subset of nodes; each element is an instance of Node.
edgeCollection - The subset of edges. Each element is an instance of Edge.
Returns:
The subgraph with a runtime type of DIFGraph.

validEdgeWeight

public boolean validEdgeWeight(java.lang.Object object)
Returns true if the given object is a valid edge weight for this graph.

Overrides:
validEdgeWeight in class mocgraph.Graph
Returns:
True if the given object is a valid edge weight for this graph.

validNodeWeight

public boolean validNodeWeight(java.lang.Object object)
Returns true if the given object is a valid node weight for this graph.

Overrides:
validNodeWeight in class mocgraph.Graph
Returns:
True if the given object is a valid node weight for this graph.

_getAttributeContainer

protected AttributeContainer _getAttributeContainer(java.lang.Object object)
Returns a container in which attributes of an edge, a node or the graph are stored.

In setName method name of the returned container is used as the name of the edge/node or graph.

Parameters:
object - A graph edge/node or the graph itself.
Returns:
A container which contains all the attributes (if any) of this edge/node.
Throws:
mocgraph.GraphElementException - If the runtime class of this object is an edge/node and it is not contained in the graph.

_registerEdge

protected void _registerEdge(mocgraph.Edge edge)
Register a new edge in the graph. The edge is assumed to be non-null, unique, and consistent with the node set.

Overrides:
_registerEdge in class mocgraph.Graph
Parameters:
edge - The new edge.
Throws:
java.lang.IllegalArgumentException - If the edge is unweighted or has a weight that is not an instance of DIFEdgeWeight.

_registerNode

protected void _registerNode(mocgraph.Node node)
Register a new node in the graph. The node is assumed to be non-null and unique.

Overrides:
_registerNode in class mocgraph.DirectedGraph
Parameters:
node - The new node.
Throws:
java.lang.IllegalArgumentException - If the node is unweighted or has a weight that is not an instance of DIFNodeWeight.

_removeReferenceFromAttributes

protected java.util.LinkedList _removeReferenceFromAttributes(java.lang.Object refObj)
If any attribute in graph or elements of graph contains refObj as value, remove that element object from the attribute.

Returns:
The LinkedList of DIFAttributes that contains refObj as value.

_setAttributeContainer

protected AttributeContainer _setAttributeContainer(java.lang.Object object,
                                                    AttributeContainer container)
Sets a container for this object in which attributes of an edge, a node or the graph can be stored. Returns the previous container. In setName method name of the returned container is used as the name of the edge/node or graph.

Parameters:
object - A graph edge/node or the graph itself.
container - An AttributeContainer.
Returns:
Previous container if it exists, null otherwise.

_removeAttributeContainer

protected AttributeContainer _removeAttributeContainer(java.lang.Object object)
Remove the AttributeContainer of graph itself or graph element. Note that, after the AttributeContainer for an element or the graph ifself is removed, access the name of that element or the graph itself is impossible. This method is used when edges or nodes are removed or hidden.

Parameters:
object - A graph edge/node or the graph itself.
Returns:
Previous container if it exists, null otherwise.