com.sun.electric.tool.ncc.trees
Class EquivRecord

java.lang.Object
  extended by com.sun.electric.tool.ncc.trees.EquivRecord
All Implemented Interfaces:
EquivRecReport.EquivRecReportable

public class EquivRecord
extends java.lang.Object
implements EquivRecReport.EquivRecReportable

Leaf EquivRecords hold Circuits. Internal EquivRecords hold offspring. Every EquivRecord is assigned a pseudo random code at birth which it retains for life.

A Leaf EquivRecord is "balanced" if all Circuits have the same number of NetObjects. "Matched" means balanced with each Circuit having one NetObject. "Mismatched" means unbalanced with some some Circuit having no NetObject. "Active" means not matched and not mismatched.


Method Summary
 void addCircuit(Circuit c)
           
 LeafList apply(Strategy js)
          The apply method applies a Strategy to this leaf EquivRecord.
 void checkMe(EquivRecord parent)
           
 java.util.Iterator<Circuit> getCircuits()
           
 int getCode()
          getCode returns the fixed hash code for this object.
 void getNetObjReportablesFromEntireTree(java.util.List<java.util.List<NetObjReport.NetObjReportable>> matched, java.util.List<java.util.List<NetObjReport.NetObjReportable>> notMatched)
           
 void getNetObjsFromEntireTree(java.util.List<java.util.List<NetObject>> matched, java.util.List<java.util.List<NetObject>> notMatched)
          Get all NetObjects contained by an EquivRecord subtree.
 NetObject.Type getNetObjType()
          say whether this leaf record contains Parts, Wires, or Ports.
 java.util.Iterator<EquivRecord> getOffspring()
          get offspring of internal record
 EquivRecord getParent()
           
 java.lang.String getPartitionReason()
           
 java.util.List<java.lang.String> getPartitionReasonsFromRootToMe()
           
 int getValue()
          get the value that a strategy used to distinguish this EquivRecord.
 boolean isActive()
          isActive indicates that this leaf record is neither matched nor mismatched.
 boolean isBalanced()
           
 boolean isLeaf()
           
 boolean isMatched()
          isMatched is a special case of balanced.
 boolean isMismatched()
          isMismatched is a special case of unbalanced.
 int maxSize()
          maxSize returns the number of NetObjects in the most populous Circuit.
 int maxSizeDiff()
          maxSizeDiff computes the difference in the number of NetObjects in the Circuits of this leaf record.
 java.lang.String nameString()
          nameString returns a String of type and name for this parent.
static EquivRecord newLeafRecord(int key, java.util.List<Circuit> ckts, NccGlobals globals)
          Construct a leaf EquivRecord that holds circuits
static EquivRecord newRootRecord(java.util.List<EquivRecord> offspring)
          Construct an internal EquivRecord that will serve as the root of the EquivRecord tree
 int numCircuits()
           
 int numNetObjs()
          Get total number of NetObjects in all Circuits of a leaf record
 int numOffspring()
           
 void setParent(EquivRecord x)
           
 void setPartitionReason(java.lang.String s)
          The fixed strategies annotate EquivRecords with comments describing what characteristic made this EquivRecord unique.
 void setWireSignature(NewLocalPartitionWires.Signature sig)
           
 java.lang.String sizeString()
          generates a String indicating the size of the Circuits in this leaf record
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getParent

public EquivRecord getParent()
Returns:
internal EquivRecord that contains me

getCode

public int getCode()
getCode returns the fixed hash code for this object.

Returns:
the int fixed hash code for this object.

checkMe

public void checkMe(EquivRecord parent)

setParent

public void setParent(EquivRecord x)

getValue

public int getValue()
get the value that a strategy used to distinguish this EquivRecord.

Returns:
the int value that distinguished this EquivRecord

getCircuits

public java.util.Iterator<Circuit> getCircuits()

numCircuits

public int numCircuits()

addCircuit

public void addCircuit(Circuit c)

getNetObjType

public NetObject.Type getNetObjType()
say whether this leaf record contains Parts, Wires, or Ports. A leaf record can only hold one kind of NetObject.

Returns:
PART, WIRE, or PORT

numNetObjs

public int numNetObjs()
Get total number of NetObjects in all Circuits of a leaf record

Returns:
number of NetObjects

sizeString

public java.lang.String sizeString()
generates a String indicating the size of the Circuits in this leaf record

Returns:
the String

maxSizeDiff

public int maxSizeDiff()
maxSizeDiff computes the difference in the number of NetObjects in the Circuits of this leaf record.

Returns:
an int with the difference, zero is good

maxSize

public int maxSize()
maxSize returns the number of NetObjects in the most populous Circuit.

Returns:
an int with the maximum size of any Circuit in this leaf record

isActive

public boolean isActive()
isActive indicates that this leaf record is neither matched nor mismatched.

Returns:
true if this leaf record is still in play, false otherwise

isBalanced

public boolean isBalanced()
Returns:
true if all Circuits have same number of NetObjects.

isMatched

public boolean isMatched()
isMatched is a special case of balanced.

Returns:
true if every Circuit has one NetObject

isMismatched

public boolean isMismatched()
isMismatched is a special case of unbalanced.

Returns:
true if some Circuit has no NetObject

getOffspring

public java.util.Iterator<EquivRecord> getOffspring()
get offspring of internal record


numOffspring

public int numOffspring()

apply

public LeafList apply(Strategy js)
The apply method applies a Strategy to this leaf EquivRecord. If the divides this Record then this leaf record becomes an internal record.

Parameters:
js - the Strategy to apply
Returns:
a LeafList of the resulting offspring

nameString

public java.lang.String nameString()
nameString returns a String of type and name for this parent.

Returns:
a String identifying this EquivRecord.

isLeaf

public boolean isLeaf()

setPartitionReason

public void setPartitionReason(java.lang.String s)
The fixed strategies annotate EquivRecords with comments describing what characteristic made this EquivRecord unique. This information is useful for providing pre-analysis information to the user.


getPartitionReason

public java.lang.String getPartitionReason()

getPartitionReasonsFromRootToMe

public java.util.List<java.lang.String> getPartitionReasonsFromRootToMe()
Specified by:
getPartitionReasonsFromRootToMe in interface EquivRecReport.EquivRecReportable

setWireSignature

public void setWireSignature(NewLocalPartitionWires.Signature sig)

newLeafRecord

public static EquivRecord newLeafRecord(int key,
                                        java.util.List<Circuit> ckts,
                                        NccGlobals globals)
Construct a leaf EquivRecord that holds circuits

Parameters:
ckts - Circuits belonging to Equivalence Record
globals - used for generating random numbers
Returns:
the new EquivRecord

newRootRecord

public static EquivRecord newRootRecord(java.util.List<EquivRecord> offspring)
Construct an internal EquivRecord that will serve as the root of the EquivRecord tree

Parameters:
offspring -
Returns:
the new EquivRecord or null if there are no offspring

getNetObjsFromEntireTree

public void getNetObjsFromEntireTree(java.util.List<java.util.List<NetObject>> matched,
                                     java.util.List<java.util.List<NetObject>> notMatched)
Get all NetObjects contained by an EquivRecord subtree.

Parameters:
matched - list of list of NetObjects from matched EquivRecords indexed as: [circuitIndex][netObjectIndex]. NetObjects at the same index in each list match.
notMatched - list of list of NetObjects from not matched EquivRecords indexed as [circuitIndex][netObjectIndex]

getNetObjReportablesFromEntireTree

public void getNetObjReportablesFromEntireTree(java.util.List<java.util.List<NetObjReport.NetObjReportable>> matched,
                                               java.util.List<java.util.List<NetObjReport.NetObjReportable>> notMatched)
Specified by:
getNetObjReportablesFromEntireTree in interface EquivRecReport.EquivRecReportable