byucc.edif
Class EdifLibraryManager

java.lang.Object
  extended bybyucc.edif.EdifLibraryManager
All Implemented Interfaces:
java.io.Serializable, Trimable

public class EdifLibraryManager
extends java.lang.Object
implements Trimable, java.io.Serializable

Represents a collection of related EdifLibraries. Libraries can be added to this object through merging. When a cell is added, all references to the old cell are replaced with references to the new cell, and all references to the old ports are replaced with references to the new ports. A Cell with the same name can exist in two different libraries, but not in the same library. To Do

Version:
$Id: EdifLibraryManager.java,v 1.76 2004/08/27 19:16:42 tsa6 Exp $
Author:
Mike Wirthlin, Tyler Anderson
See Also:
EdifLibrary, Serialized Form

Field Summary
private  EdifEnvironment _edifFile
          The EdifEnvironment that points to this library manager.
private  ArrayListNameSpaceResolver _libraries
          The EdifLibrary objects of this file.
 
Constructor Summary
EdifLibraryManager(EdifEnvironment edifFile)
          Constructs an EdifLibraryManager Object with the specified EdifEnvironment.
 
Method Summary
 boolean addCell(EdifCell cell)
          This method will add a Cell to one of the libraries and insure that it is added in the earliest location in the earliest library, and not to a primitive library.
 boolean addCell(EdifCell cell, boolean earliestLib, boolean earliestPos, boolean addToPrimitiveLibraryOK)
          This method will add a Cell to one of the libraries and insure that it is added to the earliest or latest location, based on earliestLib, and to the earliest or latest library, based on earliestPos.
private  EdifLibrary addCellToTargetMergeLibrary(EdifCell cell, java.util.Map cellMap, java.lang.String libraryBaseName, java.util.ArrayList newLibs, boolean addPrimitivesToPrimitiveLibraries)
          Adds the passed-in cell to the appropriate target library for the merge.
 boolean addLibrary(EdifLibrary library)
          Adds a library to this library manager, and sets its library manager to 'this'
 java.util.Map createCellMap(EdifLibrary lib, boolean checkStructure)
          Creates a cell map between cells of this manager to cells of the passed-in library, and bases the equality of cells on the value of checkStructure.
 java.util.Map createCellMap(EdifLibraryManager libm, boolean checkStructure)
          Creates a cell map between cells of this manager to cells of the passed-in manager, and bases the equality of cells on the value of checkStructure.
 boolean deleteCell(EdifCell cell)
          Deletes a cell from the library manager, and returns whether or not the delete was successful.
 boolean deleteCell(EdifCell cell, boolean force)
          Deletes a cell from the library manager, and returns whether or not the delete was successful.
 java.util.Collection findBlackBoxes()
          This method will search through all EdifCells in the current Manager and determine which cells are not defined.
 java.util.Collection findCellInstancesOf(EdifCell cell)
          This function will return a list of EdifCellInstances in the entire libraryManager that reference the passed in cell.
 EdifLibrary findEarliestLibraryToAdd(EdifCell cell)
          This method returns the earliest library that this cell can be added to.
 EdifLibrary findEarliestLibraryToAdd(EdifCell cell, boolean addToPrimitiveLibraryOK)
          This method returns the earliest library that this cell can be added to.
 int findEarliestPositionToAdd(EdifLibrary add)
          Returns the earliest position to add the library within the collection of libraries, so as to avoid violating the define before use rule.
 EdifLibrary findLatestLibraryToAdd(EdifCell cell)
          This method returns the latest library that this cell can be added to.
 EdifLibrary findLatestLibraryToAdd(EdifCell cell, boolean addToPrimitiveLibraryOK)
          This method returns the latest library that this cell can be added to.
 int findLatestPositionToAdd(EdifLibrary add)
          Returns the latest position to add the library within the collection of libraries, so as to avoid violating the define before use rule.
 EdifCell findMatchingEdifCell(EdifCell cell)
          Overloaded method that defaults to making comparisons not by name only, nor by interface only, nor by structure.
 EdifCell findMatchingEdifCell(EdifCell cell, boolean equalsNameOnly, boolean equalsStructure, boolean equalsInterfaceOnly)
          Overloaded method that defaults to not making EdifCellInterface compares for possible bus matches.
 EdifCell findMatchingEdifCell(EdifCell cell, boolean equalsNameOnly, boolean equalsStructure, boolean equalsInterfaceOnly, boolean comparePossibleBus)
          Returns the first cell in the library manager with it's name equal to the given name.
 java.util.Map findMatchingEdifCells(EdifLibraryManager elm)
          Overloaded method that defaults to not matching for structure.
 java.util.Map findMatchingEdifCells(EdifLibraryManager elm, boolean equalsStructure)
          Overloaded method defaulting to not comparing EdifCellInterface Objects for a possible bus match.
 java.util.Map findMatchingEdifCells(EdifLibraryManager elm, boolean equalsStructure, boolean comparePossibleBus)
          This method will attempt to match all EdifCell objects in the passed in library manager to matching EdifCell objects in this library manager.
 java.util.Map findMatchingLibraries(EdifLibraryManager elm, java.util.Map cellMap)
          This method will attempt to make a mapping between libraries in the passed in EdifLibraryManager and this EdifLibraryManager.
 EdifLibrary findMatchingLibrary(EdifLibrary inputLibrary, java.util.Map cellMap)
          This method will look at all EdifCell objects found within the same library as the passed-in library and find out which target library matches closest.
 java.util.Collection findNonReferencedCells()
          This function will return a list of EdifCells that aren't referenced at all within the entire LibraryManager.
 java.util.Collection findPortRefsOf(EdifCell cell)
          This function will return a list of EdifPortRefs in the entire libraryManager that reference the ports of the passed in cell.
 int findPositionToAdd(EdifLibrary add, boolean earliest)
          This method returns the position within the libraries that the passed-in library should be added.
 EdifCell getCell(java.lang.String name)
          Returns the first cell whose name matches the give String.
 java.util.List getCells()
          This method will return a List of all cells in the library manager.
 java.util.Collection getContainingLibraries(java.lang.String name)
          Returns a Collection of Libraries that contain a cell of the specified name.
 EdifEnvironment getFile()
          Returns the file pointing to this library manager.
 EdifLibrary getFirstPrimitiveLibrary()
          Returns the first primitive library in the collection of libraries.
 java.util.List getLibraries()
          Returns the libraries contained by this library manager.
 EdifLibrary getLibrary(java.lang.String lib)
          Returns the library based on the string lib.
 java.util.Collection getNextLibraries(EdifLibrary lib)
          Return the Collection of libraries that are defined after the specified library in the libarary manager.
 java.util.Collection getPreviousLibraries(EdifLibrary lib)
          Return the Collection of libraries that are defined before the specified library in the libarary manager.
 EdifCell getTopCell()
          Returns the top cell of this design.
 EdifCellInstance getTopCellInstance()
          Returns the top cell instance of this design.
 boolean isValid()
          Verify that the Manager is valid (The order of libraries as well as the order of cells within these libraries are OK).
 java.util.Iterator iterator()
          Returns the libraries contained by this library manager.
 boolean merge(EdifLibraryManager elm)
          Overloaded method that defaults to: not merging if the top cell in the passed-in library manager exists in this library manager, and to add primitives to primitive libraries.
 boolean merge(EdifLibraryManager elm, boolean mergeIfTopCellNotMatched, boolean addPrimitivesToPrimitiveLibraries)
          Merges the passed-in library manager into this library manager.
(package private)  void modifyBusToSinglePorts(EdifPort oldPort, java.util.Collection newPorts)
          Modifies any references from oldPort to the correct EdifPort in newPorts.
(package private)  void modifySinglePortsToBus(java.util.Collection oldPorts, EdifPort newPort)
          Modifies any references from oldPorts to newPort.
 boolean nameClash(EdifLibrary lib)
          Returns true if the library can be added to the library name space, otherwise false.
 void pruneNonReferencedCells()
          Prunes non referenced cells within the entire library manager.
 void renameTopCellToMatchName(java.lang.String filename)
          Renames the top cell to match the passed in filename, unless its name already is the name of the filename.
 void tagLeafCellsAsPrimitives()
          Tags all leaf cells as primitive.
 void tagPrimitives(EdifLibrary primitives)
          Tags all primitive cells by comparing them to the cells contained within the passed-in library.
 void trimToSize()
          Trims to size all Trimmable objects in this library manager.
 void uniqueify()
          Makes unique, every instance in this cell, meaning that a new EdifCell will be copied and added to the same library for each instanced cell that each EdifCell in each library contains.
private  void updateCellRefs(EdifCell oldCell, EdifCell newCell)
          Updates all the old information of oldCell to become the information contained in the new cell.
 void validateOrder()
          Re-orders the libraries, and the cells within into a proper order (if they aren't already).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_libraries

private ArrayListNameSpaceResolver _libraries
The EdifLibrary objects of this file. The key of this Map is the name of the library and the value is the EdifLibrary object.


_edifFile

private EdifEnvironment _edifFile
The EdifEnvironment that points to this library manager.

Constructor Detail

EdifLibraryManager

public EdifLibraryManager(EdifEnvironment edifFile)
Constructs an EdifLibraryManager Object with the specified EdifEnvironment.

Parameters:
edifFile - The EdifEnvironment that contains this EdifLibraryManager
Method Detail

addCell

public boolean addCell(EdifCell cell,
                       boolean earliestLib,
                       boolean earliestPos,
                       boolean addToPrimitiveLibraryOK)
This method will add a Cell to one of the libraries and insure that it is added to the earliest or latest location, based on earliestLib, and to the earliest or latest library, based on earliestPos.

Parameters:
cell - The cell to add to the library manager
earliestLib - Specifies whether to add to the earliest or latest library
earliestPos - Specifies whether to add to the earliest or latest position within the library
addToPrimitiveLibraryOK - Specifies whether or not it is ok to add the cell to a primitive library
Returns:
True if the cell was added, false otherwise
See Also:
EdifLibrary.addCell(EdifCell,boolean)

addCell

public boolean addCell(EdifCell cell)
This method will add a Cell to one of the libraries and insure that it is added in the earliest location in the earliest library, and not to a primitive library.

Parameters:
cell - The cell to add to the library manager
Returns:
True if the cell was added, false otherwise.
See Also:
addCell(EdifCell,boolean,boolean,boolean)

addCellToTargetMergeLibrary

private EdifLibrary addCellToTargetMergeLibrary(EdifCell cell,
                                                java.util.Map cellMap,
                                                java.lang.String libraryBaseName,
                                                java.util.ArrayList newLibs,
                                                boolean addPrimitivesToPrimitiveLibraries)
Adds the passed-in cell to the appropriate target library for the merge. The algorithm is as follows:

Parameters:
cell - The cell to be added into this library manager
cellMap - A mapping between cells that match to eachother
libraryBaseName - Optional String to pass in, so that if a new library needs to be constructed for non-primitive cells then the name of the library will default to this value
newLibs - The collection of newLibs created during the merge.
addPrimitivesToPrimitiveLibraries - Specifies that a primitive will be added to a primitive library in this manager, if one exists
Returns:
the Library the passed-in cell was added to
See Also:
merge(byucc.edif.EdifLibraryManager, boolean, boolean)

addLibrary

public boolean addLibrary(EdifLibrary library)
Adds a library to this library manager, and sets its library manager to 'this'

Parameters:
library - The library to add into this manager, defaulted to add at the earliest position
Returns:
True if the library was added
See Also:
findPositionToAdd(byucc.edif.EdifLibrary, boolean)

createCellMap

public java.util.Map createCellMap(EdifLibrary lib,
                                   boolean checkStructure)
Creates a cell map between cells of this manager to cells of the passed-in library, and bases the equality of cells on the value of checkStructure.

Parameters:
lib - The library to find a map for cells with in respect to this manager
checkStructure - Specifies whether to include structure when checking cell equality
Returns:
a map between cells that match from the passed in library to this manager
See Also:
createCellMap(EdifLibraryManager,boolean)

createCellMap

public java.util.Map createCellMap(EdifLibraryManager libm,
                                   boolean checkStructure)
Creates a cell map between cells of this manager to cells of the passed-in manager, and bases the equality of cells on the value of checkStructure.

Parameters:
libm - The manager to find a map for cells with in respect to this manager
checkStructure - Specifies whether to include structure when checking cell equality
Returns:
a map between cells that match from the passed in manager to this manager
See Also:
createCellMap(EdifLibrary,boolean)

deleteCell

public boolean deleteCell(EdifCell cell)
Deletes a cell from the library manager, and returns whether or not the delete was successful. By default, this method will only delete the cell if the cell is not referenced within the entire library manager.

Parameters:
cell - The cell to be deleted.
Returns:
True if the cell was deleted.
See Also:
deleteCell(EdifCell,boolean)

deleteCell

public boolean deleteCell(EdifCell cell,
                          boolean force)
Deletes a cell from the library manager, and returns whether or not the delete was successful.

Parameters:
cell - The cell to be deleted.
force - Forces the cell to be deleted even if it's still referenced within the library manager.
Returns:
True if the cell was deleted.
See Also:
EdifLibrary.deleteCell(EdifCell,boolean)

findMatchingEdifCell

public EdifCell findMatchingEdifCell(EdifCell cell,
                                     boolean equalsNameOnly,
                                     boolean equalsStructure,
                                     boolean equalsInterfaceOnly,
                                     boolean comparePossibleBus)
Returns the first cell in the library manager with it's name equal to the given name. Also, if equalsInterface is true then the method will only return a cell whose interface is also equal to the given cell's interface. Otherwise, the interface is ignored.

It is possible that there are more than one cells that match the given input cell (i.e. same cell duplicated in different libraries). This method will only return the first one found.

Parameters:
cell - The cell to check for same name, and, if equalsInterface is true, to check if the two cell's interfaces are equal.
equalsNameOnly - Will check matching cells for name only
equalsStructure - Will check matching cells for structure
equalsInterfaceOnly - If true then the returned EdifCell will match the interface of the given EdifCell, otherwise, interfaces are ignored.
Returns:
A cell in this manager that matches the passed in cell
See Also:
EdifLibrary.findMatchingEdifCell(EdifCell), findMatchingEdifCell(EdifCell), findMatchingEdifCell(EdifCell,boolean,boolean, boolean)

findMatchingEdifCell

public EdifCell findMatchingEdifCell(EdifCell cell,
                                     boolean equalsNameOnly,
                                     boolean equalsStructure,
                                     boolean equalsInterfaceOnly)
Overloaded method that defaults to not making EdifCellInterface compares for possible bus matches.

Parameters:
cell - The cell to check for same name, and, if equalsInterface is true, to check if the two cell's interfaces are equal.
equalsNameOnly - Will check matching cells for name only
equalsStructure - Will check matching cells for structure
equalsInterfaceOnly - If true then the returned EdifCell will match the interface of the given EdifCell, otherwise, interfaces are ignored.
Returns:
A cell in this manager that matches the passed in cell
See Also:
findMatchingEdifCell(EdifCell,boolean, boolean,boolean,boolean)

findMatchingEdifCell

public EdifCell findMatchingEdifCell(EdifCell cell)
Overloaded method that defaults to making comparisons not by name only, nor by interface only, nor by structure.

Parameters:
cell - The cell to be matched with a cell in this manager
Returns:
A cell in this manager that matches the passed in cell
See Also:
findMatchingEdifCell(EdifCell,boolean, boolean,boolean)

findMatchingEdifCells

public java.util.Map findMatchingEdifCells(EdifLibraryManager elm,
                                           boolean equalsStructure,
                                           boolean comparePossibleBus)
This method will attempt to match all EdifCell objects in the passed in library manager to matching EdifCell objects in this library manager. The key of this map is the EdifCell in the passed-in library manager and the value is the matching EdifCell of this library manager. This method will compare all pairs of libraries.

Parameters:
elm - The manager to find a map with in respect to this manager.
equalsStructure - Specifies whether cell comparisons should be made based on structure
Returns:
A map between cells that map to one another from the passed in library manager to this one
See Also:
EdifLibrary.findMatchingEdifCells(byucc.edif.EdifLibrary, boolean, boolean), findMatchingEdifCells(EdifLibraryManager)

findMatchingEdifCells

public java.util.Map findMatchingEdifCells(EdifLibraryManager elm,
                                           boolean equalsStructure)
Overloaded method defaulting to not comparing EdifCellInterface Objects for a possible bus match.

Parameters:
elm - The manager to find a map with in respect to this manager.
equalsStructure - Specifies whether cell comparisons should be made based on structure
Returns:
A map between cells that map to one another from the passed in library manager to this one
See Also:
findMatchingEdifCells(EdifLibraryManager, boolean,boolean)

findMatchingEdifCells

public java.util.Map findMatchingEdifCells(EdifLibraryManager elm)
Overloaded method that defaults to not matching for structure.

Parameters:
elm - The library manager to find a mapping with to the cells in this manager
Returns:
a Map Object whose key is the cell from elm whose value is the cells in this manager
See Also:
findMatchingEdifCells(EdifLibraryManager, boolean)

findMatchingLibraries

public java.util.Map findMatchingLibraries(EdifLibraryManager elm,
                                           java.util.Map cellMap)
This method will attempt to make a mapping between libraries in the passed in EdifLibraryManager and this EdifLibraryManager. The cellMap parameter is the result of the findMatchingEdifCells(byucc.edif.EdifLibraryManager, boolean, boolean) call. The key of this Map is a library from the passed in library manager and the value is a library from this library manager.

Parameters:
elm - The manager to find a mapping between libraries in this manager that match
cellMap - Mapping between cells that map to one another.
Returns:
Map between libraries that map to one another.
See Also:
findMatchingLibrary(EdifLibrary,Map)

findMatchingLibrary

public EdifLibrary findMatchingLibrary(EdifLibrary inputLibrary,
                                       java.util.Map cellMap)
This method will look at all EdifCell objects found within the same library as the passed-in library and find out which target library matches closest.

Parameters:
inputLibrary - Library to find a match for
cellMap - Mapping between cells that match to one another.
Returns:
The matching library
See Also:
findMatchingLibraries(EdifLibraryManager,Map)

findCellInstancesOf

public java.util.Collection findCellInstancesOf(EdifCell cell)
This function will return a list of EdifCellInstances in the entire libraryManager that reference the passed in cell. This method will return null if no EdifCellInstances are found.

Parameters:
cell - The cell to check references for
Returns:
A collection of EdifCellInstance Objects in this library manager that refer to the passed-in cell
See Also:
EdifLibrary.findCellInstancesOf(byucc.edif.EdifCell)

findNonReferencedCells

public java.util.Collection findNonReferencedCells()
This function will return a list of EdifCells that aren't referenced at all within the entire LibraryManager.

Returns:
A collection of cells that aren't referenced at all in the entire library manager (these could be pruned to reduce the size of the file)
See Also:
pruneNonReferencedCells()

findPositionToAdd

public int findPositionToAdd(EdifLibrary add,
                             boolean earliest)
This method returns the position within the libraries that the passed-in library should be added. If earliest is true then the library will be added in the earliest position, latest position, otherwise.

Parameters:
add - The library to be inserted
earliest - Whether to insert the library into the earliest possible position, or the latest
Returns:
The correct position to add the passed-in library
See Also:
findEarliestPositionToAdd(byucc.edif.EdifLibrary), findLatestPositionToAdd(byucc.edif.EdifLibrary)

findEarliestPositionToAdd

public int findEarliestPositionToAdd(EdifLibrary add)
Returns the earliest position to add the library within the collection of libraries, so as to avoid violating the define before use rule.

Parameters:
add - The library to add to the earliest position
Returns:
The exact position to add this library to
See Also:
findPositionToAdd(byucc.edif.EdifLibrary, boolean)

findLatestPositionToAdd

public int findLatestPositionToAdd(EdifLibrary add)
Returns the latest position to add the library within the collection of libraries, so as to avoid violating the define before use rule.

Parameters:
add - The library to add to the latest position
Returns:
The exact position to add this library to
See Also:
findPositionToAdd(byucc.edif.EdifLibrary, boolean)

findEarliestLibraryToAdd

public EdifLibrary findEarliestLibraryToAdd(EdifCell cell,
                                            boolean addToPrimitiveLibraryOK)
This method returns the earliest library that this cell can be added to. All of the passed in EdifCell's EdifCellInstances must instance cells declared inside or after the library it will get added to.

Parameters:
cell - The cell to be added into which library.
addToPrimitiveLibraryOK - Specifies whether or not it is ok to add the cell to a primitive library.
Returns:
The earliest library to add the cell in.
See Also:
EdifLibrary.findEarliestPositionToAdd(byucc.edif.EdifCell)

findEarliestLibraryToAdd

public EdifLibrary findEarliestLibraryToAdd(EdifCell cell)
This method returns the earliest library that this cell can be added to. This defaults to not adding to primitive libraries.

Parameters:
cell - The cell to be added into which library.
Returns:
The earliest library to add the cell in.
See Also:
findEarliestLibraryToAdd(byucc.edif.EdifCell, boolean)

findLatestLibraryToAdd

public EdifLibrary findLatestLibraryToAdd(EdifCell cell,
                                          boolean addToPrimitiveLibraryOK)
This method returns the latest library that this cell can be added to. If the passed in EdifCell is referenced in a library then it has to be added to the position at or before the referring library.

Parameters:
cell - The cell to be added into which library.
addToPrimitiveLibraryOK - Specifies whether or not it is ok to add the cell to a primitive library.
Returns:
The latest library to add the cell in.
See Also:
EdifLibrary.findLatestPositionToAdd(byucc.edif.EdifCell)

findLatestLibraryToAdd

public EdifLibrary findLatestLibraryToAdd(EdifCell cell)
This method returns the latest library that this cell can be added to. This defaults to not adding to primitive libraries.

Parameters:
cell - The cell to be added into which library.
Returns:
The latest library to add the cell in.
See Also:
findLatestLibraryToAdd(byucc.edif.EdifCell, boolean)

findBlackBoxes

public java.util.Collection findBlackBoxes()
This method will search through all EdifCells in the current Manager and determine which cells are not defined. The purpose of this method is to identify those EdifCell objects that are "undefined". This may be used to search for other Edif files that describe the given black box.

Returns:
A collection of EdifCells that are Black boxes, or undefined, and non-primitive
See Also:
EdifLibrary.findBlackBoxes()

findPortRefsOf

public java.util.Collection findPortRefsOf(EdifCell cell)
This function will return a list of EdifPortRefs in the entire libraryManager that reference the ports of the passed in cell. This method will return null if no EdifPortRefs are found.

Parameters:
cell - The cell who has the ports to check the port references for
Returns:
A collection of EdifPortRef Objects that refer to ports in the passed-in EdifCell
See Also:
EdifLibrary.findPortRefsOf(byucc.edif.EdifCell)

getFirstPrimitiveLibrary

public EdifLibrary getFirstPrimitiveLibrary()
Returns the first primitive library in the collection of libraries. Useful when a primitive must be added to a primitive library.

Returns:
The first Primitive Library

getLibrary

public EdifLibrary getLibrary(java.lang.String lib)
Returns the library based on the string lib.

Parameters:
lib - The String that will be used to find the library
Returns:
The EdifLibrary whose name matches lib

getFile

public EdifEnvironment getFile()
Returns the file pointing to this library manager.

Returns:
The EdifEnvironment that contains this library manager.

getLibraries

public java.util.List getLibraries()
Returns the libraries contained by this library manager.

Returns:
An Iterator Object of the libraries within this library manager.

getTopCell

public EdifCell getTopCell()
Returns the top cell of this design.

Returns:
The top EdifCell of this design.

getTopCellInstance

public EdifCellInstance getTopCellInstance()
Returns the top cell instance of this design.

Returns:
The top EdifCellInstance of this design.

getCells

public java.util.List getCells()
This method will return a List of all cells in the library manager. The cells will be returned in proper order (from lowest to highest).

Returns:
A List Object of all the cells in the entire library manager.

getCell

public EdifCell getCell(java.lang.String name)
Returns the first cell whose name matches the give String.

Parameters:
name - The name of the cell to return
Returns:
An EdifCell whose name matches the given String
See Also:
EdifLibrary.getCell(String)

getContainingLibraries

public java.util.Collection getContainingLibraries(java.lang.String name)
Returns a Collection of Libraries that contain a cell of the specified name. This will return null if no libraries contain a cell by that name.

Parameters:
name - String name of cell to search for.
Returns:
A Collection of EdifLibrary Objects containing the cell with the specified name, or null if none exist.

getNextLibraries

public java.util.Collection getNextLibraries(EdifLibrary lib)
Return the Collection of libraries that are defined after the specified library in the libarary manager.

Parameters:
lib - The library that designates the point after which libraries will begin to be returned
Returns:
A Collection of EdifLibrary objects defined after the passed-in EdifLibrary Object

getPreviousLibraries

public java.util.Collection getPreviousLibraries(EdifLibrary lib)
Return the Collection of libraries that are defined before the specified library in the libarary manager.

Parameters:
lib - The library that designates the point where the list of libraries stops
Returns:
A Collection of EdifLibrary objects defined before the passed-in EdifLibrary Object

isValid

public boolean isValid()
Verify that the Manager is valid (The order of libraries as well as the order of cells within these libraries are OK).

Returns:
True if the define-before-use rule holds for the entire library manager

iterator

public java.util.Iterator iterator()
Returns the libraries contained by this library manager.

Returns:
An Iterator Object of the libraries within this library manager.

merge

public boolean merge(EdifLibraryManager elm,
                     boolean mergeIfTopCellNotMatched,
                     boolean addPrimitivesToPrimitiveLibraries)
Merges the passed-in library manager into this library manager. The algorithm for merging is as follows:

Parameters:
elm - The manager to merge into this manager
mergeIfTopCellNotMatched - If the top cell in elm is not found in this manager, then no merging will occur
addPrimitivesToPrimitiveLibraries - This flag specifies to place primitive cells into primitive libraries
Returns:
True if elm was merged into this manager
See Also:
merge(EdifLibraryManager), addCellToTargetMergeLibrary(byucc.edif.EdifCell, java.util.Map, java.lang.String, java.util.ArrayList, boolean)

merge

public boolean merge(EdifLibraryManager elm)
Overloaded method that defaults to: not merging if the top cell in the passed-in library manager exists in this library manager, and to add primitives to primitive libraries.

Parameters:
elm - The manager to merge into this manager
Returns:
True if elm was merged into this library manager
See Also:
merge(EdifLibraryManager,boolean,boolean)

modifySinglePortsToBus

void modifySinglePortsToBus(java.util.Collection oldPorts,
                            EdifPort newPort)
Modifies any references from oldPorts to newPort.

Parameters:
oldPorts - A Collection of EdifPort Objects to update
newPort - The EdifPort Object to have the old ones point to
See Also:
EdifCell.modifySinglePortsToBus(java.util.Collection, byucc.edif.EdifPort)

modifyBusToSinglePorts

void modifyBusToSinglePorts(EdifPort oldPort,
                            java.util.Collection newPorts)
Modifies any references from oldPort to the correct EdifPort in newPorts.

Parameters:
oldPort - The old EdifPort to update
newPorts - The Collection of EdifPort Objects to have the old ones point to
See Also:
EdifCell.modifyBusToSinglePorts(byucc.edif.EdifPort, java.util.Collection)

nameClash

public boolean nameClash(EdifLibrary lib)
Returns true if the library can be added to the library name space, otherwise false.

Parameters:
lib - The library to chech to see if there is a name clash with this libraries of this library manager
Returns:
True if there is a clash, false if not

pruneNonReferencedCells

public void pruneNonReferencedCells()
Prunes non referenced cells within the entire library manager. Pruned cells are cells that aren't referenced within the entire library manager.


renameTopCellToMatchName

public void renameTopCellToMatchName(java.lang.String filename)
Renames the top cell to match the passed in filename, unless its name already is the name of the filename.

Parameters:
filename - The name of the file the top edif design was translated from, and the new name of the top cell of this file.

tagLeafCellsAsPrimitives

public void tagLeafCellsAsPrimitives()
Tags all leaf cells as primitive.


tagPrimitives

public void tagPrimitives(EdifLibrary primitives)
Tags all primitive cells by comparing them to the cells contained within the passed-in library.

Parameters:
primitives - Library containing primitives to be compared to cells.
See Also:
EdifCell.tagAsPrimitive(byucc.edif.EdifLibrary)

trimToSize

public void trimToSize()
Trims to size all Trimmable objects in this library manager.

Specified by:
trimToSize in interface Trimable

uniqueify

public void uniqueify()
Makes unique, every instance in this cell, meaning that a new EdifCell will be copied and added to the same library for each instanced cell that each EdifCell in each library contains.


updateCellRefs

private void updateCellRefs(EdifCell oldCell,
                            EdifCell newCell)
Updates all the old information of oldCell to become the information contained in the new cell. Note: This does not all the newCell to the library manager.

Parameters:
oldCell - Cell whose information must be replaced
newCell - Cell whose information will replace the old cell's information

validateOrder

public void validateOrder()
Re-orders the libraries, and the cells within into a proper order (if they aren't already).