mapss.dif.graph.hierarchy
Class HierarchyException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by mapss.dif.graph.hierarchy.HierarchyException
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
CyclicHierarchyException

public class HierarchyException
extends java.lang.RuntimeException

This exception can be thrown by the methods in Hierarchy class. In addition to the exception functionality this class provides checks for maintaining stability and consistency in Hierarchy classes.

Version:
$Id: HierarchyException.java 409 2007-05-13 19:47:16Z plishker $
Author:
Fuat Keceli, Chia-Jui Hsu
See Also:
Hierarchy, Serialized Form

Constructor Summary
HierarchyException(java.lang.String message)
           
 
Method Summary
static HierarchyException checkConnection(mocgraph.Edge edge, Port port)
          Checks if an edge can be connected to a port.
static HierarchyException checkConnection(Port superPort, Port subPort)
          Checks if two ports can be connected.
static HierarchyException checkFlatten(Hierarchy hierarchy, mocgraph.Node node)
          Checks if a super node in a hierarchy can be flattened without creating any errors or inconsistencies.
static HierarchyException checkPort(Hierarchy hierarchy, Port port)
          Checks if port is suitable for adding to a hierarchy object.
static HierarchyException checkSuperNode(Hierarchy parent, Hierarchy child)
          Checks if a node can be defined as a super node in a hierarchy.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HierarchyException

public HierarchyException(java.lang.String message)
Parameters:
message - Error string which can be accessed using getMessage() method.
Method Detail

checkConnection

public static HierarchyException checkConnection(mocgraph.Edge edge,
                                                 Port port)
Checks if an edge can be connected to a port.

Returns an exception if any of the following statements is true:


checkConnection

public static HierarchyException checkConnection(Port superPort,
                                                 Port subPort)
Checks if two ports can be connected.

Two ports can be connected only if their hierarchies are directly related (i.e. one is a super-hierarchy and the other one is a sub-hierarchy). Also directions of the ports should match.

Parameters:
superPort - Port in the super-hierarchy.
subPort - Port in the sub-hierarchy.
Returns:
A HierarchyException if any of the above statements is true, null otherwise.

checkFlatten

public static HierarchyException checkFlatten(Hierarchy hierarchy,
                                              mocgraph.Node node)
Checks if a super node in a hierarchy can be flattened without creating any errors or inconsistencies. Returns an exception if any of the following statements is true:

checkPort

public static HierarchyException checkPort(Hierarchy hierarchy,
                                           Port port)
Checks if port is suitable for adding to a hierarchy object.

Returns an exception if the name of the port already exists in the hierarchy that it is being added.

Parameters:
hierarchy - Hierarchy to which the port will be added.
port - Port to be added to the hierarchy.
Returns:
A HierarchyException if the name of the port already exists null otherwise.

checkSuperNode

public static HierarchyException checkSuperNode(Hierarchy parent,
                                                Hierarchy child)
Checks if a node can be defined as a super node in a hierarchy.

Returns an exception if any of the following statements is true:

Parameters:
parent - The hierarchy that contains the node.
child - Sub-hierarchy to be added.
Returns:
A HierarchyException if any of the above statements is true, null otherwise.