edu.byu.ece.edif.tools.flatten
Class InstanceNode

java.lang.Object
  extended by edu.byu.ece.edif.tools.flatten.InstanceNode
All Implemented Interfaces:
HierarchicalInstance, java.io.Serializable

public class InstanceNode
extends java.lang.Object
implements HierarchicalInstance

A basic implementation of the HierarchicalInstance interface. This implementation is meant to be used by the FlattenedEdifCell class -- for this reason, nodes are not created recursively; rather, each node is created individually by the breadth first search traversal in the flattening process. This is done so that the hierarchy need only be traversed once.

See Also:
Serialized Form

Field Summary
private  java.util.Collection<HierarchicalInstance> _children
          A Collection of child nodes
private  boolean _isLeafNode
           
private  java.util.List<HierarchicalNet> _netList
          A Collection of HierarchicalNets which correspond to nets in the original instance
private  java.lang.String _origCellTypeName
          The name of the cell type of the original EdifCellInstance
private  java.lang.String _origInstanceName
          The name of the original EdifCellInstance
private  InstanceNode _parent
          A reference to the node's parent InstanceNode
 
Constructor Summary
InstanceNode(EdifCellInstance instance)
          Construct a new top level InstanceNode based on the given EdifCellInstance.
InstanceNode(InstanceNode instanceNode)
          Copy Constructor
InstanceNode(InstanceNode parent, EdifCellInstance instance)
          Construct a new InstanceNode based on the given EdifCellInstance and with the given parent InstanceNode.
 
Method Summary
 InstanceNode addChild(EdifCellInstance childInstance)
          Construct a new InstanceNode based on the given EdifCellInstance and add it as a child of this node.
 HierarchicalNet addHierarchicalNet(EdifNet net)
          Given an EdifNet, construct a corresponding HierarchicalNet and add it to the list of nets.
 java.lang.String getCellTypeName()
           
 java.util.Collection<HierarchicalInstance> getChildren()
           
 java.util.Collection<HierarchicalNet> getHierarchicalNets()
           
 java.lang.String getInstanceName()
           
 HierarchicalInstance getParent()
           
 boolean isLeafNode()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_children

private java.util.Collection<HierarchicalInstance> _children
A Collection of child nodes


_netList

private java.util.List<HierarchicalNet> _netList
A Collection of HierarchicalNets which correspond to nets in the original instance


_parent

private InstanceNode _parent
A reference to the node's parent InstanceNode


_origInstanceName

private java.lang.String _origInstanceName
The name of the original EdifCellInstance


_origCellTypeName

private java.lang.String _origCellTypeName
The name of the cell type of the original EdifCellInstance


_isLeafNode

private boolean _isLeafNode
Constructor Detail

InstanceNode

public InstanceNode(EdifCellInstance instance)
Construct a new top level InstanceNode based on the given EdifCellInstance. Record the nets of the original instance as HierarchicalNet objects

Parameters:
instance - the EdifCellInstance which corresponds to the node to be created

InstanceNode

public InstanceNode(InstanceNode parent,
                    EdifCellInstance instance)
Construct a new InstanceNode based on the given EdifCellInstance and with the given parent InstanceNode. Record the nets of the original instance as HierarchicalNet objects.

Parameters:
parent - the parent InstanceNode
instance - the EdifCellInstance which corresponds to the node to be created

InstanceNode

public InstanceNode(InstanceNode instanceNode)
Copy Constructor

Parameters:
instanceNode - the InstanceNode to copy
Method Detail

addChild

public InstanceNode addChild(EdifCellInstance childInstance)
Construct a new InstanceNode based on the given EdifCellInstance and add it as a child of this node.

Parameters:
childInstance - the EdifCellInstance on which to base the child node to be created
Returns:
a reference to the newly created child node

getChildren

public java.util.Collection<HierarchicalInstance> getChildren()
Specified by:
getChildren in interface HierarchicalInstance
Returns:
a Collection of HierarchicalInstances representing the children of this node

getCellTypeName

public java.lang.String getCellTypeName()
Specified by:
getCellTypeName in interface HierarchicalInstance
Returns:
the name of the cell type of the original EdifCellInstance which corresponds to this node.

getHierarchicalNets

public java.util.Collection<HierarchicalNet> getHierarchicalNets()
Specified by:
getHierarchicalNets in interface HierarchicalInstance
Returns:
a Collection of HierarchicalNets which correspond to the nets in the original instance

getInstanceName

public java.lang.String getInstanceName()
Specified by:
getInstanceName in interface HierarchicalInstance
Returns:
the name of the original EdifCellInstance which corresponds to this node

getParent

public HierarchicalInstance getParent()
Specified by:
getParent in interface HierarchicalInstance
Returns:
a reference to this node's parent HierarchicalInstance

isLeafNode

public boolean isLeafNode()
Specified by:
isLeafNode in interface HierarchicalInstance
Returns:
a boolean representing whether or not this is a leaf node (i.e. the cell type of the corresponding EdifCellInstance is a leaf cell)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

addHierarchicalNet

public HierarchicalNet addHierarchicalNet(EdifNet net)
Given an EdifNet, construct a corresponding HierarchicalNet and add it to the list of nets.

Parameters:
net - the EdifNet on which to base the HierarchicalNet
Returns:
a boolean indicating whether the add was successful (the add will fail if this node already contains a HierarchicalNet based on the given EdifNet).