com.sun.electric.database.topology
Class NodeInst

java.lang.Object
  extended by com.sun.electric.database.variable.ElectricObject
      extended by com.sun.electric.database.topology.Geometric
          extended by com.sun.electric.database.topology.NodeInst
All Implemented Interfaces:
Nodable, RTBounds, java.io.Serializable, java.lang.Comparable<NodeInst>

public class NodeInst
extends Geometric
implements Nodable, java.lang.Comparable<NodeInst>

A NodeInst is an instance of a NodeProto (a PrimitiveNode or a Cell). A NodeInst points to its prototype and the Cell in which it has been instantiated. It also has a name, and contains a list of Connections and Exports.

The rotation and transposition of a NodeInst can be confusing, so it is illustrated here. Nodes are transposed when one of their scale factors is negative.

See Also:
Serialized Form

Field Summary
static Variable.Key NODE_NAME
          key of obsolete Variable holding instance name.
static Variable.Key NODE_PROTO
          key of text descriptor with prototype name.
static Variable.Key TRACE
          key of Varible holding outline information.
static Variable.Key TRANSISTOR_LENGTH_KEY
          key of Varible holding serpentine transistor length.
 
Fields inherited from class com.sun.electric.database.topology.Geometric
parent
 
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 NodeInst and its PortInsts to an array of Poly objects.
 void addParameter(Variable param)
          Method to add a Parameter to this NodeInst.
 void addVar(Variable var)
          Method to add a Variable on this NodeInst.
 void check()
          Method to check invariants in this NodeInst.
 int checkAndRepair(boolean repair, java.util.List<Geometric> list, ErrorLogger errorLogger)
          Method to check and repair data structure errors in this NodeInst.
static boolean checkNameKey(Name name, Cell parent)
          Method to check the new name key of a NodeInst.
 void checkPossibleVariableEffects(Variable.Key key)
          Method to handle special case side-effects of setting variables on this NodeInst.
 void clearExpanded()
          Method to set this NodeInst to be unexpanded.
 void clearHardSelect()
          Method to set this NodeInst to be easy-to-select.
 void clearLocked()
          Method to set this NodeInst to be unlocked.
 void clearVisInside()
          Method to set this NodeInst to be not visible-inside.
 boolean compare(java.lang.Object obj, java.lang.StringBuffer buffer)
          This function is to compare NodeInst elements.
 int compareTo(NodeInst that)
          Compares NodeInsts by their Cells and names.
 PortProto connectsTo(ArcProto arc)
          Method to tell whether this NodeInst can connect to a given ArcProto.
 boolean contains(NodeInst ni, int arrayIndex)
          Implements Nodable.contains(NodeInst ni).
 void copyStateBits(NodeInst ni)
          Method to copy the various state bits from another NodeInst to this NodeInst.
 void delParameter(Variable.Key key)
          Method to delete a defined Parameter from this NodeInst.
 void delVar(Variable.Key key)
          Method to delete a Variable from this NodeInst.
 java.lang.String describe(boolean withQuotes)
          Method to describe this NodeInst as a string.
 PortInst findClosestPortInst(java.awt.geom.Point2D w)
          Method to return the PortInst on this NodeInst that is closest to a point.
 java.awt.geom.Rectangle2D findEssentialBounds()
          Return the Essential Bounds of this NodeInst.
 PortInst findPortInst(java.lang.String name)
          Method to return the named PortInst on this NodeInst.
 PortInst findPortInstFromProto(PortProto pp)
          Method to return the Portinst on this NodeInst with a given prototype.
 EPoint getAnchorCenter()
          Method to return the center point of this NodeInst object.
 double getAnchorCenterX()
          Method to return the center X coordinate of this NodeInst.
 double getAnchorCenterY()
          Method to return the center Y coordinate of this NodeInst.
 int getAngle()
          Method to return the rotation angle of this NodeInst.
 double[] getArcDegrees()
          Method to return the starting and ending angle of an arc described by this NodeInst.
 Name getBasename()
          Returns the basename for autonaming.
 Poly getBaseShape()
          Returns the polygon that describe the base highlight of this NodeInst.
 Poly getBaseShape(EPoint anchor, double baseWidth, double baseHeight)
          Returns the polygon that describe the base highlight of this NodeInst with modified size.
 java.awt.geom.Rectangle2D getBounds()
          Method to return the bounds of this NodeInst.
 CellBackup getCellBackupUnsafe()
          Returns CellBackup containing this NodeInst.
 java.util.Iterator<Connection> getConnections()
          Method to return an Iterator over all Connections on this NodeInst.
 ImmutableNodeInst getD()
          Returns persistent data of this NodeInst.
 java.util.Iterator<Variable> getDefinedParameters()
          Method to return an Iterator over defined Parameters on this Nodable.
 Poly[] getDisplayableVariables(EditWindow0 wnd)
          Method to get all displayable Variables on this NodeInst and its PortInsts to an array of Poly objects.
 java.util.Iterator<Export> getExports()
          Method to return an Iterator over all Exports on this NodeInst.
 PrimitiveNode.Function getFunction()
          Method to return the function of this NodeProto.
 double getLambdaBaseXSize()
          Method to return the base X size of this NodeInst in lambda units.
 double getLambdaBaseYSize()
          Method to return the base Y size of this NodeInst in lambda units.
 java.lang.String getName()
          Method to return the name of this NodeInst.
 Name getNameKey()
          Method to return the name key of this NodeInst.
 int getNodeIndex()
          Method to get the index of this NodeInst.
 NodeInst getNodeInst()
          Get the NodeInst associated with this Nodable For NodeInsts, this returns itself.
 PrimitiveNodeSize getNodeInstSize(VarContext context)
          Method to return the size of this NodeInst in terms of width and height/length depending on the type of primitive.
 int getNumConnections()
          Method to return the number of Connections on this NodeInst.
 int getNumExports()
          Method to return the number of Exports on this NodeInst.
 int getNumPortInsts()
          Method to return the number of PortInsts on this NodeInst.
 PortInst getOnlyPortInst()
          Method to return the only PortInst on this NodeInst.
 Orientation getOrient()
          Method to return the Orientation of this NodeInst.
 Variable getParameter(Variable.Key key)
          Method to return the Parameter on this NodeInst with the given key.
 java.util.Iterator<Variable> getParameters()
          Method to return an Iterator over all Parameters on this NodeInst.
 PortInst getPortInst(int portIndex)
          Method to return the PortInst at specified position.
 java.util.Iterator<PortInst> getPortInsts()
          Method to return an Iterator for all PortInsts on this NodeInst.
 PrimitiveNodeSize getPrimitiveDependentNodeSize(VarContext context)
          Method to return the size of this PrimitiveNode-dependend NodeInst like transistors and resistors.
 NodeProto getProto()
          Method to return the prototype of this NodeInst.
 Cell getProtoEquivalent()
          Method to get the Schematic Cell from a NodeInst icon
 double getSerpentineTransistorLength()
          Method to return the length of this serpentine transistor.
 java.util.Iterator<Poly> getShape(Poly.Builder polyBuilder)
          Returns the polygons that describe this NodeInst.
 Poly getShapeOfPort(PortProto thePort)
          Method to return a Poly that describes the location of a port on this NodeInst.
 Poly getShapeOfPort(PortProto thePort, java.awt.geom.Point2D selectPt, boolean forWiringTool, double arcWidth)
          Method to return a Poly that describes the location of a port on this NodeInst.
 int getTechSpecific()
          Method to return the Technology-specific value on this NodeInst.
 java.lang.String getTechSpecificAddition()
          Method to return a string that describes any technology-specific additions to this NodeInst's prototype name.
 TextDescriptor getTextDescriptor(Variable.Key varKey)
          Returns the TextDescriptor on this NodeInst selected by variable key.
 EPoint[] getTrace()
          Method to return the "outline" information on this NodeInst.
 PortInst getTransistorAltGatePort()
          Method to return the alternate gate PortInst for this transistor NodeInst.
 PortInst getTransistorBasePort()
          Method to return the base port of this transistor.
 PortInst getTransistorBiasPort()
          Method to return a gate PortInst for this transistor NodeInst.
 PortInst getTransistorCollectorPort()
          Method to return the collector port of this transistor.
 PortInst getTransistorDrainPort()
          Method to return a gate PortInst for this transistor NodeInst.
 PortInst getTransistorEmitterPort()
          Method to return the emitter port of this transistor.
 PortInst getTransistorGatePort()
          Method to return a gate PortInst for this transistor NodeInst.
 TransistorSize getTransistorSize(VarContext context)
          Method to return the size of this transistor NodeInst.
 PortInst getTransistorSourcePort()
          Method to return a gate PortInst for this transistor NodeInst.
 java.awt.geom.Rectangle2D getUntransformedBounds()
          Method to return the bounds of this NodeInst before it is transformed.
 double getXSize()
          Method to return the X size of this NodeInst.
 double getXSizeWithoutOffset()
          Method similar to getXSize() to return the X size of this NodeInst without the offset.
 double getYSize()
          Method to return the Y size of this NodeInst.
 double getYSizeWithoutOffset()
          Method similar to getXSize() to return the X size of this NodeInst without the offset.
 boolean hasConnections()
          Returns true of there are Connections on this NodeInst.
 boolean hasExports()
          Returns true of there are Exports on this NodeInst.
 java.awt.geom.Point2D invisiblePinWithOffsetText(boolean repair)
          Method to tell if this NodeInst is an invisible-pin with text that is offset away from the pin center.
 boolean isCellInstance()
          Method to tell whether this NodeInst is a cell instance.
 boolean isConnected(Geometric geom)
          Method to tell whether this NodeInst is connected directly to another Geometric object (that is, an arcinst connected to a nodeinst).
 boolean isDefinedParameter(Variable.Key key)
          Method to tell if the Variable.Key is a defined parameters of this NodeInst.
 boolean isDeprecatedVariable(Variable.Key key)
          Method to determine whether a variable key on NodeInst is deprecated.
 boolean isExpanded()
          Method to tell whether this NodeInst is expanded.
 boolean isHardSelect()
          Method to tell whether this NodeInst is hard-to-select.
 boolean isIconOfParent()
          Method to tell whether this NodeInst is an icon of its parent.
 boolean isInlinePin()
          Method to tell whether this NodeInst is a pin that is "inline".
 boolean isInvisiblePinWithText()
          Method to determine whether this is an Invisible Pin with text.
 boolean isLinked()
          Method tells if this NodeInst is linked to parent Cell.
 boolean isLocked()
          Method to tell whether this NodeInst is locked.
 boolean isMirroredAboutXAxis()
          Method to return whether NodeInst is mirrored about a horizontal line running through its center.
 boolean isMirroredAboutYAxis()
          Method to return whether NodeInst is mirrored about a vertical line running through its center.
 boolean isPrimitiveTransistor()
          Method to see if this NodeInst is a Primitive Transistor.
 boolean isPrimtiveSubstrateNode()
          Method to return true if a PrimitiveNode is acting as implant.
 boolean isSerpentineTransistor()
          Method to see if this NodeInst is a Serpentine Transistor.
static boolean isSpecialNode(NodeInst ni)
          Method to detect if np is not relevant for some tool calculation and therefore could be skip.
 boolean isUsernamed()
          Retruns true if this NodeInst was named by user.
 boolean isVisInside()
          Method to tell whether this NodeInst is visible-inside.
 boolean isWiped()
          Method to tell whether this NodeInst is wiped.
 boolean isXMirrored()
          Method to tell whether this NodeInst is mirrored in the X coordinate.
 boolean isYMirrored()
          Method to tell whether this NodeInst is mirrored in the Y coordinate.
 void kill()
          Method to delete this NodeInst.
 void lowLevelModify(ImmutableNodeInst d)
          Method to adjust this NodeInst by the specified deltas.
static NodeInst lowLevelNewInstance(Cell parent, ImmutableNodeInst d)
           
static NodeInst makeDummyInstance(NodeProto np)
          Method to create a "dummy" NodeInst for use outside of the database.
static NodeInst makeDummyInstance(NodeProto np, EPoint center, double width, double height, Orientation orient)
          Method to create a "dummy" NodeInst for use outside of the database.
static NodeInst makeDummyInstance(NodeProto np, int techBits, EPoint center, double width, double height, Orientation orient)
          Method to create a "dummy" NodeInst for use outside of the database.
static NodeInst makeInstance(NodeProto protoType, java.awt.geom.Point2D center, double width, double height, Cell parent)
          Short form method to create a NodeInst and do extra things necessary for it.
static NodeInst makeInstance(NodeProto protoType, java.awt.geom.Point2D center, double width, double height, Cell parent, Orientation orient, java.lang.String name)
          Short form method to create a NodeInst and do extra things necessary for it.
static NodeInst makeInstance(NodeProto protoType, java.awt.geom.Point2D center, double width, double height, Cell parent, Orientation orient, java.lang.String name, int techBits)
          Long form method to create a NodeInst and do extra things necessary for it.
static NodeInst makeInstance(NodeProto protoType, java.awt.geom.Point2D center, double width, double height, Cell parent, Orientation orient, java.lang.String name, PrimitiveNode.Function function)
          Short form method to create a NodeInst and do extra things necessary for it.
 void modifyInstance(double dX, double dY, double dXSize, double dYSize, Orientation dOrient)
          Method to change this NodeInst.
static void modifyInstances(NodeInst[] nis, double[] dXs, double[] dYs, double[] dXSizes, double[] dYSizes)
          Method to change many NodeInsts.
 void move(double dX, double dY)
          Method to move this NodeInst.
static NodeInst newInstance(Cell parent, ImmutableNodeInst d)
          Method to create a NodeInst by ImmutableNodeInst.
static NodeInst newInstance(Cell parent, NodeProto protoType, java.lang.String name, TextDescriptor nameDescriptor, java.awt.geom.Point2D center, EPoint size, Orientation orient, int flags, int techBits, TextDescriptor protoDescriptor, ErrorLogger errorLogger)
          Long form method to create a NodeInst.
static NodeInst newInstance(NodeProto protoType, java.awt.geom.Point2D center, double width, double height, Cell parent)
          Short form method to create a NodeInst.
static NodeInst newInstance(NodeProto protoType, java.awt.geom.Point2D center, double width, double height, Cell parent, Orientation orient, java.lang.String name)
          Long form method to create a NodeInst.
static NodeInst newInstance(NodeProto protoType, java.awt.geom.Point2D center, double width, double height, Cell parent, Orientation orient, java.lang.String name, int techBits)
          Long form method to create a NodeInst.
 int numDisplayableVariables(boolean multipleStrings)
          Method to return the number of displayable Variables on this NodeInst and all of its PortInsts.
 boolean pinUseCount()
          Method to determine whether the display of this pin NodeInst should be supressed.
 java.awt.geom.AffineTransform pureRotateIn()
          Method to return a transformation that unrotates the same as this NodeInst.
 java.awt.geom.AffineTransform pureRotateOut()
          Method to return a transformation that rotates the same as this NodeInst.
 void redoGeometric()
          Method to recalculate the Geometric bounds for this NodeInst.
 NodeInst replace(NodeProto np, boolean ignorePortNames, boolean allowMissingPorts)
          Method to replace this NodeInst with one of another type.
 void resize(double dXSize, double dYSize)
          Method to resize this NodeInst.
 void rotate(Orientation dOrient)
          Method to rotate and/or mirror this NodeInst.
 java.awt.geom.AffineTransform rotateIn()
          Method to return a transformation that unrotates this NodeInst.
 java.awt.geom.AffineTransform rotateIn(java.awt.geom.AffineTransform prevTransform)
          Method to return a transformation that unrotates this NodeInst, combined with a previous transformation.
 java.awt.geom.AffineTransform rotateOut()
          Method to return a transformation that rotates this NodeInst.
 java.awt.geom.AffineTransform rotateOut(java.awt.geom.AffineTransform prevTransform)
          Method to return a transformation that rotates this NodeInst, combined with a previous transformation.
 java.awt.geom.AffineTransform rotateOutAboutTrueCenter()
          Method to return a transformation that rotates this NodeInst.
 java.awt.geom.AffineTransform rotateOutAboutTrueCenter(java.awt.geom.AffineTransform prevTransform)
          Method to return a transformation that rotates this NodeInst, combined with a previous transformation.
 void setArcDegrees(double start, double curvature)
          Method to set the starting and ending angle of an arc described by this NodeInst.
 boolean setD(ImmutableNodeInst newD, boolean notify)
          Modifies persistend data of this NodeInst.
 void setDInUndo(ImmutableNodeInst newD)
           
 void setExpanded()
          Method to set this NodeInst to be expanded.
 void setExpanded(boolean value)
          Method to set this NodeInst to be expanded.
 void setHardSelect()
          Method to set this NodeInst to be hard-to-select.
 void setLocked()
          Method to set this NodeInst to be locked.
 boolean setName(java.lang.String name)
          Method to rename this NodeInst.
 void setNodeIndex(int nodeIndex)
          Method to set an index of this NodeInst in Cell nodes.
 void setPrimitiveNodeSize(double width, double length)
          Method to set the size of this transistor or resistor NodeInst.
 void setPrimitiveNodeSize(java.lang.Object width, java.lang.Object length)
          Method to set the size of a transistor or resistor NodeInst in this technology.
 void setSerpentineTransistorLength(double length)
          Method to store a length value on this serpentine transistor.
 void setTechSpecific(int value)
          Method to set a Technology-specific value on this NodeInst.
 void setTextDescriptor(Variable.Key varKey, TextDescriptor td)
          Updates the TextDescriptor on this NodeInst selected by varKey.
 void setTrace(java.awt.geom.Point2D[] points)
          Method to set the "outline" information on this NodeInst.
 void setVisInside()
          Method to set this NodeInst to be visible-inside.
 java.lang.String toString()
          Returns a printable version of this NodeInst.
 boolean traceWraps()
          Method to tell whether the outline information on this NodeInst wraps.
 java.awt.geom.AffineTransform transformIn()
          Method to return a transformation that moves down the hierarchy.
 java.awt.geom.AffineTransform transformIn(java.awt.geom.AffineTransform prevTransform)
          Method to return a transformation that moves down the hierarchy.
 java.awt.geom.AffineTransform transformOut()
          Method to return a transformation that moves up the hierarchy.
 java.awt.geom.AffineTransform transformOut(java.awt.geom.AffineTransform prevTransform)
          Method to return a transformation that moves up the hierarchy, combined with a previous transformation.
 java.awt.geom.AffineTransform translateIn()
          Method to return a transformation that translates down the hierarchy.
 java.awt.geom.AffineTransform translateIn(java.awt.geom.AffineTransform prevTransform)
          Method to return a transformation that translates down the hierarchy, combined with a previous transformation.
 java.awt.geom.AffineTransform translateOut()
          Method to return a transformation that translates up the hierarchy.
 java.awt.geom.AffineTransform translateOut(java.awt.geom.AffineTransform prevTransform)
          Method to return a transformation that translates up the hierarchy, combined with a previous transformation.
 Variable updateParam(Variable.Key key, java.lang.Object value)
          Method to update a Parameter on this NodeInst with the specified values.
 void updatePortInsts(boolean full)
          Updaten PortInsts of this NodeInst according to PortProtos in prototype.
 void updatePortInsts(int[] pattern)
          Update PortInsts of this NodeInst accoding to pattern.
protected  java.lang.Object writeReplace()
           
 
Methods inherited from class com.sun.electric.database.topology.Geometric
checkChanging, getDatabase, getGridBounds, getInfo, getLambdaBounds, getParent, getTrueCenter, getTrueCenterX, getTrueCenterY, whichCell, whichMultiPage
 
Methods inherited from class com.sun.electric.database.variable.ElectricObject
checkExamine, checkUndoing, computeTextPoly, copyTextDescriptorFrom, copyVarsFrom, getArtwork, getCode, getDisplayableVariables, getEditingPreferences, getGeneric, getMutableTextDescriptor, getNumVariables, getParameterOrVariable, getParameterOrVariable, getParametersAndVariables, getPolyList, getSchematics, getTech, getTechPool, getTextBounds, getVar, getVar, getVariables, getVarValue, getVarValue, isDatabaseObject, isParam, newDisplayVar, newVar, newVar, newVar, newVar, 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
 
Methods inherited from interface com.sun.electric.database.hierarchy.Nodable
getParameterOrVariable, getParent, getVar
 

Field Detail

NODE_PROTO

public static final Variable.Key NODE_PROTO
key of text descriptor with prototype name.


NODE_NAME

public static final Variable.Key NODE_NAME
key of obsolete Variable holding instance name.


TRACE

public static final Variable.Key TRACE
key of Varible holding outline information.


TRANSISTOR_LENGTH_KEY

public static final Variable.Key TRANSISTOR_LENGTH_KEY
key of Varible holding serpentine transistor length.

Method Detail

isSpecialNode

public static boolean isSpecialNode(NodeInst ni)
Method to detect if np is not relevant for some tool calculation and therefore could be skip. E.g. cellCenter, drcNodes, essential bounds and pins in DRC. Similar for layer generation

Parameters:
ni - the NodeInst in question.
Returns:
true if it is a special node (cell center, etc.)

writeReplace

protected java.lang.Object writeReplace()

makeInstance

public static NodeInst makeInstance(NodeProto protoType,
                                    java.awt.geom.Point2D center,
                                    double width,
                                    double height,
                                    Cell parent)
Short form method to create a NodeInst and do extra things necessary for it. Angle, name and techBits are set to defaults.

Parameters:
protoType - the NodeProto of which this is an instance.
center - the center location of this NodeInst.
width - the width of this NodeInst (can't be negative).
height - the height of this NodeInst (can't be negative).
parent - the Cell in which this NodeInst will reside.
Returns:
the newly created NodeInst, or null on error.

makeInstance

public static NodeInst makeInstance(NodeProto protoType,
                                    java.awt.geom.Point2D center,
                                    double width,
                                    double height,
                                    Cell parent,
                                    Orientation orient,
                                    java.lang.String name)
Short form method to create a NodeInst and do extra things necessary for it. Angle, name and techBits are set to defaults.

Parameters:
protoType - the NodeProto of which this is an instance.
center - the center location of this NodeInst.
width - the width of this NodeInst (can't be negative).
height - the height of this NodeInst (can't be negative).
parent - the Cell in which this NodeInst will reside.
orient - the orientation of this NodeInst.
name - name of new NodeInst
Returns:
the newly created NodeInst, or null on error.

makeInstance

public static NodeInst makeInstance(NodeProto protoType,
                                    java.awt.geom.Point2D center,
                                    double width,
                                    double height,
                                    Cell parent,
                                    Orientation orient,
                                    java.lang.String name,
                                    PrimitiveNode.Function function)
Short form method to create a NodeInst and do extra things necessary for it. Angle, name and techBits are set to defaults.

Parameters:
protoType - the NodeProto of which this is an instance.
center - the center location of this NodeInst.
width - the width of this NodeInst (can't be negative).
height - the height of this NodeInst (can't be negative).
parent - the Cell in which this NodeInst will reside.
orient - the orientation of this NodeInst.
name - name of new NodeInst
Returns:
the newly created NodeInst, or null on error.

makeInstance

public static NodeInst makeInstance(NodeProto protoType,
                                    java.awt.geom.Point2D center,
                                    double width,
                                    double height,
                                    Cell parent,
                                    Orientation orient,
                                    java.lang.String name,
                                    int techBits)
Long form method to create a NodeInst and do extra things necessary for it.

Parameters:
protoType - the NodeProto of which this is an instance.
center - the center location of this NodeInst.
width - the width of this NodeInst (can't be negative).
height - the height of this NodeInst (can't be negative).
parent - the Cell in which this NodeInst will reside.
orient - the orientation of this NodeInst.
name - name of new NodeInst
techBits - bits associated to different technologies
Returns:
the newly created NodeInst, or null on error.

makeDummyInstance

public static NodeInst makeDummyInstance(NodeProto np)
Method to create a "dummy" NodeInst for use outside of the database.

Parameters:
np - the prototype of the NodeInst.
Returns:
the dummy NodeInst.

makeDummyInstance

public static NodeInst makeDummyInstance(NodeProto np,
                                         EPoint center,
                                         double width,
                                         double height,
                                         Orientation orient)
Method to create a "dummy" NodeInst for use outside of the database.

Parameters:
np - the prototype of the NodeInst.
center - the center location of this NodeInst.
width - the width of this NodeInst (can't be negative).
height - the height of this NodeInst (can't be negative).
orient - the orientation of this NodeInst.
Returns:
the dummy NodeInst.

makeDummyInstance

public static NodeInst makeDummyInstance(NodeProto np,
                                         int techBits,
                                         EPoint center,
                                         double width,
                                         double height,
                                         Orientation orient)
Method to create a "dummy" NodeInst for use outside of the database.

Parameters:
np - the prototype of the NodeInst.
techBits - tech bits of the NodeInst
center - the center location of this NodeInst.
width - the width of this NodeInst (can't be negative).
height - the height of this NodeInst (can't be negative).
orient - the orientation of this NodeInst.
Returns:
the dummy NodeInst.

newInstance

public static NodeInst newInstance(NodeProto protoType,
                                   java.awt.geom.Point2D center,
                                   double width,
                                   double height,
                                   Cell parent)
Short form method to create a NodeInst. Angle, name and techBits are set to defaults.

Parameters:
protoType - the NodeProto of which this is an instance.
center - the center location of this NodeInst.
width - the width of this NodeInst (can't be negative).
height - the height of this NodeInst (can't be negative). If negative, flip the Y coordinate (or flip ABOUT the X axis).
parent - the Cell in which this NodeInst will reside.
Returns:
the newly created NodeInst, or null on error.

newInstance

public static NodeInst newInstance(NodeProto protoType,
                                   java.awt.geom.Point2D center,
                                   double width,
                                   double height,
                                   Cell parent,
                                   Orientation orient,
                                   java.lang.String name)
Long form method to create a NodeInst.

Parameters:
protoType - the NodeProto of which this is an instance.
center - the center location of this NodeInst.
width - the width of this NodeInst (can't be negative).
height - the height of this NodeInst (can't be negative).
parent - the Cell in which this NodeInst will reside.
orient - the oriantation of this NodeInst.
name - name of new NodeInst
Returns:
the newly created NodeInst, or null on error.

newInstance

public static NodeInst newInstance(NodeProto protoType,
                                   java.awt.geom.Point2D center,
                                   double width,
                                   double height,
                                   Cell parent,
                                   Orientation orient,
                                   java.lang.String name,
                                   int techBits)
Long form method to create a NodeInst.

Parameters:
protoType - the NodeProto of which this is an instance.
center - the center location of this NodeInst.
width - the width of this NodeInst (can't be negative).
height - the height of this NodeInst (can't be negative).
parent - the Cell in which this NodeInst will reside.
orient - the oriantation of this NodeInst.
name - name of new NodeInst
techBits - bits associated to different technologies
Returns:
the newly created NodeInst, or null on error.

newInstance

public static NodeInst newInstance(Cell parent,
                                   NodeProto protoType,
                                   java.lang.String name,
                                   TextDescriptor nameDescriptor,
                                   java.awt.geom.Point2D center,
                                   EPoint size,
                                   Orientation orient,
                                   int flags,
                                   int techBits,
                                   TextDescriptor protoDescriptor,
                                   ErrorLogger errorLogger)
Long form method to create a NodeInst.

Parameters:
parent - the Cell in which this NodeInst will reside.
protoType - the NodeProto of which this is an instance.
name - name of new NodeInst
nameDescriptor - TextDescriptor of name of this NodeInst
center - the center location of this NodeInst.
size - the size of this NodeInst (can't be negative).
orient - the orientation of this NodeInst.
flags - flags of this NodeInst.
techBits - bits associated to different technologies
protoDescriptor - TextDescriptor of name of this NodeInst
errorLogger - error logger to report node rename.
Returns:
the newly created NodeInst, or null on error.

newInstance

public static NodeInst newInstance(Cell parent,
                                   ImmutableNodeInst d)
Method to create a NodeInst by ImmutableNodeInst.

Parameters:
parent - the Cell in which this NodeInst will reside.
d - ImmutableNodeInst of new NodeInst
Returns:
the newly created NodeInst, or null on error.

lowLevelNewInstance

public static NodeInst lowLevelNewInstance(Cell parent,
                                           ImmutableNodeInst d)

kill

public void kill()
Method to delete this NodeInst.


move

public void move(double dX,
                 double dY)
Method to move this NodeInst.

Parameters:
dX - the amount to move the NodeInst in X.
dY - the amount to move the NodeInst in Y.

resize

public void resize(double dXSize,
                   double dYSize)
Method to resize this NodeInst.

Parameters:
dXSize - the amount to scale the NodeInst in X.
dYSize - the amount to scale the NodeInst in Y.

rotate

public void rotate(Orientation dOrient)
Method to rotate and/or mirror this NodeInst.

Parameters:
dOrient - the change in Orientation of the NodeInst.

modifyInstance

public void modifyInstance(double dX,
                           double dY,
                           double dXSize,
                           double dYSize,
                           Orientation dOrient)
Method to change this NodeInst.

Parameters:
dX - the amount to move the NodeInst in X.
dY - the amount to move the NodeInst in Y.
dXSize - the amount to scale the NodeInst in X.
dYSize - the amount to scale the NodeInst in Y.
dOrient - the change of Orientation of the NodeInst.

modifyInstances

public static void modifyInstances(NodeInst[] nis,
                                   double[] dXs,
                                   double[] dYs,
                                   double[] dXSizes,
                                   double[] dYSizes)
Method to change many NodeInsts.

Parameters:
nis - the NodeInsts to change.
dXs - the amount to move the NodeInsts in X, or null.
dYs - the amount to move the NodeInsts in Y, or null.
dXSizes - the amount to scale the NodeInsts in X, or null.
dYSizes - the amount to scale the NodeInsts in Y, or null.

replace

public NodeInst replace(NodeProto np,
                        boolean ignorePortNames,
                        boolean allowMissingPorts)
Method to replace this NodeInst with one of another type. All arcs and exports on this NodeInst are moved to the new one.

Parameters:
np - the new type to put in place of this NodeInst.
ignorePortNames - true to not use port names when determining association between old and new prototype.
allowMissingPorts - true to allow replacement to have missing ports and, therefore, delete the arcs that used to be there.
Returns:
the new NodeInst that replaces this one. Returns null if there is an error doing the replacement.

getD

public ImmutableNodeInst getD()
Returns persistent data of this NodeInst.

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

setD

public boolean setD(ImmutableNodeInst newD,
                    boolean notify)
Modifies persistend data of this NodeInst.

Parameters:
newD - new persistent data.
notify - true to notify Undo system.
Returns:
true if persistent data was modified.

setDInUndo

public void setDInUndo(ImmutableNodeInst newD)

addVar

public void addVar(Variable var)
Method to add a Variable on this NodeInst. It may add repaired copy of this Variable in some cases. This methood is overriden in IconNodeInst

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 NodeInst.

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

lowLevelModify

public void lowLevelModify(ImmutableNodeInst d)
Method to adjust this NodeInst by the specified deltas. This method does not go through change control, and so should not be used unless you know what you are doing. New persistent data may differ from old one only by anchor, size and orientation

Parameters:
d - the new persistent data of this NodeInst.

isIconOfParent

public boolean isIconOfParent()
Method to tell whether this NodeInst is an icon of its parent. Electric does not allow recursive circuit hierarchies (instances of Cells inside of themselves). However, it does allow one exception: a schematic may contain its own icon for documentation purposes. This method determines whether this NodeInst is such an icon.

Returns:
true if this NodeInst is an icon of its parent.

setNodeIndex

public void setNodeIndex(int nodeIndex)
Method to set an index of this NodeInst in Cell nodes. This is a zero-based index of nodes on the Cell.

Parameters:
nodeIndex - an index of this NodeInst in Cell nodes.

getNodeIndex

public final int getNodeIndex()
Method to get the index of this NodeInst. This is a zero-based index of nodes on the Cell.

Returns:
the index of this NodeInst.

isLinked

public boolean isLinked()
Method tells if this NodeInst is linked to parent Cell.

Specified by:
isLinked in class ElectricObject
Returns:
true if this NodeInst is linked to parent Cell.

getCellBackupUnsafe

public CellBackup getCellBackupUnsafe()
Returns CellBackup containing this NodeInst. If this node hasn't parent, a dummy CellBackup is returned.

Returns:
CellBackup containing this NodeInst.

getOrient

public Orientation getOrient()
Method to return the Orientation of this NodeInst.

Returns:
the Orientation of this NodeInst.

getAngle

public int getAngle()
Method to return the rotation angle of this NodeInst.

Returns:
the rotation angle of this NodeInst (in tenth-degrees).

getAnchorCenter

public EPoint getAnchorCenter()
Method to return the center point of this NodeInst object.

Returns:
the center point of this NodeInst object.

getAnchorCenterX

public double getAnchorCenterX()
Method to return the center X coordinate of this NodeInst.

Returns:
the center X coordinate of this NodeInst.

getAnchorCenterY

public double getAnchorCenterY()
Method to return the center Y coordinate of this NodeInst.

Returns:
the center Y coordinate of this NodeInst.

getXSize

public double getXSize()
Method to return the X size of this NodeInst.

Returns:
the X size of this NodeInst.

getLambdaBaseXSize

public double getLambdaBaseXSize()
Method to return the base X size of this NodeInst in lambda units.

Returns:
the base X size of this NodeInst.

getXSizeWithoutOffset

public double getXSizeWithoutOffset()
Method similar to getXSize() to return the X size of this NodeInst without the offset.

Returns:
the X size of this NodeInst.

getYSize

public double getYSize()
Method to return the Y size of this NodeInst.

Returns:
the Y size of this NodeInst.

getLambdaBaseYSize

public double getLambdaBaseYSize()
Method to return the base Y size of this NodeInst in lambda units.

Returns:
the base Y size of this NodeInst.

getYSizeWithoutOffset

public double getYSizeWithoutOffset()
Method similar to getXSize() to return the X size of this NodeInst without the offset.

Returns:
the X size of this NodeInst.

isMirroredAboutXAxis

public boolean isMirroredAboutXAxis()
Method to return whether NodeInst is mirrored about a horizontal line running through its center.

Returns:
true if mirrored.

isMirroredAboutYAxis

public boolean isMirroredAboutYAxis()
Method to return whether NodeInst is mirrored about a vertical line running through its center.

Returns:
true if mirrored.

isXMirrored

public boolean isXMirrored()
Method to tell whether this NodeInst is mirrored in the X coordinate. Mirroring in the X axis implies that X coordinates are negated. Thus, it is equivalent to mirroring ABOUT the Y axis.

Returns:
true if this NodeInst is mirrored in the X coordinate.

isYMirrored

public boolean isYMirrored()
Method to tell whether this NodeInst is mirrored in the Y coordinate. Mirroring in the Y axis implies that Y coordinates are negated. Thus, it is equivalent to mirroring ABOUT the X axis.

Returns:
true if this NodeInst is mirrored in the Y coordinate.

getShape

public java.util.Iterator<Poly> getShape(Poly.Builder polyBuilder)
Returns the polygons that describe this NodeInst.

Specified by:
getShape in class Geometric
Parameters:
polyBuilder - Poly builder.
Returns:
an iterator on Poly objects that describes this NodeInst graphically. These objects include displayable variables on the NodeInst.

getBaseShape

public Poly getBaseShape()
Returns the polygon that describe the base highlight of this NodeInst.

Returns:
a Poly object that describes the highlight of this NodeInst graphically.

getBaseShape

public Poly getBaseShape(EPoint anchor,
                         double baseWidth,
                         double baseHeight)
Returns the polygon that describe the base highlight of this NodeInst with modified size.

Parameters:
baseWidth - modified base width in lambda units
baseHeight - modified base height in lambda units
Returns:
a Poly object that describes the highlight of this NodeInst graphically.

getBounds

public java.awt.geom.Rectangle2D getBounds()
Method to return the bounds of this NodeInst. TODO: dangerous to give a pointer to our internal field; should make a copy of visBounds

Specified by:
getBounds in interface RTBounds
Specified by:
getBounds in class Geometric
Returns:
the bounds of this NodeInst.

redoGeometric

public void redoGeometric()
Method to recalculate the Geometric bounds for this NodeInst.


getArcDegrees

public double[] getArcDegrees()
Method to return the starting and ending angle of an arc described by this NodeInst. These values can be found in the "ART_degrees" variable on the NodeInst.

Returns:
a 2-long double array with the starting offset in the first entry (a value in radians) and the amount of curvature in the second entry (in radians). If the NodeInst does not have circular information, both values are set to zero.

setArcDegrees

public void setArcDegrees(double start,
                          double curvature)
Method to set the starting and ending angle of an arc described by this NodeInst. These values are stored in the "ART_degrees" variable on the NodeInst.

Parameters:
start - the starting offset of the angle (typically 0)
curvature - the the amount of curvature

getUntransformedBounds

public java.awt.geom.Rectangle2D getUntransformedBounds()
Method to return the bounds of this NodeInst before it is transformed.

Returns:
the bounds of this NodeInst before it is transformed.

getParameter

public Variable getParameter(Variable.Key key)
Method to return the Parameter on this NodeInst with the given key. Overridden in IconNodeInst.

Specified by:
getParameter in interface Nodable
Parameters:
key - the key of the Parameter
Returns:
null

isDefinedParameter

public boolean isDefinedParameter(Variable.Key key)
Method to tell if the Variable.Key is a defined parameters of this NodeInst. Overridden in IconNodeInst.

Specified by:
isDefinedParameter in interface Nodable
Parameters:
key - the key of the parameter
Returns:
false

getParameters

public java.util.Iterator<Variable> getParameters()
Method to return an Iterator over all Parameters on this NodeInst. Overridden in IconNodeInst

Specified by:
getParameters in interface Nodable
Returns:
an empty Iterator

getDefinedParameters

public java.util.Iterator<Variable> getDefinedParameters()
Method to return an Iterator over defined Parameters on this Nodable. Overridden in IconNodeInst

Specified by:
getDefinedParameters in interface Nodable
Returns:
an empty Iterator

addParameter

public void addParameter(Variable param)
Method to add a Parameter to this NodeInst. Overridden in IconNodeInst

Parameters:
param - the Variable to add.

delParameter

public void delParameter(Variable.Key key)
Method to delete a defined Parameter from this NodeInst. Overridden in IconNodeInst

Parameters:
key - the key of the Variable to delete.

updateParam

public Variable updateParam(Variable.Key key,
                            java.lang.Object value)
Method to update a Parameter on this NodeInst with the specified values. If the Variable already exists, only the value is changed; the displayable attributes are preserved.

Parameters:
key - the key of the Variable.
value - the object to store in the Variable.
Returns:
the Variable that has been updated.

numDisplayableVariables

public int numDisplayableVariables(boolean multipleStrings)
Method to return the number of displayable Variables on this NodeInst and all of its PortInsts. A displayable Variable is one that will be shown with its object. Displayable Variables can only sensibly exist on NodeInst, ArcInst, and PortInst objects.

Overrides:
numDisplayableVariables in class ElectricObject
Returns:
the number of displayable Variables on this NodeInst and all of its PortInsts.

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 NodeInst and its 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 Variables will be displayed.
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.

getDisplayableVariables

public Poly[] getDisplayableVariables(EditWindow0 wnd)
Method to get all displayable Variables on this NodeInst and its PortInsts to an array of Poly objects. This Poly were not transformed by Node transform.

Parameters:
wnd - window in which the Variables will be displayed.
Returns:
an array of Poly objects with displayable variables.

transformOut

public java.awt.geom.AffineTransform transformOut()
Method to return a transformation that moves up the hierarchy. Presuming that this NodeInst is a Cell instance, the transformation maps points in the Cell's coordinate space into this NodeInst's parent Cell's coordinate space.

Returns:
a transformation that moves up the hierarchy.

transformOut

public java.awt.geom.AffineTransform transformOut(java.awt.geom.AffineTransform prevTransform)
Method to return a transformation that moves up the hierarchy, combined with a previous transformation. Presuming that this NodeInst is a Cell instance, the transformation maps points in the Cell's coordinate space into this NodeInst's parent Cell's coordinate space.

Parameters:
prevTransform - the previous transformation to the NodeInst's Cell.
Returns:
a transformation that translates up the hierarchy, including the previous transformation.

transformIn

public java.awt.geom.AffineTransform transformIn()
Method to return a transformation that moves down the hierarchy. Presuming that this NodeInst is a Cell instance, the transformation maps points in the Cell's coordinate space into this NodeInst's parent Cell's coordinate space.

Returns:
a transformation that moves down the hierarchy.

transformIn

public java.awt.geom.AffineTransform transformIn(java.awt.geom.AffineTransform prevTransform)
Method to return a transformation that moves down the hierarchy. Presuming that this NodeInst is a Cell instance, the transformation maps points in the Cell's coordinate space into this NodeInst's parent Cell's coordinate space.

Parameters:
prevTransform -
Returns:
a transformation that moves down the hierarchy, including the previous down transformation

translateIn

public java.awt.geom.AffineTransform translateIn()
Method to return a transformation that translates down the hierarchy. Transform out of this node instance, translate outer coordinates to inner However, it does not account for the rotation of this NodeInst...it only translates from one space to another.

Returns:
a transformation that translates down the hierarchy.

translateIn

public java.awt.geom.AffineTransform translateIn(java.awt.geom.AffineTransform prevTransform)
Method to return a transformation that translates down the hierarchy, combined with a previous transformation. However, it does not account for the rotation of this NodeInst...it only translates from one space to another.

Parameters:
prevTransform - the previous transformation to the NodeInst's Cell.
Returns:
a transformation that translates down the hierarchy, including the previous transformation.

translateOut

public java.awt.geom.AffineTransform translateOut()
Method to return a transformation that translates up the hierarchy. Transform out of this node instance, translate inner coordinates to outer. However, it does not account for the rotation of this NodeInst...it only translates from one space to another.

Returns:
a transformation that translates up the hierarchy.

translateOut

public java.awt.geom.AffineTransform translateOut(java.awt.geom.AffineTransform prevTransform)
Method to return a transformation that translates up the hierarchy, combined with a previous transformation. Presuming that this NodeInst is a Cell instance, the transformation goes from the space of that Cell to the space of this NodeInst's parent Cell. However, it does not account for the rotation of this NodeInst...it only translates from one space to another.

Parameters:
prevTransform - the previous transformation to the NodeInst's Cell.
Returns:
a transformation that translates up the hierarchy, including the previous transformation.

pureRotateOut

public java.awt.geom.AffineTransform pureRotateOut()
Method to return a transformation that rotates the same as this NodeInst. It transforms points on this NodeInst to account for the NodeInst's rotation. The rotation happens about the origin.

Returns:
a transformation that rotates the same as this NodeInst. If this NodeInst is not rotated, the returned transformation is identity.

pureRotateIn

public java.awt.geom.AffineTransform pureRotateIn()
Method to return a transformation that unrotates the same as this NodeInst. It transforms points on this NodeInst to account for the NodeInst's rotation. The rotation happens about the origin.

Returns:
a transformation that unrotates the same as this NodeInst. If this NodeInst is not rotated, the returned transformation is identity.

rotateIn

public java.awt.geom.AffineTransform rotateIn()
Method to return a transformation that unrotates this NodeInst. It transforms points on this NodeInst that have been rotated with the node so that they appear in the correct location on the unrotated node. The rotation happens about the node's Anchor Point (the location of the cell-center inside of cell definitions).

Returns:
a transformation that unrotates this NodeInst. If this NodeInst is not rotated, the returned transformation is identity.

rotateIn

public java.awt.geom.AffineTransform rotateIn(java.awt.geom.AffineTransform prevTransform)
Method to return a transformation that unrotates this NodeInst, combined with a previous transformation. It transforms points on this NodeInst that have been rotated with the node so that they appear in the correct location on the unrotated node. The rotation happens about the node's Anchor Point (the location of the cell-center inside of cell definitions).

Parameters:
prevTransform - the previous transformation to be applied.
Returns:
a transformation that unrotates this NodeInst, combined with a previous transformation. If this NodeInst is not rotated, the returned transformation is the original parameter.

rotateOut

public java.awt.geom.AffineTransform rotateOut()
Method to return a transformation that rotates this NodeInst. It transforms points on this NodeInst to account for the NodeInst's rotation. The rotation happens about the node's Anchor Point (the location of the cell-center inside of cell definitions).

Returns:
a transformation that rotates this NodeInst. If this NodeInst is not rotated, the returned transformation is identity.

rotateOutAboutTrueCenter

public java.awt.geom.AffineTransform rotateOutAboutTrueCenter()
Method to return a transformation that rotates this NodeInst. It transforms points on this NodeInst to account for the NodeInst's rotation. The rotation happens about the node's true geometric center.

Returns:
a transformation that rotates this NodeInst. If this NodeInst is not rotated, the returned transformation is identity.

rotateOut

public java.awt.geom.AffineTransform rotateOut(java.awt.geom.AffineTransform prevTransform)
Method to return a transformation that rotates this NodeInst, combined with a previous transformation. It transforms points on this NodeInst to account for the NodeInst's rotation. The rotation happens about the node's Anchor Point (the location of the cell-center inside of cell definitions).

Parameters:
prevTransform - the previous transformation to be applied.
Returns:
a transformation that rotates this NodeInst, combined with a previous transformation.. If this NodeInst is not rotated, the returned transformation is identity.

rotateOutAboutTrueCenter

public java.awt.geom.AffineTransform rotateOutAboutTrueCenter(java.awt.geom.AffineTransform prevTransform)
Method to return a transformation that rotates this NodeInst, combined with a previous transformation. It transforms points on this NodeInst to account for the NodeInst's rotation. The rotation happens about the node's true geometric center.

Parameters:
prevTransform - the previous transformation to be applied.
Returns:
a transformation that rotates this NodeInst, combined with a previous transformation.. If this NodeInst is not rotated, the returned transformation is identity.

getShapeOfPort

public Poly getShapeOfPort(PortProto thePort)
Method to return a Poly that describes the location of a port on this NodeInst.

Parameters:
thePort - the port on this NodeInst.
Returns:
a Poly that describes the location of the Export. The Poly is transformed to account for rotation on this NodeInst.

getShapeOfPort

public Poly getShapeOfPort(PortProto thePort,
                           java.awt.geom.Point2D selectPt,
                           boolean forWiringTool,
                           double arcWidth)
Method to return a Poly that describes the location of a port on this NodeInst.

Parameters:
thePort - the port on this NodeInst.
selectPt - if not null, it requests a new location on the port, away from existing arcs, and close to this point. This is useful for "area" ports such as the left side of AND and OR gates.
forWiringTool - this is an experimental flag that will reduce the *untransformed* port width to zero if the primitive node's width is the default width. Likewise with the port height. It will also take into account the arc width of the connecting arc for contact cuts. These modifications are for the wiring tool.
arcWidth - of connecting arc, for the wiring tool if 'forWiringTool' is true. set to -1 to ignore.
Returns:
a Poly that describes the location of the Export. The Poly is transformed to account for rotation on this NodeInst.

getTrace

public EPoint[] getTrace()
Method to return the "outline" information on this NodeInst. Outline information is a set of coordinate points that further refines the NodeInst description. It is typically used in Artwork primitives to give them a precise shape. It is also used by pure-layer nodes in all layout technologies to allow them to take any shape. It is even used by many MOS transistors to allow a precise gate path to be specified.

Returns:
an array of Point2D in database coordinates.

setTrace

public void setTrace(java.awt.geom.Point2D[] points)
Method to set the "outline" information on this NodeInst. Outline information is a set of coordinate points that further refines the NodeInst description. It is typically used in Artwork primitives to give them a precise shape. It is also used by pure-layer nodes in all layout technologies to allow them to take any shape. It is even used by many MOS transistors to allow a precise gate path to be specified.

Parameters:
points - an array of Point2D values in database coordinates. These are not relative to the center of the node, but are actual coordinates of the outline.

traceWraps

public boolean traceWraps()
Method to tell whether the outline information on this NodeInst wraps. Wrapping outline information applies to closed figures, such as pure-layer nodes. Nodes that do not wrap include serpentine transistors, splines, and opened polygons.

Returns:
true if this node's outline information wraps.

getPortInsts

public java.util.Iterator<PortInst> getPortInsts()
Method to return an Iterator for all PortInsts on this NodeInst.

Returns:
an Iterator for all PortInsts on this NodeInst.

getNumPortInsts

public int getNumPortInsts()
Method to return the number of PortInsts on this NodeInst.

Returns:
the number of PortInsts on this NodeInst.

getPortInst

public PortInst getPortInst(int portIndex)
Method to return the PortInst at specified position.

Parameters:
portIndex - specified position of PortInst.
Returns:
the PortProto at specified position..

getOnlyPortInst

public PortInst getOnlyPortInst()
Method to return the only PortInst on this NodeInst. This is quite useful for vias and pins which have only one PortInst.

Returns:
the only PortInst on this NodeInst. If there are more than 1 PortInst, then return null.

findPortInst

public PortInst findPortInst(java.lang.String name)
Method to return the named PortInst on this NodeInst.

Parameters:
name - the name of the PortInst.
Returns:
the selected PortInst. If the name is not found, return null.

findClosestPortInst

public PortInst findClosestPortInst(java.awt.geom.Point2D w)
Method to return the PortInst on this NodeInst that is closest to a point.

Parameters:
w - the point of interest.
Returns:
the closest PortInst to that point.

findPortInstFromProto

public PortInst findPortInstFromProto(PortProto pp)
Method to return the Portinst on this NodeInst with a given prototype.

Parameters:
pp - the PortProto to find.
Returns:
the selected PortInst. If the PortProto is not found, return null.

updatePortInsts

public void updatePortInsts(int[] pattern)
Update PortInsts of this NodeInst accoding to pattern. Pattern contains an element for each PortProto. If PortProto was just created, the element contains -1. For old PortProtos the element contains old index of the PortProto.

Parameters:
pattern - array with elements describing new PortInsts.

updatePortInsts

public void updatePortInsts(boolean full)
Updaten PortInsts of this NodeInst according to PortProtos in prototype.


getProtoEquivalent

public Cell getProtoEquivalent()
Method to get the Schematic Cell from a NodeInst icon

Returns:
the equivalent view of the prototype, or null if none (such as for primitive)

hasExports

public boolean hasExports()
Returns true of there are Exports on this NodeInst.

Returns:
true if there are Exports on this NodeInst.

getExports

public java.util.Iterator<Export> getExports()
Method to return an Iterator over all Exports on this NodeInst.

Returns:
an Iterator over all Exports on this NodeInst.

getNumExports

public int getNumExports()
Method to return the number of Exports on this NodeInst.

Returns:
the number of Exports on this NodeInst.

pinUseCount

public boolean pinUseCount()
Method to determine whether the display of this pin NodeInst should be supressed. In Schematics technologies, pins are not displayed if there are 1 or 2 connections, but are shown for 0 or 3 or more connections (called "Steiner points").

Returns:
true if this pin NodeInst should be supressed.

isInlinePin

public boolean isInlinePin()
Method to tell whether this NodeInst is a pin that is "inline". An inline pin is one that connects in the middle between two arcs. The arcs must line up such that the pin can be removed and the arcs replaced with a single arc that is in the same place as the former two.

Returns:
true if this NodeInst is an inline pin.

connectsTo

public PortProto connectsTo(ArcProto arc)
Method to tell whether this NodeInst can connect to a given ArcProto.

Parameters:
arc - the type of arc to test for.
Returns:
the first port that can connect to this node, or null, if no such port on this node exists.

getConnections

public java.util.Iterator<Connection> getConnections()
Method to return an Iterator over all Connections on this NodeInst.

Returns:
an Iterator over all Connections on this NodeInst.

hasConnections

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

Returns:
true if there are Connections on this NodeInst.

getNumConnections

public int getNumConnections()
Method to return the number of Connections on this NodeInst.

Returns:
the number of Connections on this NodeInst.

isConnected

public boolean isConnected(Geometric geom)
Method to tell whether this NodeInst is connected directly to another Geometric object (that is, an arcinst connected to a nodeinst). The method returns true if they are connected.

Specified by:
isConnected in class Geometric
Parameters:
geom - other Geometric object.
Returns:
true if this and other Geometric objects are connected.

getName

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

Specified by:
getName in interface Nodable
Returns:
the name of this NodeInst.

isUsernamed

public boolean isUsernamed()
Retruns true if this NodeInst was named by user.

Returns:
true if this NodeInst was named by user.

getNameKey

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

Specified by:
getNameKey in interface Nodable
Returns:
the name key of this NodeInst, null if there is no name.

setName

public boolean setName(java.lang.String name)
Method to rename this NodeInst. This NodeInst must be linked to database.

Parameters:
name - new name of this NodeInst.
Returns:
true on error

checkNameKey

public static boolean checkNameKey(Name name,
                                   Cell parent)
Method to check the new name key of a NodeInst.

Parameters:
name - new name key of this NodeInst.
parent - parent Cell used for error message
Returns:
true on error.

getTextDescriptor

public TextDescriptor getTextDescriptor(Variable.Key varKey)
Returns the TextDescriptor on this NodeInst selected by variable key. This key may be a key of variable on this NodeInst or one of the special keys: NodeInst.NODE_NAME NodeInst.NODE_PROTO 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 ElectricObject.

setTextDescriptor

public void setTextDescriptor(Variable.Key varKey,
                              TextDescriptor td)
Updates the TextDescriptor on this NodeInst selected by varKey. The varKey may be a key of variable on this NodeInst or one of the special keys: NodeInst.NODE_NAME NodeInst.NODE_PROTO 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 key.
td - new value TextDescriptor

isDeprecatedVariable

public boolean isDeprecatedVariable(Variable.Key key)
Method to determine whether a variable key on NodeInst 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.

checkPossibleVariableEffects

public void checkPossibleVariableEffects(Variable.Key key)
Method to handle special case side-effects of setting variables on this NodeInst. Overrides the general method on ElectricObject. Currently it handles changes to the number-of-degrees on a circle node.

Parameters:
key - the Variable key that has changed on this NodeInst.

isInvisiblePinWithText

public boolean isInvisiblePinWithText()
Method to determine whether this is an Invisible Pin with text. If so, it should not be selected, but its text should be instead.

Returns:
true if this is an Invisible Pin with text.

invisiblePinWithOffsetText

public java.awt.geom.Point2D invisiblePinWithOffsetText(boolean repair)
Method to tell if this NodeInst is an invisible-pin with text that is offset away from the pin center. Since invisible pins with text are never shown, their text should not be offset.

Parameters:
repair - true to fix such text by changing its offset to (0,0). If this is selected, the change is made directly (so this must be called from inside of a job).
Returns:
the coordinates of the pin, if it has offset text. Returns null if the pin is valid (or if it isn't a pin or doesn't have text).

getTechSpecificAddition

public java.lang.String getTechSpecificAddition()
Method to return a string that describes any technology-specific additions to this NodeInst's prototype name.

Returns:
an extra description of this NodeInst's prototype (may be an empty string).

describe

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

Overrides:
describe in class Geometric
Parameters:
withQuotes - to wrap description between quotes
Returns:
a description of this NodeInst as a string.

compareTo

public int compareTo(NodeInst that)
Compares NodeInsts by their Cells and names.

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

toString

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

Specified by:
toString in interface Nodable
Overrides:
toString in class ElectricObject
Returns:
a printable version of this NodeInst.

getProto

public NodeProto getProto()
Method to return the prototype of this NodeInst.

Specified by:
getProto in interface Nodable
Returns:
the prototype of this NodeInst.

isCellInstance

public boolean isCellInstance()
Method to tell whether this NodeInst is a cell instance.

Specified by:
isCellInstance in interface Nodable
Returns:
true if this NodeInst is a cell instance, false if it is a primitive

contains

public boolean contains(NodeInst ni,
                        int arrayIndex)
Implements Nodable.contains(NodeInst ni). True if ni is the same as this. False otherwise

Specified by:
contains in interface Nodable
Parameters:
ni - a NodeInst
Returns:
true if this Nodable contains ni, false otherwise

getNodeInst

public NodeInst getNodeInst()
Get the NodeInst associated with this Nodable For NodeInsts, this returns itself.

Specified by:
getNodeInst in interface Nodable
Returns:
the NodeInst associate with this Nodable

getFunction

public PrimitiveNode.Function getFunction()
Method to return the function of this NodeProto. The Function is a technology-independent description of the behavior of this NodeProto.

Returns:
function the function of this NodeProto.

isPrimitiveTransistor

public boolean isPrimitiveTransistor()
Method to see if this NodeInst is a Primitive Transistor. Use getFunction() to determine what specific transitor type it is, if any.

Returns:
true if NodeInst represents Primitive Transistor

isPrimtiveSubstrateNode

public boolean isPrimtiveSubstrateNode()
Method to return true if a PrimitiveNode is acting as implant. This is used for coverage implant function.


isSerpentineTransistor

public boolean isSerpentineTransistor()
Method to see if this NodeInst is a Serpentine Transistor.

Returns:
true if NodeInst is a serpentine transistor.

getNodeInstSize

public PrimitiveNodeSize getNodeInstSize(VarContext context)
Method to return the size of this NodeInst in terms of width and height/length depending on the type of primitive.

Parameters:
context - the VarContext in which any evaluations take place, pass in VarContext.globalContext if no context needed.
Returns:
the size of the NodeInst

getPrimitiveDependentNodeSize

public PrimitiveNodeSize getPrimitiveDependentNodeSize(VarContext context)
Method to return the size of this PrimitiveNode-dependend NodeInst like transistors and resistors.

Parameters:
context - the VarContext in which any evaluations take place, pass in VarContext.globalContext if no context needed.
Returns:
the size of the NodeInst if it is a PrimitiveNode

getTransistorSize

public TransistorSize getTransistorSize(VarContext context)
Method to return the size of this transistor NodeInst.

Parameters:
context - the VarContext in which any evaluations take place, pass in VarContext.globalContext if no context needed.
Returns:
the size of the NodeInst if it is a transistor

setPrimitiveNodeSize

public void setPrimitiveNodeSize(double width,
                                 double length)
Method to set the size of this transistor or resistor NodeInst. Does nothing if this is not a transistor NodeInst.

Parameters:
width - the new width of the transistor
length - the new length of the transistor

setPrimitiveNodeSize

public void setPrimitiveNodeSize(java.lang.Object width,
                                 java.lang.Object length)
Method to set the size of a transistor or resistor NodeInst in this technology. Width may be the area for non-FET transistors, in which case length is ignored. This does nothing if the NodeInst's technology is not Schematics.

Parameters:
width - the new width
length - the new length

getSerpentineTransistorLength

public double getSerpentineTransistorLength()
Method to return the length of this serpentine transistor.

Returns:
the transistor's length Returns -1 if this is not a serpentine transistor, or if the length cannot be found.

setSerpentineTransistorLength

public void setSerpentineTransistorLength(double length)
Method to store a length value on this serpentine transistor.

Parameters:
length - the new length of the transistor.

getTransistorGatePort

public PortInst getTransistorGatePort()
Method to return a gate PortInst for this transistor NodeInst. Implementation Note: May want to make this a more general method, getPrimitivePort(PortType), if the number of port types increases.

Returns:
a PortInst for the gate of the transistor

getTransistorAltGatePort

public PortInst getTransistorAltGatePort()
Method to return the alternate gate PortInst for this transistor NodeInst. Only useful for layout transistors that have two gate ports. Implementation Note: May want to make this a more general method, getPrimitivePort(PortType), if the number of port types increases.

Returns:
a PortInst for the alternate gate of the transistor

getTransistorSourcePort

public PortInst getTransistorSourcePort()
Method to return a gate PortInst for this transistor NodeInst. Implementation Note: May want to make this a more general method, getPrimitivePort(PortType), if the number of port types increases.

Returns:
a PortInst for the gate of the transistor

getTransistorEmitterPort

public PortInst getTransistorEmitterPort()
Method to return the emitter port of this transistor.

Returns:
the PortInst of the emitter (presuming that this node is that kind of transistor).

getTransistorBasePort

public PortInst getTransistorBasePort()
Method to return the base port of this transistor.

Returns:
the PortInst of the base (presuming that this node is that kind of transistor).

getTransistorCollectorPort

public PortInst getTransistorCollectorPort()
Method to return the collector port of this transistor.

Returns:
the PortInst of the collector (presuming that this node is that kind of transistor).

getTransistorBiasPort

public PortInst getTransistorBiasPort()
Method to return a gate PortInst for this transistor NodeInst. Implementation Note: May want to make this a more general method, getPrimitivePort(PortType), if the number of port types increases.

Returns:
a PortInst for the gate of the transistor

getTransistorDrainPort

public PortInst getTransistorDrainPort()
Method to return a gate PortInst for this transistor NodeInst. Implementation Note: May want to make this a more general method, getPrimitivePort(PortType), if the number of port types increases.

Returns:
a PortInst for the gate of the transistor

checkAndRepair

public int checkAndRepair(boolean repair,
                          java.util.List<Geometric> list,
                          ErrorLogger errorLogger)
Method to check and repair data structure errors in this NodeInst.


check

public void check()
Method to check invariants in this NodeInst.

Overrides:
check in class ElectricObject
Throws:
java.lang.AssertionError - if invariants are not valid

getBasename

public Name getBasename()
Returns the basename for autonaming.

Returns:
the basename for autonaming.

copyStateBits

public void copyStateBits(NodeInst ni)
Method to copy the various state bits from another NodeInst to this NodeInst. Includes all of the state bits stored in the flags word and also the "expanded" state.

Parameters:
ni - the other NodeInst to copy.

setExpanded

public void setExpanded(boolean value)
Method to set this NodeInst to be expanded. Expanded NodeInsts are instances of Cells that show their contents. Unexpanded Cell instances are shown as boxes with the node prototype names in them. The state has no meaning for instances of primitive node prototypes.

Parameters:
value - true if NodeInst is expanded.

setExpanded

public void setExpanded()
Method to set this NodeInst to be expanded. Expanded NodeInsts are instances of Cells that show their contents. Unexpanded Cell instances are shown as boxes with the node prototype names in them. The state has no meaning for instances of primitive node prototypes.


clearExpanded

public void clearExpanded()
Method to set this NodeInst to be unexpanded. Expanded NodeInsts are instances of Cells that show their contents. Unexpanded Cell instances are shown as boxes with the node prototype names in them. The state has no meaning for instances of primitive node prototypes.


isExpanded

public boolean isExpanded()
Method to tell whether this NodeInst is expanded. Expanded NodeInsts are instances of Cells that show their contents. Unexpanded Cell instances are shown as boxes with the node prototype names in them. The state has no meaning for instances of primitive node prototypes.

Returns:
true if this NodeInst is expanded.

isWiped

public boolean isWiped()
Method to tell whether this NodeInst is wiped. Wiped NodeInsts are erased. Typically, pin NodeInsts can be wiped. This means that when an arc connects to the pin, it is no longer drawn. In order for a NodeInst to be wiped, its prototype must have the "setArcsWipe" state, and the arcs connected to it must have "setWipable" in their prototype.

Returns:
true if this NodeInst is wiped.

setHardSelect

public void setHardSelect()
Method to set this NodeInst to be hard-to-select. Hard-to-select NodeInsts cannot be selected by clicking on them. Instead, the "special select" command must be given.


clearHardSelect

public void clearHardSelect()
Method to set this NodeInst to be easy-to-select. Hard-to-select NodeInsts cannot be selected by clicking on them. Instead, the "special select" command must be given.


isHardSelect

public boolean isHardSelect()
Method to tell whether this NodeInst is hard-to-select. Hard-to-select NodeInsts cannot be selected by clicking on them. Instead, the "special select" command must be given.

Returns:
true if this NodeInst is hard-to-select.

setVisInside

public void setVisInside()
Method to set this NodeInst to be visible-inside. A NodeInst that is "visible inside" is only drawn when viewing inside of the Cell. It is not visible from outside (meaning from higher-up the hierarchy).


clearVisInside

public void clearVisInside()
Method to set this NodeInst to be not visible-inside. A NodeInst that is "visible inside" is only drawn when viewing inside of the Cell. It is not visible from outside (meaning from higher-up the hierarchy).


isVisInside

public boolean isVisInside()
Method to tell whether this NodeInst is visible-inside. A NodeInst that is "visible inside" is only drawn when viewing inside of the Cell. It is not visible from outside (meaning from higher-up the hierarchy).

Returns:
true if this NodeInst is visible-inside.

setLocked

public void setLocked()
Method to set this NodeInst to be locked. Locked NodeInsts cannot be modified or deleted.


clearLocked

public void clearLocked()
Method to set this NodeInst to be unlocked. Locked NodeInsts cannot be modified or deleted.


isLocked

public boolean isLocked()
Method to tell whether this NodeInst is locked. Locked NodeInsts cannot be modified or deleted.

Returns:
true if this NodeInst is locked.

setTechSpecific

public void setTechSpecific(int value)
Method to set a Technology-specific value on this NodeInst. This is mostly used by the Schematics technology which allows variations on a NodeInst to be stored. For example, the Transistor primitive uses these bits to distinguish nMOS, pMOS, etc.

Parameters:
value - the Technology-specific value to store on this NodeInst.

getTechSpecific

public int getTechSpecific()
Method to return the Technology-specific value on this NodeInst. This is mostly used by the Schematics technology which allows variations on a NodeInst to be stored. For example, the Transistor primitive uses these bits to distinguish nMOS, pMOS, etc.

Returns:
the Technology-specific value on this NodeInst.

findEssentialBounds

public java.awt.geom.Rectangle2D findEssentialBounds()
Return the Essential Bounds of this NodeInst.

If this is a NodeInst of a Cell, and if that Cell has Essential Bounds, then map that Cell's Essential Bounds into the coordinate space of the Cell that contains this NodeInst, and return the Rectangle2D that contains those bounds. Otherwise return null.

Returns:
the Rectangle2D containing the essential bounds or null if the essential bounds don't exist.

compare

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

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