com.sun.electric.database.hierarchy
Class EDatabase

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

public class EDatabase
extends java.lang.Object

Electric run-time database is a graph of ElectricObjects.


Constructor Summary
EDatabase(Environment environment)
           
EDatabase(Snapshot snapshot)
          Creates a new instance of EDatabase
 
Method Summary
 void addTech(Technology tech)
           
 Snapshot backup()
          Create Snapshot from the current state of Electric database.
 Snapshot backupUnsafe()
          Create Snapshot from the current state of Electric database.
 boolean canComputeBounds()
           
 boolean canComputeNetlist()
           
 void checkChanging()
          Method to check whether changing of database is allowed by current thread.
 void checkExamine()
          Method to check whether examining of database is allowed.
 void checkFresh(Snapshot expectedSnapshot)
          Checks that Electric database has the expected state.
 boolean checkInvariants()
          Method to check invariants in all Libraries.
 void checkUndoing()
          Method to check whether changing of whole database is allowed.
static EDatabase clientDatabase()
           
static EDatabase currentDatabase()
           
 Library findLibrary(java.lang.String libName)
          Method to find a Library with the specified name.
 java.util.Set<Cell> findReferenceInCell(Library elib)
          Get list of cells contained in other libraries that refer to cells contained in this library
 Artwork getArtwork()
          Return Artwork technology in this database
 Cell getCell(CellId cellId)
           
 Environment getEnvironment()
          Returns TechPool of this database
 Snapshot getFreshSnapshot()
          Low-level method to atomically get fresh snapshot.
 Generic getGeneric()
          Return Generic technology in this database
 IdManager getIdManager()
           
 Snapshot getInitialSnapshot()
           
 Library getLib(LibId libId)
           
 java.util.Iterator<Library> getLibraries()
          Method to return an iterator over all libraries.
 NetworkManager getNetworkManager()
           
 int getNumLibraries()
          Method to return the number of libraries.
 Schematics getSchematics()
          Return Schematic technology in this database
 java.util.Map<Setting,java.lang.Object> getSettings()
           
 Technology getTech(TechId techId)
          Get Technology by TechId TechId must belong to same IdManager as TechPool
 java.util.Collection<Technology> getTechnologies()
           
 TechPool getTechPool()
          Returns TechPool of this database
 java.util.List<Library> getVisibleLibraries()
          Method to return an iterator over all visible libraries.
 void implementSettingChanges(Setting.SettingChangeBatch changeBatch)
           
 void lock(boolean exclusive)
          Locks the database.
 void lowLevelBeginChanging(Tool changingTool)
          Low-level method to begin changes in database.
 void lowLevelEndChanging()
          Low-level method to permit changes in database.
 void lowLevelSetCanUndoing(boolean b)
          Low-level method to permit undos in database.
 void recover(Snapshot snapshot)
          Force database to specified state.
 void resize(Environment environment)
          Resize database after Technology change.
static EDatabase serverDatabase()
           
static void setClientDatabase(EDatabase database)
           
static void setServerDatabase(EDatabase database)
           
 void setToolSettings(Setting.RootGroup toolSettings)
           
 void undo(Snapshot snapshot)
          Force database to specified state.
 void unlock()
          Unlocks the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EDatabase

public EDatabase(Environment environment)

EDatabase

public EDatabase(Snapshot snapshot)
Creates a new instance of EDatabase

Method Detail

serverDatabase

public static EDatabase serverDatabase()

clientDatabase

public static EDatabase clientDatabase()

currentDatabase

public static EDatabase currentDatabase()

setServerDatabase

public static void setServerDatabase(EDatabase database)

setClientDatabase

public static void setClientDatabase(EDatabase database)

getIdManager

public IdManager getIdManager()

getInitialSnapshot

public Snapshot getInitialSnapshot()

getNetworkManager

public NetworkManager getNetworkManager()

setToolSettings

public void setToolSettings(Setting.RootGroup toolSettings)

addTech

public void addTech(Technology tech)

implementSettingChanges

public void implementSettingChanges(Setting.SettingChangeBatch changeBatch)

getEnvironment

public Environment getEnvironment()
Returns TechPool of this database


getTechPool

public TechPool getTechPool()
Returns TechPool of this database


getTechnologies

public java.util.Collection<Technology> getTechnologies()

getTech

public Technology getTech(TechId techId)
Get Technology by TechId TechId must belong to same IdManager as TechPool

Parameters:
techId - TechId to find
Returns:
Technology b giben TechId or null
Throws:
java.lang.IllegalArgumentException - of TechId is not from this IdManager

getArtwork

public Artwork getArtwork()
Return Artwork technology in this database


getGeneric

public Generic getGeneric()
Return Generic technology in this database


getSchematics

public Schematics getSchematics()
Return Schematic technology in this database


getSettings

public java.util.Map<Setting,java.lang.Object> getSettings()

getLib

public Library getLib(LibId libId)

getCell

public Cell getCell(CellId cellId)

lock

public void lock(boolean exclusive)
Locks the database. Lock may be either exclusive (for writing) or shared (for reading).

Parameters:
exclusive - true if lock is for writing.

unlock

public void unlock()
Unlocks the database.


checkChanging

public void checkChanging()
Method to check whether changing of database is allowed by current thread.

Throws:
java.lang.IllegalStateException - if changes are not allowed.

checkUndoing

public void checkUndoing()
Method to check whether changing of whole database is allowed.

Throws:
java.lang.IllegalStateException - if changes are not allowed.

canComputeBounds

public boolean canComputeBounds()

canComputeNetlist

public boolean canComputeNetlist()

checkExamine

public void checkExamine()
Method to check whether examining of database is allowed.


lowLevelBeginChanging

public void lowLevelBeginChanging(Tool changingTool)
Low-level method to begin changes in database.

Parameters:
changingTool - tool which initiated

lowLevelEndChanging

public void lowLevelEndChanging()
Low-level method to permit changes in database.


lowLevelSetCanUndoing

public void lowLevelSetCanUndoing(boolean b)
Low-level method to permit undos in database.


findReferenceInCell

public java.util.Set<Cell> findReferenceInCell(Library elib)
Get list of cells contained in other libraries that refer to cells contained in this library

Parameters:
elib - to search for
Returns:
list of cells refering to elements in this library

findLibrary

public Library findLibrary(java.lang.String libName)
Method to find a Library with the specified name.

Parameters:
libName - the name of the Library. Note that this is the Library name, and not the Library file.
Returns:
the Library, or null if there is no known Library by that name.

getLibraries

public java.util.Iterator<Library> getLibraries()
Method to return an iterator over all libraries.

Returns:
an iterator over all libraries.

getNumLibraries

public int getNumLibraries()
Method to return the number of libraries.

Returns:
the number of libraries.

getVisibleLibraries

public java.util.List<Library> getVisibleLibraries()
Method to return an iterator over all visible libraries.

Returns:
an iterator over all visible libraries.

getFreshSnapshot

public Snapshot getFreshSnapshot()
Low-level method to atomically get fresh snapshot.

Returns:
fresh snapshot of the database, or null if nop fresh snapshot exists.

backup

public Snapshot backup()
Create Snapshot from the current state of Electric database.

Returns:
snapshot of the current state of Electric database.
Throws:
java.lang.IllegalStateException - if recalculation of Snapshot is requred in thread which is not enabled to do it.

backupUnsafe

public Snapshot backupUnsafe()
Create Snapshot from the current state of Electric database. If there is no fresh snapshot for this database and thread is not enabled to calculate snspshot, returns the latest snapshot.

Returns:
snapshot of the current state of Electric database.

recover

public void recover(Snapshot snapshot)
Force database to specified state. This method can recover currupted database.

Parameters:
snapshot - snapshot to recover.

undo

public void undo(Snapshot snapshot)
Force database to specified state. This method assumes that database is in valid state.

Parameters:
snapshot - snapshot to undo.

resize

public void resize(Environment environment)
Resize database after Technology change. This method assumes that database is in valid state.

Parameters:
environment - new Environment

checkInvariants

public boolean checkInvariants()
Method to check invariants in all Libraries.

Returns:
true if invariants are valid

checkFresh

public void checkFresh(Snapshot expectedSnapshot)
Checks that Electric database has the expected state.

Parameters:
expectedSnapshot - expected state.