com.sun.electric.database.topology
Class PortInst

java.lang.Object
  extended by com.sun.electric.database.variable.ElectricObject
      extended by com.sun.electric.database.topology.PortInst
All Implemented Interfaces:
java.io.Serializable

public class PortInst
extends ElectricObject

The PortInst class represents an instance of a Port. It is the combination of a NodeInst and a PortProto.

This class is thread-safe.

See Also:
Serialized Form

Method Summary
 int addDisplayableVariables(java.awt.geom.Rectangle2D rect, Poly[] polys, int start, EditWindow0 wnd, boolean multipleStrings)
          Method to add all displayable Variables on this PortInsts to an array of Poly objects.
 void addVar(Variable var)
          Method to add a Variable on this PortInst.
 boolean compare(java.lang.Object obj, java.lang.StringBuffer buffer)
          This function is to compare PortInst elements.
 Poly computeTextPoly(EditWindow0 wnd, Variable var, Name name)
           
 void delVar(Variable.Key key)
          Method to delete a Variable from this PortInst.
 void delVars()
          Method to delete all Variables of this PortInst.
 java.lang.String describe(boolean withQuotes)
          Method to describe this NodeInst as a string.
 java.awt.geom.Rectangle2D getBounds()
          Method to return the bounds of this PortInst.
 EPoint getCenter()
           
 java.util.Iterator<Connection> getConnections()
          Get iterator of all Connections that connect to this PortInst
 ImmutablePortInst getD()
          Returns persistent data of this ElectricObject with Variables.
 EDatabase getDatabase()
          Returns database to which this PortInst belongs.
 java.util.Iterator<Export> getExports()
          Get iterator of all Exports that connect to this PortInst
 NodeInst getNodeInst()
          Method to return the NodeInst that this PortInst resides on.
 Poly getPoly()
          Method to return the Poly that describes this PortInst.
 int getPortIndex()
          Method to get the index of this PortInst in NodeInst ports.
 PortProto getPortProto()
          Method to return the PortProto that this PortInst is an instance of.
 PortProto getProtoEquivalent()
          Method to return the equivalent PortProto of this PortInst's PortProto.
 boolean hasConnections()
          Returns true of there are Connections on this PortInst.
 boolean isLinked()
          Overrides ElectricObject.isLinked().
static PortInst newInstance(PortProto portProto, NodeInst nodeInst)
          Method to create a PortInst object.
 java.lang.String toString()
          Returns a printable version of this PortInst.
 
Methods inherited from class com.sun.electric.database.variable.ElectricObject
check, checkChanging, checkExamine, checkUndoing, computeTextPoly, copyTextDescriptorFrom, copyVarsFrom, getArtwork, getCode, getDisplayableVariables, getEditingPreferences, getGeneric, getInfo, getMutableTextDescriptor, getNumVariables, getParameterOrVariable, getParameterOrVariable, getParametersAndVariables, getPolyList, getSchematics, getTech, getTechPool, getTextBounds, getTextDescriptor, getVar, getVar, getVariables, getVarValue, getVarValue, isDatabaseObject, isDeprecatedVariable, isParam, newDisplayVar, newVar, newVar, newVar, newVar, numDisplayableVariables, renameVar, renameVar, setOff, setTextDescriptor, uniqueObjectName, uniqueObjectName, updateVar, updateVarCode, updateVarText, whichCell
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getD

public ImmutablePortInst getD()
Returns persistent data of this ElectricObject with Variables.

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

addVar

public void addVar(Variable var)
Method to add a Variable on this PortInst. 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 PortInst.

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

delVars

public void delVars()
Method to delete all Variables of this PortInst.


newInstance

public static PortInst newInstance(PortProto portProto,
                                   NodeInst nodeInst)
Method to create a PortInst object.

Parameters:
portProto - the PortProto on the prototype of the NodeInst.
nodeInst - the NodeInst that owns the port.
Returns:
the newly created PortInst.

getNodeInst

public NodeInst getNodeInst()
Method to return the NodeInst that this PortInst resides on.

Returns:
the NodeInst that this PortInst resides on.

getPortProto

public PortProto getPortProto()
Method to return the PortProto that this PortInst is an instance of.

Returns:
the PortProto that this PortInst is an instance of.

getPortIndex

public final int getPortIndex()
Method to get the index of this PortInst in NodeInst ports.

Returns:
index of this PortInst in NodeInst ports.

hasConnections

public boolean hasConnections()
Returns true of there are Connections on this PortInst.

Returns:
true if there are Connections on this PortInst.

getConnections

public java.util.Iterator<Connection> getConnections()
Get iterator of all Connections that connect to this PortInst

Returns:
an iterator over associated Connections

getExports

public java.util.Iterator<Export> getExports()
Get iterator of all Exports that connect to this PortInst

Returns:
an iterator over associated Exports

getProtoEquivalent

public PortProto getProtoEquivalent()
Method to return the equivalent PortProto of this PortInst's PortProto. This is typically used to find the PortProto in the schematic view.

Returns:
the equivalent PortProto of this PortInst's PortProto, or null if not found.

getBounds

public java.awt.geom.Rectangle2D getBounds()
Method to return the bounds of this PortInst. The bounds are determined by getting the Poly and bounding it.

Returns:
the bounds of this PortInst.

getCenter

public EPoint getCenter()

getPoly

public Poly getPoly()
Method to return the Poly that describes this PortInst.

Returns:
the Poly that describes this PortInst.

addDisplayableVariables

public int addDisplayableVariables(java.awt.geom.Rectangle2D rect,
                                   Poly[] polys,
                                   int start,
                                   EditWindow0 wnd,
                                   boolean multipleStrings)
Method to add all displayable Variables on this PortInsts to an array of Poly objects.

Overrides:
addDisplayableVariables in class ElectricObject
Parameters:
rect - a rectangle describing the bounds of the NodeInst on which the PortInsts reside.
polys - an array of Poly objects that will be filled with the displayable Variables.
start - the starting index in the array of Poly objects to fill with displayable Variables.
wnd - window in which the Variables will be displayed.
multipleStrings - true to break multiline text into multiple Polys.
Returns:
the number of Polys that were added.

describe

public java.lang.String describe(boolean withQuotes)
Method to describe this NodeInst as a string.

Parameters:
withQuotes - to wrap description between quotes
Returns:
a description of this NodeInst as a string.

toString

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

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

compare

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

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

isLinked

public boolean isLinked()
Overrides ElectricObject.isLinked(). This is because a PortInst is a derived database object, and is never explicitly linked or unlinked. It represents a NodeInst and PortProto pair. So, this method really returns it's nodeinst's isLinked() value.

Specified by:
isLinked in class ElectricObject
Returns:
true if the object is linked into the database, false if not.

getDatabase

public EDatabase getDatabase()
Returns database to which this PortInst belongs. Some objects are not in database, for example Geometrics in PaletteFrame. Method returns null for non-database objects.

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

computeTextPoly

public Poly computeTextPoly(EditWindow0 wnd,
                            Variable var,
                            Name name)