com.sun.electric.database
Class CellRevision

java.lang.Object
  extended by com.sun.electric.database.CellRevision

public class CellRevision
extends java.lang.Object

This class represents Cell data (with all arcs/nodes/exports) as it is saved to disk. This representation should be technology-independent


Field Summary
 ImmutableArrayList<ImmutableArcInst> arcs
          A list of ArcInsts in this Cell.
 ImmutableCell d
          Cell persistent data.
static ImmutableArrayList<CellRevision> EMPTY_LIST
           
 ImmutableArrayList<ImmutableExport> exports
          An array of Exports on the Cell by chronological index.
 ImmutableArrayList<ImmutableNodeInst> nodes
          A list of NodeInsts in this Cell.
static CellRevision[] NULL_ARRAY
           
 
Constructor Summary
CellRevision(ImmutableCell d)
          Creates a new instance of CellRevision
 
Method Summary
 void check()
          Checks invariant of this CellRevision.
 ImmutableArcInst getArc(int arcId)
          Returns ImmutableArcInst by its arc id.
 ImmutableExport getExport(ExportId exportId)
          Returns ImmutableExport by its export id.
 int getInstCount(CellUsage u)
          For given CellUsage in this cell returns count of subcell instances.
 int[] getInstCounts()
          Returns subcell instance counts, indexed by CellUsage.indexInParent.
 ImmutableNodeInst getNode(int nodeId)
          Returns ImmutableNodeInst by its node id.
 java.util.Set<TechId> getTechUsages()
          Returns Set of Technologies used in this CellRevision
 boolean sameExports(CellRevision thatRevision)
           
 java.lang.String toString()
           
 CellRevision with(ImmutableCell d, ImmutableNodeInst[] nodesArray, ImmutableArcInst[] arcsArray, ImmutableExport[] exportsArray)
          Creates a new instance of CellRevision which differs from this CellRevision.
 CellRevision withRevisionDate(long revisionDate)
          Creates a new instance of CellRevision which differs from this CellRevision by revision date.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NULL_ARRAY

public static final CellRevision[] NULL_ARRAY

EMPTY_LIST

public static final ImmutableArrayList<CellRevision> EMPTY_LIST

d

public final ImmutableCell d
Cell persistent data.


exports

public final ImmutableArrayList<ImmutableExport> exports
An array of Exports on the Cell by chronological index.


nodes

public final ImmutableArrayList<ImmutableNodeInst> nodes
A list of NodeInsts in this Cell.


arcs

public final ImmutableArrayList<ImmutableArcInst> arcs
A list of ArcInsts in this Cell.

Constructor Detail

CellRevision

public CellRevision(ImmutableCell d)
Creates a new instance of CellRevision

Method Detail

withRevisionDate

public CellRevision withRevisionDate(long revisionDate)
Creates a new instance of CellRevision which differs from this CellRevision by revision date.

Parameters:
revisionDate - new revision date.
Returns:
new CellRevision which differs from this CellRevision by revision date.

with

public CellRevision with(ImmutableCell d,
                         ImmutableNodeInst[] nodesArray,
                         ImmutableArcInst[] arcsArray,
                         ImmutableExport[] exportsArray)
Creates a new instance of CellRevision which differs from this CellRevision. Four array parameters are supplied. Each parameter may be null if its contents is the same as in this Snapshot.

Parameters:
d - new persistent data of a cell.
nodesArray - new array of nodes
arcsArray - new array of arcs
exportsArray - new array of exports
Returns:
new snapshot which differs froms this Snapshot or this Snapshot.
Throws:
java.lang.IllegalArgumentException - on invariant violation.
ArrayOutOfBoundsException - on some invariant violations.

getNode

public ImmutableNodeInst getNode(int nodeId)
Returns ImmutableNodeInst by its node id.

Parameters:
nodeId - id of node.
Returns:
ImmutableNodeInst with this id or null if node doesn't exist.

getArc

public ImmutableArcInst getArc(int arcId)
Returns ImmutableArcInst by its arc id.

Parameters:
arcId - id of node.
Returns:
ImmutableArcInst with this id or null if node doesn't exist.

getExport

public ImmutableExport getExport(ExportId exportId)
Returns ImmutableExport by its export id.

Parameters:
exportId - id of export.
Returns:
ImmutableExport with this id or null if node doesn't exist.

getInstCounts

public int[] getInstCounts()
Returns subcell instance counts, indexed by CellUsage.indexInParent.

Returns:
subcell instance counts, indexed by CellUsage.indexInParent.

getInstCount

public int getInstCount(CellUsage u)
For given CellUsage in this cell returns count of subcell instances.

Parameters:
u - CellUsage.
Returns:
count of subcell instances.
Throws:
java.lang.IllegalArgumentException - if CellUsage's parent is not this cell.

getTechUsages

public java.util.Set<TechId> getTechUsages()
Returns Set of Technologies used in this CellRevision


check

public void check()
Checks invariant of this CellRevision.

Throws:
java.lang.AssertionError - if invariant is broken.

sameExports

public boolean sameExports(CellRevision thatRevision)

toString

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