com.sun.electric.database.hierarchy
Class HierarchyEnumerator.Visitor

java.lang.Object
  extended by com.sun.electric.database.hierarchy.HierarchyEnumerator.Visitor
Direct Known Subclasses:
Geometry.Visitor, GeometrySearch, LayerCoverageTool.LayerVisitor, LENetlister, NccCrossProbing, NetworkHighlighter, SchematicVisitor, SCLibraryGen.StandardCellHierarchy, Spice.FlatSpiceCodeVisitor, Topology.Visitor
Enclosing class:
HierarchyEnumerator

public abstract static class HierarchyEnumerator.Visitor
extends java.lang.Object

Perform useful work while the HierarchyEnumerator enumerates the design. Whereas the HierarchyEnumerator is responsible for enumerating every Cell and NodeInst in the flattened design, the Visitor object is responsible for performing useful work during the enumeration.

The HierarchyEnumerator performs a recursive descent of the design hierarchy starting with the root Cell. When the HierarchyEnumerator enters a Cell instance it calls the Visitor's enterCell() method to let the Visitor know that it's just started working on a new Cell instance. Then the HierarchyEnumerator calls the Visitor's visitNodeInst() method for each NodeInst in that Cell. Finally, after all the NodeInsts have been visited, the HierarchyEnumerator calls the Visitor's exitCell() method to inform the Visitor that the HierarchyEnumerator is done with that Cell.

The Visitor's visitNodeInst() method controls whether the HierarchyEnumerator descends recursively into the Cell instantiated by that NodeInst. If the visitNodeInst() method returns true, then the HierarchyEnumerator enumerates the contents of that NodeInst's child Cell before it continues enumerating the NodeInsts of the current Cell.


Constructor Summary
HierarchyEnumerator.Visitor()
           
 
Method Summary
abstract  boolean enterCell(HierarchyEnumerator.CellInfo info)
          The HierarchyEnumerator is about to begin enumerating the contents of a new Cell instance.
abstract  void exitCell(HierarchyEnumerator.CellInfo info)
          The HierarchyEnumerator has finished enumerating the contents of the current Cell instance.
 HierarchyEnumerator.CellInfo newCellInfo()
          A hook to allow the user to add additional information to a CellInfo.
abstract  boolean visitNodeInst(Nodable ni, HierarchyEnumerator.CellInfo info)
          The HierarchyEnumerator is visiting Nodable ni.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HierarchyEnumerator.Visitor

public HierarchyEnumerator.Visitor()
Method Detail

newCellInfo

public HierarchyEnumerator.CellInfo newCellInfo()
A hook to allow the user to add additional information to a CellInfo. The newCellInfo method is a "Factory" method. If the user wishes to record additional application specific information for each Cell, the user should extend the CellInfo class and then override newCellInfo to return an instance of that derived class.


enterCell

public abstract boolean enterCell(HierarchyEnumerator.CellInfo info)
The HierarchyEnumerator is about to begin enumerating the contents of a new Cell instance. That instance has just become the new "current" Cell instance.

Parameters:
info - information about the Cell instance being enumerated
Returns:
a boolean indicating if the HierarchyEnumerator should enumerate the contents of the current Cell. True means enumerate the current cell

exitCell

public abstract void exitCell(HierarchyEnumerator.CellInfo info)
The HierarchyEnumerator has finished enumerating the contents of the current Cell instance. It is about to leave it, never to return. The CellInfo associated with the current Cell instance is about to be abandoned.

Parameters:
info - information about the Cell instance being enumerated

visitNodeInst

public abstract boolean visitNodeInst(Nodable ni,
                                      HierarchyEnumerator.CellInfo info)
The HierarchyEnumerator is visiting Nodable ni.

Parameters:
ni - the Nodable that HierarchyEnumerator is visiting.
Returns:
a boolean indicating whether or not the HierarchyEnumerator should expand the Cell instantiated by ni. True means expand. If ni instantiates a PrimitiveNode then the return value is ignored by the HierarchyEnumerator.