com.sun.electric.database.hierarchy
Class HierarchyEnumerator

java.lang.Object
  extended by com.sun.electric.database.hierarchy.HierarchyEnumerator

public final class HierarchyEnumerator
extends java.lang.Object

The HierarchyEnumerator can help programs that need to "flatten" the design hierarchy. Examples of such programs include the logical effort engine and routers.

The HierarchyEnumerator performs a recursive descent of the "completely expanded" design hierarchy. The HierarchyEnumerator brings the Visitor along with it during the excursion. The HierarchyEnumerator doesn't build a flattened data structure, that's the prerogative of the Visitor. The HierarchyEnumerator simply invokes Visitor methods for each Cell instance and NodeInst.

The following example illustrates the notion of "completely expanded". Suppose the root Cell instantiates Cell A twice, and Cell A instantiates Cell B twice. Then the HierarchyEnumerator visits two instances of Cell A and four instances of Cell B.


Nested Class Summary
static class HierarchyEnumerator.CellInfo
          The CellInfo object is used to pass information to the Visitor during the enumeration.
static class HierarchyEnumerator.NameProxy
          Stores the information necessary to generate an instance name for a Part It is sometimes important not to store the instance name as a String.
static class HierarchyEnumerator.NetDescription
          The NetDescription object provides a Network and the level of hierarchy in which the Network occurs.
static class HierarchyEnumerator.NetNameProxy
           
static class HierarchyEnumerator.NodableNameProxy
           
static class HierarchyEnumerator.Visitor
          Perform useful work while the HierarchyEnumerator enumerates the design.
 
Method Summary
static void enumerateCell(Cell root, VarContext context, HierarchyEnumerator.Visitor visitor)
          Begin enumeration of the contents of the Cell root.
static void enumerateCell(Cell root, VarContext context, HierarchyEnumerator.Visitor visitor, Netlist.ShortResistors shortResistors)
           
static void enumerateCell(Netlist rootNetlist, VarContext context, HierarchyEnumerator.Visitor visitor)
           
static void enumerateCell(Netlist rootNetlist, VarContext context, HierarchyEnumerator.Visitor visitor, boolean caching)
          Experimental.
static Network getNetworkInChild(Network parentNet, Nodable childNodable)
          Get the Network in the childNodable that corresponds to the Network in the childNodable's parent cell.
static int getNumUniqueChildCells(Cell cell)
          Method to count number of unique cells in hierarchy.
static boolean searchInExportNetwork(Network net, HierarchyEnumerator.CellInfo info, Network visitorNet)
           
static boolean searchNetworkInParent(Network net, HierarchyEnumerator.CellInfo info, Network visitorNet)
          Method to search if child network is connected to visitor network (visitorNet).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

enumerateCell

public static void enumerateCell(Cell root,
                                 VarContext context,
                                 HierarchyEnumerator.Visitor visitor)
Begin enumeration of the contents of the Cell root. You MUST call rebuildNetworks() on the root Cell before calling beginEnumeration().

Parameters:
root - the starting point of the enumeration.
context - the VarContext for evaluating parameters in Cell root. If context is null then VarContext.globalContext is used.
visitor - the object responsible for doing something useful during the enumertion of the design hierarchy.

enumerateCell

public static void enumerateCell(Cell root,
                                 VarContext context,
                                 HierarchyEnumerator.Visitor visitor,
                                 Netlist.ShortResistors shortResistors)

enumerateCell

public static void enumerateCell(Netlist rootNetlist,
                                 VarContext context,
                                 HierarchyEnumerator.Visitor visitor)

enumerateCell

public static void enumerateCell(Netlist rootNetlist,
                                 VarContext context,
                                 HierarchyEnumerator.Visitor visitor,
                                 boolean caching)
Experimental. Optionally caches results of variable evaluation.


getNumUniqueChildCells

public static int getNumUniqueChildCells(Cell cell)
Method to count number of unique cells in hierarchy. Useful for progress tracking of hierarchical netlisters and writers.


getNetworkInChild

public static Network getNetworkInChild(Network parentNet,
                                        Nodable childNodable)
Get the Network in the childNodable that corresponds to the Network in the childNodable's parent cell.

Parameters:
parentNet - the network in the parent
childNodable - the child nodable.
Returns:
the network in the child that connects to the network in the parent, or null if no such network.

searchNetworkInParent

public static boolean searchNetworkInParent(Network net,
                                            HierarchyEnumerator.CellInfo info,
                                            Network visitorNet)
Method to search if child network is connected to visitor network (visitorNet). Used in Quick.java and Connection.java.


searchInExportNetwork

public static boolean searchInExportNetwork(Network net,
                                            HierarchyEnumerator.CellInfo info,
                                            Network visitorNet)