com.sun.electric.database.hierarchy
Class Export

java.lang.Object
  extended by com.sun.electric.database.variable.ElectricObject
      extended by com.sun.electric.database.hierarchy.Export
All Implemented Interfaces:
PortProto, java.io.Serializable, java.lang.Comparable<Export>

public class Export
extends ElectricObject
implements PortProto, java.lang.Comparable<Export>

An Export is a PortProto at the Cell level. It points to the PortInst that got exported, which identifies a NodeInst and a PortProto on that NodeInst.

An Export takes a PortInst on a NodeInst and makes it available as a PortInst on instances of this NodeInst, farther up the hierarchy. An Export therefore belongs to the NodeInst that is its source and also to the Cell that the NodeInst belongs to. The data structures look like this:

See Also:
Serialized Form

Field Summary
static Variable.Key EXPORT_NAME
          Key of text descriptor of export name
static Variable.Key EXPORT_REFERENCE_NAME
          Key of Varible holding reference name.
static Export[] NULL_ARRAY
          Empty Export array for initialization.
 
Method Summary
 void addVar(Variable var)
          Method to add a Variable on this Export.
 boolean compare(java.lang.Object obj, java.lang.StringBuffer buffer)
          This function is to compare Export elements.
 int compareTo(Export that)
          Compares Exports by their Cells and names.
 boolean connectsTo(ArcProto arc)
          Method to return true if the specified ArcProto can connect to this Export.
 void copyStateBits(Export other)
          Method to copy state bits from other Export.
 void copyVarsFrom(ElectricObject other)
          Method to copy all variables from another Export to this Export.
 void delVar(Variable.Key key)
          Method to delete a Variable from this Export.
 boolean doesntConnect(PrimitivePort newPP)
          helper method to ensure that all arcs connected to Export "pp" at instances of its Cell (or any of its export sites) can connect to Export newPP.
 PrimitivePort getBasePort()
          Method to return the base-level port that this PortProto is created from.
 PortCharacteristic getCharacteristic()
          Method to return the PortCharacteristic of this Export.
 int getChronIndex()
          Method to return chronological index of this Export in parent.
 ImmutableExport getD()
          Returns persistent data of this Export.
 EDatabase getDatabase()
          Returns database to which this Export belongs.
 PortProto getEquivalent()
          Method to return the PortProto that is equivalent to this in the corresponding schematic Cell.
 Export getEquivalentPort(Cell otherCell)
          Method to find the Export on another Cell that is equivalent to this Export.
 ExportId getId()
          Method to return PortProtoId of this Export.
 java.lang.String getName()
          Method to return the name of this Export.
 Name getNameKey()
          Method to return the name key of this Export.
 Poly getNamePoly()
          Method to return a Poly that describes this Export name.
 PortInst getOriginalPort()
          Method to return the port on the NodeInst inside of the cell that is the origin of this Export.
 Cell getParent()
          Method to return the parent NodeProto of this Export.
 int getPortIndex()
          Method to get the index of this Export.
 java.lang.String getShortName()
          Method to return the short name of this PortProto.
static java.lang.String getShortName(java.lang.String name)
          Method to convert name of export to short name.
 TextDescriptor getTextDescriptor(Variable.Key varKey)
          Returns the TextDescriptor on this Export selected by variable key.
 boolean isAlwaysDrawn()
          Method to tell whether this PortProto is always drawn.
 boolean isBodyOnly()
          Method to tell whether this PortProto exists only in the body of a cell.
 boolean isDeprecatedVariable(Variable.Key key)
          Method to determine whether a variable key on Export is deprecated.
 boolean isGlobalPartition()
          Returns true if this export has its original port on Global-Partition schematics primitive.
 boolean isGround()
          Method to determine whether this Export is of type Ground.
 boolean isLinked()
          Returns true if this Export is linked into database.
 boolean isNamedGround()
          Method to determine whether this Export has a name that suggests Ground.
 boolean isNamedPower()
          Method to determine whether this Export has a name that suggests Power.
 boolean isPower()
          Method to determine whether this Export is of type Power.
 void kill()
          Method to unlink this Export from its Cell.
 void lowLevelModify(ImmutableExport d)
          Method to change the origin of this Export to another place in the Cell.
 boolean move(PortInst newPi)
          Method to move this Export to a different PortInst in the Cell.
static Export newInstance(Cell parent, ExportId exportId, java.lang.String name, TextDescriptor nameTextDescriptor, PortInst originalPort, boolean alwaysDrawn, boolean bodyOnly, PortCharacteristic characteristic, ErrorLogger errorLogger)
          Factory method to create an Export
static Export newInstance(Cell parent, PortInst portInst, java.lang.String protoName)
          Method to create an Export with the specified values.
static Export newInstance(Cell parent, PortInst portInst, java.lang.String protoName, PortCharacteristic characteristic)
          Method to create an Export with the specified values.
static Export newInstance(Cell parent, PortInst portInst, java.lang.String protoName, PortCharacteristic characteristic, boolean createOnIcon)
          Method to create an Export with the specified values.
 void rename(java.lang.String newName)
          Method to rename this Export.
 void setAlwaysDrawn(boolean b)
          Method to set this PortProto to be always drawn.
 void setBodyOnly(boolean b)
          Method to set this PortProto to exist only in the body of a cell.
 void setCharacteristic(PortCharacteristic characteristic)
          Method to set the PortCharacteristic of this Export.
 void setTextDescriptor(Variable.Key varKey, TextDescriptor td)
          Updates the TextDescriptor on this Export selected by varName.
 java.lang.String toString()
          Returns a printable version of this Export.
 Cell whichCell()
          Method to determine the appropriate Cell associated with this ElectricObject.
 
Methods inherited from class com.sun.electric.database.variable.ElectricObject
addDisplayableVariables, check, checkChanging, checkExamine, checkUndoing, computeTextPoly, copyTextDescriptorFrom, getArtwork, getCode, getDisplayableVariables, getEditingPreferences, getGeneric, getInfo, getMutableTextDescriptor, getNumVariables, getParameterOrVariable, getParameterOrVariable, getParametersAndVariables, getPolyList, getSchematics, getTech, getTechPool, getTextBounds, getVar, getVar, getVariables, getVarValue, getVarValue, isDatabaseObject, isParam, newDisplayVar, newVar, newVar, newVar, newVar, numDisplayableVariables, renameVar, renameVar, setOff, uniqueObjectName, uniqueObjectName, updateVar, updateVarCode, updateVarText
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NULL_ARRAY

public static final Export[] NULL_ARRAY
Empty Export array for initialization.


EXPORT_NAME

public static final Variable.Key EXPORT_NAME
Key of text descriptor of export name


EXPORT_REFERENCE_NAME

public static final Variable.Key EXPORT_REFERENCE_NAME
Key of Varible holding reference name.

Method Detail

newInstance

public static Export newInstance(Cell parent,
                                 PortInst portInst,
                                 java.lang.String protoName)
Method to create an Export with the specified values.

Parameters:
parent - the Cell in which this Export resides.
portInst - the PortInst to export
protoName - the name of this Export. It may not have unprintable characters, spaces, or tabs in it.
Returns:
the newly created Export.

newInstance

public static Export newInstance(Cell parent,
                                 PortInst portInst,
                                 java.lang.String protoName,
                                 PortCharacteristic characteristic)
Method to create an Export with the specified values.

Parameters:
parent - the Cell in which this Export resides.
portInst - the PortInst to export
protoName - the name of this Export. It may not have unprintable characters, spaces, or tabs in it.
characteristic - the characteristic (input, output) of this Export.
Returns:
the newly created Export.

newInstance

public static Export newInstance(Cell parent,
                                 PortInst portInst,
                                 java.lang.String protoName,
                                 PortCharacteristic characteristic,
                                 boolean createOnIcon)
Method to create an Export with the specified values.

Parameters:
parent - the Cell in which this Export resides.
portInst - the PortInst to export
protoName - the name of this Export. It may not have unprintable characters, spaces, or tabs in it.
characteristic - the characteristic (input, output) of this Export.
createOnIcon - true to create an equivalent export on any associated icon.
Returns:
the newly created Export.

newInstance

public static Export newInstance(Cell parent,
                                 ExportId exportId,
                                 java.lang.String name,
                                 TextDescriptor nameTextDescriptor,
                                 PortInst originalPort,
                                 boolean alwaysDrawn,
                                 boolean bodyOnly,
                                 PortCharacteristic characteristic,
                                 ErrorLogger errorLogger)
Factory method to create an Export

Parameters:
parent - the Cell in which this Export resides.
exportId - ExportId of this Export
name - the user name of this Export. if null then the same as id. It may not have unprintable characters, spaces, or tabs in it.
nameTextDescriptor - text descriptor of this Export
originalPort - the PortInst that is being exported.
alwaysDrawn - true if this Export is always drawn.
bodyOnly - true to exclude this Export from icon.
characteristic - PortCharacteristic of this Export.
errorLogger - error logger to report errors.
Returns:
created Export or null on error.

kill

public void kill()
Method to unlink this Export from its Cell.


rename

public void rename(java.lang.String newName)
Method to rename this Export.

Parameters:
newName - the new name of this Export.

move

public boolean move(PortInst newPi)
Method to move this Export to a different PortInst in the Cell. The method expects both ports to be in the same place and simply shifts the arcs without re-constraining them.

Parameters:
newPi - the new PortInst on which to base this Export.
Returns:
true on error.

lowLevelModify

public void lowLevelModify(ImmutableExport d)
Method to change the origin of this Export to another place in the Cell.

Parameters:
d - the new PortInst in the cell that will hold this Export.

copyStateBits

public void copyStateBits(Export other)
Method to copy state bits from other Export. State bits are alowaysDrawn, bodyOnly and characteristic.

Parameters:
other - Export from which to take state bits.

getNamePoly

public Poly getNamePoly()
Method to return a Poly that describes this Export name.

Returns:
a Poly that describes this Export's name.

whichCell

public Cell whichCell()
Method to determine the appropriate Cell associated with this ElectricObject.

Overrides:
whichCell in class ElectricObject
Returns:
the appropriate Cell associated with this ElectricObject. Returns null if no Cell can be found.

getD

public ImmutableExport getD()
Returns persistent data of this Export.

Specified by:
getD in class ElectricObject
Returns:
persistent data of this Export.

addVar

public void addVar(Variable var)
Method to add a Variable on this Export. It may add repaired copy of this Variable in some cases.

Specified by:
addVar in class ElectricObject
Parameters:
var - Variable to add.

delVar

public void delVar(Variable.Key key)
Method to delete a Variable from this Export.

Specified by:
delVar in class ElectricObject
Parameters:
key - the key of the Variable to delete.

copyVarsFrom

public void copyVarsFrom(ElectricObject other)
Method to copy all variables from another Export to this Export.

Overrides:
copyVarsFrom in class ElectricObject
Parameters:
other - the other Export from which to copy Variables.

getId

public ExportId getId()
Method to return PortProtoId of this Export. PortProtoId identifies Export independently of threads.

Specified by:
getId in interface PortProto
Returns:
PortProtoId of this Export.

getParent

public Cell getParent()
Method to return the parent NodeProto of this Export.

Specified by:
getParent in interface PortProto
Returns:
the parent NodeProto of this Export.

getChronIndex

public int getChronIndex()
Method to return chronological index of this Export in parent.

Returns:
chronological index of this Export in parent.

getPortIndex

public int getPortIndex()
Method to get the index of this Export. This is a zero-based index of ports on the Cell.

Specified by:
getPortIndex in interface PortProto
Returns:
the index of this Export.

getTextDescriptor

public TextDescriptor getTextDescriptor(Variable.Key varKey)
Returns the TextDescriptor on this Export selected by variable key. This key may be a key of variable on this Export or the special key Export.EXPORT_NAME. The TextDescriptor gives information for displaying the Variable.

Overrides:
getTextDescriptor in class ElectricObject
Parameters:
varKey - key of variable or special key.
Returns:
the TextDescriptor on this Export.

setTextDescriptor

public void setTextDescriptor(Variable.Key varKey,
                              TextDescriptor td)
Updates the TextDescriptor on this Export selected by varName. The varKey may be a key of variable on this ElectricObject or the special key Export.EXPORT_NAME. If varKey doesn't select any text descriptor, no action is performed. The TextDescriptor gives information for displaying the Variable.

Overrides:
setTextDescriptor in class ElectricObject
Parameters:
varKey - key of variable or special name.
td - new value TextDescriptor

isDeprecatedVariable

public boolean isDeprecatedVariable(Variable.Key key)
Method to determine whether a variable key on Export is deprecated. Deprecated variable keys are those that were used in old versions of Electric, but are no longer valid.

Overrides:
isDeprecatedVariable in class ElectricObject
Parameters:
key - the key of the variable.
Returns:
true if the variable key is deprecated.

getNameKey

public Name getNameKey()
Method to return the name key of this Export.

Specified by:
getNameKey in interface PortProto
Returns:
the Name key of this Export.

getName

public java.lang.String getName()
Method to return the name of this Export.

Specified by:
getName in interface PortProto
Returns:
the name of this Export.

getShortName

public java.lang.String getShortName()
Method to return the short name of this PortProto. The short name is everything up to the first nonalphabetic character.

Returns:
the short name of this PortProto.

getShortName

public static java.lang.String getShortName(java.lang.String name)
Method to convert name of export to short name. The short name is everything up to the first nonalphabetic character.

Parameters:
name - long name
Returns:
the short name of this PortProto.

compareTo

public int compareTo(Export that)
Compares Exports by their Cells and names.

Specified by:
compareTo in interface java.lang.Comparable<Export>
Parameters:
that - the other Export.
Returns:
a comparison between the Exports.

toString

public java.lang.String toString()
Returns a printable version of this Export.

Overrides:
toString in class ElectricObject
Returns:
a printable version of this Export.

getOriginalPort

public PortInst getOriginalPort()
Method to return the port on the NodeInst inside of the cell that is the origin of this Export.

Returns:
the port on the NodeInst inside of the cell that is the origin of this Export.

getBasePort

public PrimitivePort getBasePort()
Method to return the base-level port that this PortProto is created from. Since this is an Export, it returns the base port of its sub-port, the port on the NodeInst from which the Export was created.

Specified by:
getBasePort in interface PortProto
Returns:
the base-level port that this PortProto is created from.

connectsTo

public boolean connectsTo(ArcProto arc)
Method to return true if the specified ArcProto can connect to this Export.

Specified by:
connectsTo in interface PortProto
Parameters:
arc - the ArcProto to test for connectivity.
Returns:
true if this Export can connect to the ArcProto, false if it can't.

getCharacteristic

public PortCharacteristic getCharacteristic()
Method to return the PortCharacteristic of this Export.

Specified by:
getCharacteristic in interface PortProto
Returns:
the PortCharacteristic of this Exort.

setCharacteristic

public void setCharacteristic(PortCharacteristic characteristic)
Method to set the PortCharacteristic of this Export.

Parameters:
characteristic - the PortCharacteristic of this Exort.

isPower

public boolean isPower()
Method to determine whether this Export is of type Power. This is determined by either having the proper Characteristic, or by having the proper name (starting with "vdd", "vcc", "pwr", or "power").

Specified by:
isPower in interface PortProto
Returns:
true if this Export is of type Power.

isNamedPower

public boolean isNamedPower()
Method to determine whether this Export has a name that suggests Power. This is determined by having a name starting with "vdd", "vcc", "pwr", or "power".

Returns:
true if this Export has a name that suggests Power.

isGround

public boolean isGround()
Method to determine whether this Export is of type Ground. This is determined by either having the proper PortCharacteristic, or by having the proper name (starting with "vss", "gnd", or "ground").

Specified by:
isGround in interface PortProto
Returns:
true if this Export is of type Ground.

isNamedGround

public boolean isNamedGround()
Method to determine whether this Export has a name that suggests Ground. This is determined by either having a name starting with "vss", "gnd", or "ground".

Returns:
true if this Export has a name that suggests Ground.

isGlobalPartition

public boolean isGlobalPartition()
Returns true if this export has its original port on Global-Partition schematics primitive.

Returns:
true if this export is Global-Partition export.

setAlwaysDrawn

public void setAlwaysDrawn(boolean b)
Method to set this PortProto to be always drawn. Ports that are always drawn have their name displayed at all times, even when an arc is connected to them.


isAlwaysDrawn

public boolean isAlwaysDrawn()
Method to tell whether this PortProto is always drawn. Ports that are always drawn have their name displayed at all times, even when an arc is connected to them.

Returns:
true if this PortProto is always drawn.

setBodyOnly

public void setBodyOnly(boolean b)
Method to set this PortProto to exist only in the body of a cell. Ports that exist only in the body do not have an equivalent in the icon. This is used by simulators and icon generators to recognize less significant ports.

Parameters:
b - true if this Export exists only in the body of a cell.

isBodyOnly

public boolean isBodyOnly()
Method to tell whether this PortProto exists only in the body of a cell. Ports that exist only in the body do not have an equivalent in the icon. This is used by simulators and icon generators to recognize less significant ports.

Returns:
true if this PortProto exists only in the body of a cell.

isLinked

public boolean isLinked()
Returns true if this Export is linked into database.

Specified by:
isLinked in class ElectricObject
Returns:
true if this Export is linked into database.

getDatabase

public EDatabase getDatabase()
Returns database to which this Export belongs.

Specified by:
getDatabase in class ElectricObject
Returns:
database to which this Export belongs.

getEquivalent

public PortProto getEquivalent()
Method to return the PortProto that is equivalent to this in the corresponding schematic Cell. It finds the PortProto with the same name on the corresponding Cell. If there are multiple versions of the Schematic Cell return the latest.

Returns:
the PortProto that is equivalent to this in the corresponding Cell.

getEquivalentPort

public Export getEquivalentPort(Cell otherCell)
Method to find the Export on another Cell that is equivalent to this Export.

Parameters:
otherCell - the other cell to equate.
Returns:
the Export on that other Cell which matches this Export. Returns null if none can be found.

doesntConnect

public boolean doesntConnect(PrimitivePort newPP)
helper method to ensure that all arcs connected to Export "pp" at instances of its Cell (or any of its export sites) can connect to Export newPP.

Returns:
true if the connection cannot be made.

compare

public boolean compare(java.lang.Object obj,
                       java.lang.StringBuffer buffer)
This function is to compare Export elements. Initiative CrossLibCopy

Parameters:
obj - Object to compare to
buffer - To store comparison messages in case of failure
Returns:
True if objects represent same Export