edu.byu.ece.edif.core
Class EdifCellInstance

java.lang.Object
  extended by edu.byu.ece.edif.core.NamedPropertyObject
      extended by edu.byu.ece.edif.core.EdifCellInstance
All Implemented Interfaces:
EdifOut, Properties, java.io.Serializable
Direct Known Subclasses:
FlattenedEdifCellInstance

public class EdifCellInstance
extends NamedPropertyObject
implements EdifOut

Represents a specific instance of an EdifCell object. This object contains a reference to the EdifCell that is instanced and a reference to the parent EdifCell object that instanced this cell.

Version:
$Id:EdifCellInstance.java 198 2008-04-16 21:14:21Z jamesfcarroll $
See Also:
Serialized Form

Field Summary
private  EdifCell _cellType
          This EdifCell reference refers to the type of EdifCell that is instanced.
private  EdifCell _parent
          This EdifCell reference refers to the the parent EdifCell object that instanced the cell.
 
Constructor Summary
EdifCellInstance(EdifNameable name)
          Construct an Empty, named EdifCellInstance Object.
EdifCellInstance(EdifNameable name, EdifCell parent)
          Construct a typeless, named EdifCellInstace Object with the specified parent.
EdifCellInstance(EdifNameable name, EdifCell parent, EdifCell type)
          Construct a typed, named EdifCellInstace Object with the specified parent.
EdifCellInstance(java.lang.String name)
          Construct an Empty, named EdifCellInstance Object.
EdifCellInstance(java.lang.String name, EdifCell parent)
          Construct a typeless, named EdifCellInstace Object with the specified parent.
EdifCellInstance(java.lang.String name, EdifCell parent, EdifCell type)
          Construct a typed, named EdifCellInstace Object with the specified parent.
 
Method Summary
 EdifCellInstance copy(EdifCell parent)
          Return a deep copy of this EdifCellInstance using the passed-in EdifCell as the parent.
 java.util.Collection<EdifPortRef> getAllEPRs()
          This method will determine the parent cell of an EdifCellInstance and search through the nets of this parent cell.
 EdifCell getCellType()
          Return the cell that this EdifCellInstance object is referring to.
 EdifNet getEdifCellInstanceNet(EdifSingleBitPort esbp)
          This method will determine the parent cell of this instance and search through the nets of this parent cell for that net that connects to the EdifSingleBitPort specified as the parameter.
 java.util.Collection<java.util.List<EdifCellInstance>> getHierarchicalPrimitiveList()
          Return a Collection with a List object for each primitive instance within the hierarchy of this cell instance.
 java.util.Map<EdifSingleBitPort,EdifNet> getInnerNets()
           
 java.util.Collection<EdifPortRef> getInputEPRs()
          This method will determine the parent cell of an EdifCellInstance and search through the nets of this parent cell.
 java.util.Map<EdifSingleBitPort,EdifPortRef> getOuterEPRs()
           
 java.util.Map<EdifSingleBitPort,EdifNet> getOuterNets()
          This method will determine the parent cell of an EdifCellInstance and search through the nets of this parent cell.
 java.util.Collection<EdifPortRef> getOutputEPRs()
          This method will determine the parent cell of an EdifCellInstance and search through the nets of this parent cell.
 EdifCell getParent()
          Return the parent cell that is referring to the cell that this EdifCellInstance object is referring to.
 EdifPortRef getPortRef(EdifSingleBitPort port)
           
 java.lang.String getType()
          Return the type of this cell as a String.
 boolean matchesWithin(java.util.Collection<EdifCellInstance> instanceList)
          Return true if the current instance matches within the passed-in collection of EdifCellInstance Objects.
 void modifyCellRef(EdifCell newCellRef)
          Modify the internal cell reference used by this EdifCellInstance.
 void modifyCellRef(EdifCell newCellRef, boolean check)
          Modify the internal cell reference used by this EdifCellInstance.
(package private)  void setParent(EdifCell p)
          Sets the parent cell that is referring to the cell this EdifCellInstance object is referring to.
 void toEdif(EdifPrintWriter epw)
          Writes the EDIF representation of this EdifCellInstance object to the EdifPrintWriter passed as a parameter.
 java.lang.String toString()
          Return a String representation of the EdifCellInstance object.
 
Methods inherited from class edu.byu.ece.edif.core.NamedPropertyObject
addProperty, addProperty, addPropertyList, copyProperties, equals, equalsProperties, getEdifNameable, getName, getOldName, getProperty, getPropertyList, rename, rename, rename
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_cellType

private EdifCell _cellType
This EdifCell reference refers to the type of EdifCell that is instanced.


_parent

private EdifCell _parent
This EdifCell reference refers to the the parent EdifCell object that instanced the cell.

Constructor Detail

EdifCellInstance

public EdifCellInstance(java.lang.String name)
                 throws InvalidEdifNameException
Construct an Empty, named EdifCellInstance Object.

Parameters:
name - The name of this EdifCellInstance Object
Throws:
InvalidEdifNameException

EdifCellInstance

public EdifCellInstance(EdifNameable name)
Construct an Empty, named EdifCellInstance Object.

Parameters:
name - The Object that holds name information for this EdifCellInstance Object

EdifCellInstance

public EdifCellInstance(java.lang.String name,
                        EdifCell parent)
                 throws InvalidEdifNameException
Construct a typeless, named EdifCellInstace Object with the specified parent.

Parameters:
name - The name of this EdifCellInstance Object
parent - The EdifCell Object that contains this EdifCellInstance
Throws:
InvalidEdifNameException

EdifCellInstance

public EdifCellInstance(EdifNameable name,
                        EdifCell parent)
Construct a typeless, named EdifCellInstace Object with the specified parent.

Parameters:
name - The Object that holds name information for this EdifCellInstance Object
parent - The EdifCell Object that contains this EdifCellInstace

EdifCellInstance

public EdifCellInstance(java.lang.String name,
                        EdifCell parent,
                        EdifCell type)
                 throws InvalidEdifNameException
Construct a typed, named EdifCellInstace Object with the specified parent.

Parameters:
name - The name of this EdifCellInstance Object
parent - The EdifCell Object that contains this EdifCellInstace
type - The type of this EdifCellInstance Object, or the EdifCell Object that this EdifCellInstance is instancing
Throws:
InvalidEdifNameException

EdifCellInstance

public EdifCellInstance(EdifNameable name,
                        EdifCell parent,
                        EdifCell type)
Construct a typed, named EdifCellInstace Object with the specified parent.

Parameters:
name - The Object that holds name information for this EdifCellInstance Object
parent - The EdifCell Object that contains this EdifCellInstace
type - The type of this EdifCellInstance Object, or the EdifCell Object that this EdifCellInstance is instancing
Method Detail

copy

public EdifCellInstance copy(EdifCell parent)
Return a deep copy of this EdifCellInstance using the passed-in EdifCell as the parent. All new Objects are created using the 'new' statement, except Strings.

Parameters:
parent - The EdifCell that will contain the new EdifCellInstance
Returns:
A new EdifCellInstance Object

getAllEPRs

public java.util.Collection<EdifPortRef> getAllEPRs()
This method will determine the parent cell of an EdifCellInstance and search through the nets of this parent cell. The EdifPortRefs of those nets that connect to the given EdifCellInstance are returned in a Collection.

Returns:
A Collection of EdifPortRefs

getCellType

public EdifCell getCellType()
Return the cell that this EdifCellInstance object is referring to.

Returns:
An EdifCell Object Referring to the type of this EdifCellInstance, or the EdifCell that this EdifCellInstance is instancing

getEdifCellInstanceNet

public EdifNet getEdifCellInstanceNet(EdifSingleBitPort esbp)
This method will determine the parent cell of this instance and search through the nets of this parent cell for that net that connects to the EdifSingleBitPort specified as the parameter. This method will return null if no net exists or if the EdifSingleBit port is not owned by the cell type of this instance.

Parameters:
esbp -
Returns:
The EdifNet object that is connected to the given EdifSingleBitPort. Returns null when there is no net connected to this port or when the port is not owned by the cellType of this instance.

getHierarchicalPrimitiveList

public java.util.Collection<java.util.List<EdifCellInstance>> getHierarchicalPrimitiveList()
Return a Collection with a List object for each primitive instance within the hierarchy of this cell instance.

Returns:
A Collection of hierarchical primitives

getInnerNets

public java.util.Map<EdifSingleBitPort,EdifNet> getInnerNets()

getInputEPRs

public java.util.Collection<EdifPortRef> getInputEPRs()
This method will determine the parent cell of an EdifCellInstance and search through the nets of this parent cell. The input EdifPortRefs of those nets that connect to the given EdifCellInstance are returned in a Collection.

Returns:
A Collection of input EdifPortRefs

getOuterEPRs

public java.util.Map<EdifSingleBitPort,EdifPortRef> getOuterEPRs()
Returns:
A Map where the key is a EdifSingleBitPort of the instance and the value is the EdifPortRef Object connected to single-bit port.

getOuterNets

public java.util.Map<EdifSingleBitPort,EdifNet> getOuterNets()
This method will determine the parent cell of an EdifCellInstance and search through the nets of this parent cell. Those nets that connect to the given EdifCellInstance are returned as a List. These nets are termed "outer nets" because they are the "outside" nets that connect to a given instance of a particular cell.

Returns:
A Map where the key is a EdifSingleBitPort of the instance and the value is the EdifNet Object connected to single-bit port.

getOutputEPRs

public java.util.Collection<EdifPortRef> getOutputEPRs()
This method will determine the parent cell of an EdifCellInstance and search through the nets of this parent cell. The output EdifPortRefs of those nets that connect to the given EdifCellInstance are returned in a Collection.

Returns:
A Collection of output EdifPortRefs

getParent

public EdifCell getParent()
Return the parent cell that is referring to the cell that this EdifCellInstance object is referring to.

Returns:
The EdifCell Object that contains this EdifCellInstance

getPortRef

public EdifPortRef getPortRef(EdifSingleBitPort port)
Parameters:
port - An EdifSingleBitPort on the EdifCellInstance to which the desired EdifPortRef makes reference.
Returns:
If any of the nets of the EdifCell type of the EdifCellInstance contain an EdifPortRef that refers to the given EdifSingleBitPort, the EdifPortRef is returned. Otherwise, null is returned.

getType

public java.lang.String getType()
Return the type of this cell as a String.

Returns:
A String representing what type of cell this is.

matchesWithin

public boolean matchesWithin(java.util.Collection<EdifCellInstance> instanceList)
Return true if the current instance matches within the passed-in collection of EdifCellInstance Objects. Equality done by doing a deep compare on the cell types of each instance, and the name of each instance.

Parameters:
instanceList - This EdifCellInstance Object will be compared against all the elements in this passed-in Collection to see if a match exists within the Collection

modifyCellRef

public void modifyCellRef(EdifCell newCellRef)
Modify the internal cell reference used by this EdifCellInstance.

Parameters:
newCellRef - An EdifCell Object--The cell this EdifCellInstance object will now refer to

modifyCellRef

public void modifyCellRef(EdifCell newCellRef,
                          boolean check)
Modify the internal cell reference used by this EdifCellInstance.

Parameters:
newCellRef - An EdifCell Object--The cell this EdifCellInstance object will now refer to
check - If true, will check to see if the interfaces are equal, and if it's ok to make the switch. For speed, and if it's known that the match will succeed, use false

toEdif

public void toEdif(EdifPrintWriter epw)
Writes the EDIF representation of this EdifCellInstance object to the EdifPrintWriter passed as a parameter.

Specified by:
toEdif in interface EdifOut
Parameters:
epw - EdifPrintWriter to which EDIF will be written

toString

public java.lang.String toString()
Return a String representation of the EdifCellInstance object. This simply corresponds to the name of the EdifCellInstance and its type.

Overrides:
toString in class java.lang.Object
Returns:
String description of the EdifCell object

setParent

void setParent(EdifCell p)
Sets the parent cell that is referring to the cell this EdifCellInstance object is referring to.

TODO: It would be nice to remove this method. Is there a way we can make the parent atomic and disallow changing at runtime? If not, we need to comment why here as part of the method.

Parameters:
p - An EdifCell Object--The parent referring to the cell of this EdifCellInstance.