com.sun.electric.database.topology
Class ArcInst

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.ArcInst
All Implemented Interfaces:
RTBounds, java.io.Serializable, java.lang.Comparable<ArcInst>

public class ArcInst
extends Geometric
implements java.lang.Comparable<ArcInst>

An ArcInst is an instance of an ArcProto (a wire type) An ArcInst points to its prototype, the Cell on which it has been instantiated, and the connection at either end of the wire. The geometry of the wire (width and length) is captured in the bounds of the Geometric portion of this object.

ArcInst objects have properties that constrain them. Here is the notion of "Fixed angle":

Here is the notion of rigid arcs:

Here is the notion of slidable arcs:

Constraints propagate hierarchically:

See Also:
Serialized Form

Field Summary
static Variable.Key ARC_NAME
          Key of the obsolete variable holding arc name.
static int HEADEND
          The index of the head of this ArcInst.
static ArcInst[] NULL_ARRAY
          empty array of ArcInsts.
static int TAILEND
          The index of the tail of this ArcInst.
 
Fields inherited from class com.sun.electric.database.topology.Geometric
parent
 
Constructor Summary
ArcInst(Topology topology, ImmutableArcInst d, PortInst headPort, PortInst tailPort)
          Private constructor of ArcInst.
 
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 Electric object to an array of Poly objects.
 void addVar(Variable var)
          Method to add a Variable on this ArcInst.
 void check(Poly.Builder polyBuilder)
          Method to check invariants in this ArcInst.
 int checkAndRepair(boolean repair, java.util.List<Geometric> list, ErrorLogger errorLogger)
          Method to check and repair data structure errors in this ArcInst.
 void checkPossibleVariableEffects(Variable.Key key)
          Method to handle special case side-effects of setting variables on this NodeInst.
 boolean compare(java.lang.Object obj, java.lang.StringBuffer buffer)
          This function is to compare NodeInst elements.
 int compareTo(ArcInst that)
          Compares ArcInsts by their Cells and names.
 void copyConstraintsFrom(ArcInst fromAi)
          Copies constraints (Rigid, Ends Extended, etc) from another arcinst to this arcinst It copies also attributes of Connections (arrow/negated/extended)
 void copyPropertiesFrom(ArcInst fromAi)
          Copies all properties (variables, constraints, and textdescriptor) from 'fraomAi' to this arcinst.
 Poly cropPerLayer(Poly poly)
          Method to crop given polygon against a connecting transistor.
 Poly curvedArcLambdaOutline(Poly.Type style, long gridWidth, long gridRadius)
          Method to fill polygon "poly" with the outline in lambda units of the curved arc in this ArcInst whose width in grid units is "gridWidth".
 void delVar(Variable.Key key)
          Method to delete a Variable from this ArcInst.
 java.lang.String describe(boolean withQuotes)
          Method to describe this ArcInst as a string.
 int getAngle()
          Method to return the rotation angle of this ArcInst.
 int getArcId()
          Method to get the arcId of this ArcInst.
 java.awt.geom.Rectangle2D getBounds()
          Method to return the bounds of this ArcInst.
 Connection getConnection(int connIndex)
          Method to return the connection at an end of this ArcInst.
 ImmutableArcInst getD()
          Returns persistent data of this ArcInst.
 Poly[] getDisplayableVariables(EditWindow0 wnd)
          Method to get all displayable Variables on this ArcInst to an array of Poly objects.
 long getGridBaseWidth()
          Method to return the base width of this ArcInst in grid units.
 long getGridFullWidth()
          Method to return the full width of this ArcInst in grid units.
 double getGridLength()
          Method to return the length of this ArcInst in grid units.
 HeadConnection getHead()
          Method to return the Connection on the head end of this ArcInst.
 EPoint getHeadLocation()
          Method to return the Location on head of this ArcInst.
 PortInst getHeadPortInst()
          Method to return the PortInst on head of this ArcInst.
 double getLambdaBaseWidth()
          Method to return the base width of this ArcInst in lambda units.
 double getLambdaLength()
          Method to return the length of this ArcInst in lambda units.
 EPoint getLocation(int connIndex)
          Method to return the Location on an end of this ArcInst.
 java.lang.String getName()
          Method to return the name of this ArcInst.
 Name getNameKey()
          Method to return the name key of this ArcInst.
 PortInst getPortInst(int connIndex)
          Method to return the PortInst on an end of this ArcInst.
 ArcProto getProto()
          Method to return the prototype of this ArcInst.
 java.util.Iterator<Poly> getShape(Poly.Builder polyBuilder)
          Returns the polygons that describe this ArcInst.
 TailConnection getTail()
          Method to return the Connection on the tail end of this ArcInst.
 EPoint getTailLocation()
          Method to return the Location on tail of this ArcInst.
 PortInst getTailPortInst()
          Method to return the PortInst on tail of this ArcInst.
 TextDescriptor getTextDescriptor(Variable.Key varKey)
          Returns the TextDescriptor on this ArcInst selected by variable key.
 boolean headStillInPort(java.awt.geom.Point2D pt, boolean reduceForArc)
          Method to tell whether a head connection on this ArcInst contains a port location.
 boolean isArrowed(int connIndex)
          Method to determine whether this ArcInst is directional, with an arrow on one end.
 boolean isBodyArrowed()
          Method to determine whether this ArcInst is directional, with an arrow line drawn down the center.
 boolean isConnected(Geometric geom)
          Method to tell whether this ArcInst is connected directly to another Geometric object (that is, an arcinst connected to a nodeinst).
 boolean isDeprecatedVariable(Variable.Key key)
          Method to determine whether a variable key on ArcInst is deprecated.
 boolean isDiffusionArc()
          Method to determin if arc contains active diffusion
 boolean isExtended(int connIndex)
          Method to tell whether an end of ArcInst has its ends extended.
 boolean isFixedAngle()
          Method to tell whether this ArcInst is fixed-angle.
 boolean isHardSelect()
          Method to tell whether this ArcInst is hard-to-select.
 boolean isHeadArrowed()
          Method to determine whether this ArcInst is directional, with an arrow on the head.
 boolean isHeadExtended()
          Method to tell whether the head of this arc is extended.
 boolean isHeadNegated()
          Method to tell whether the head of this arc is negated.
 boolean isLinked()
          Returns true if this ArcInst is linked into database.
 boolean isNegated(int connIndex)
          Method to tell whether an end of this arc is negated.
 boolean isRigid()
          Method to tell whether this ArcInst is rigid.
 boolean isSlidable()
          Method to tell whether this ArcInst is slidable.
 boolean isTailArrowed()
          Method to determine whether this ArcInst is directional, with an arrow on the tail.
 boolean isTailExtended()
          Method to tell whether the tail of this arc is extended.
 boolean isTailNegated()
          Method to tell whether the tail of this arc is negated.
 boolean isUsernamed()
          Retruns true if this ArcInst was named by user.
 boolean isZeroLength()
          Returns true if length of this ArcInst is zero.
 void kill()
          Method to delete this ArcInst.
 void lowLevelModify(ImmutableArcInst d)
          Low-level method to change the width and end locations of this ArcInst.
static ArcInst makeInstance(ArcProto type, PortInst head, PortInst tail)
          Method to create a new ArcInst with appropriate defaults, connecting two PortInsts.
static ArcInst makeInstance(ArcProto type, PortInst head, PortInst tail, java.awt.geom.Point2D headPt, java.awt.geom.Point2D tailPt, java.lang.String name)
          Method to create a new ArcInst with appropriate defaults, connecting two PortInsts at specified locations.
static ArcInst makeInstanceBase(ArcProto type, double baseWidth, PortInst head, PortInst tail)
          Method to create a new ArcInst with appropriate defaults, connecting two PortInsts.
static ArcInst makeInstanceBase(ArcProto type, double baseWidth, PortInst head, PortInst tail, java.awt.geom.Point2D headPt, java.awt.geom.Point2D tailPt, java.lang.String name)
          Method to create a new ArcInst with appropriate defaults, connecting two PortInsts at specified locations.
 Poly makeLambdaPoly(long gridWidth, Poly.Type style)
          Method to create a Poly object that describes an ArcInst in lambda units.
 void modify(double dHeadX, double dHeadY, double dTailX, double dTailY)
          Method to change the width and end locations of this ArcInst.
static ArcInst newInstance(Cell parent, ArcProto protoType, java.lang.String name, TextDescriptor nameDescriptor, PortInst headPort, PortInst tailPort, EPoint headPt, EPoint tailPt, long gridExtendOverMin, int angle, int flags)
          Method to create a new ArcInst connecting two PortInsts at specified locations.
static ArcInst newInstanceBase(ArcProto type, double baseWidth, PortInst head, PortInst tail)
          Method to create a new ArcInst connecting two PortInsts.
static ArcInst newInstanceBase(ArcProto type, double baseWidth, PortInst head, PortInst tail, java.awt.geom.Point2D headPt, java.awt.geom.Point2D tailPt, java.lang.String name, int defAngle)
          Method to create a new ArcInst connecting two PortInsts at specified locations.
static ArcInst newInstanceBase(ArcProto type, double baseWidth, PortInst head, PortInst tail, java.awt.geom.Point2D headPt, java.awt.geom.Point2D tailPt, java.lang.String name, int defAngle, int flags)
          Method to create a new ArcInst connecting two PortInsts at specified locations.
 int numDisplayableVariables(boolean multipleStrings)
          Method to return the number of displayable Variables on this ArcInst.
 void redoGeometric()
          Method to recalculate the Geometric bounds for this NodeInst.
 ArcInst replace(ArcProto ap)
          Method to replace this ArcInst with one of another type.
 void setAngle(int angle)
          Method to set the rotation angle of this ArcInst.
 void setArrowed(int connIndex, boolean state)
          Method to set this ArcInst to be directional, with an arrow on one end.
 void setBodyArrowed(boolean state)
          Method to set this ArcInst to be directional, with an arrow line drawn down the center.
 boolean setD(ImmutableArcInst newD, boolean notify)
          Modifies persistend data of this ArcInst.
 void setDInUndo(ImmutableArcInst newD)
           
 void setExtended(int connIndex, boolean e)
          Method to set whether an end of this arc is extended.
 void setFixedAngle(boolean state)
          Method to set this ArcInst to be fixed-angle.
 void setGridBaseWidth(long gridBaseWidth)
          Method to change the width this ArcInst.
 void setHardSelect(boolean state)
          Method to set this ArcInst to be hard-to-select.
 void setHeadArrowed(boolean state)
          Method to set this ArcInst to be directional, with an arrow on the head.
 void setHeadExtended(boolean e)
          Method to set whether the head of this arc is extended.
 void setHeadNegated(boolean n)
          Method to set whether the head of this arc is negated.
 void setLambdaBaseWidth(double lambdaBaseWidth)
          Method to change the width this ArcInst.
 boolean setName(java.lang.String name)
          Method to rename this ArcInst.
 void setNegated(int connIndex, boolean n)
          Method to set whether an end of this arc is negated.
 void setRigid(boolean state)
          Method to set this ArcInst to be rigid.
 void setSlidable(boolean state)
          Method to set this ArcInst to be slidable.
 void setTailArrowed(boolean state)
          Method to set this ArcInst to be directional, with an arrow on the tail.
 void setTailExtended(boolean e)
          Method to set whether the tail of this arc is extended.
 void setTailNegated(boolean n)
          Method to set whether the tail of this arc is negated.
 void setTextDescriptor(Variable.Key varKey, TextDescriptor td)
          Updates the TextDescriptor on this ArcInst selected by varKey.
 boolean stillInPort(int connIndex, java.awt.geom.Point2D pt, boolean reduceForArc)
          Method to tell whether a connection on this ArcInst contains a port location.
 boolean tailStillInPort(java.awt.geom.Point2D pt, boolean reduceForArc)
          Method to tell whether a tail connection on this ArcInst contains a port location.
 java.lang.String toString()
          Returns a printable version of this ArcInst.
 
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
check, 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
 

Field Detail

NULL_ARRAY

public static final ArcInst[] NULL_ARRAY
empty array of ArcInsts.


TAILEND

public static final int TAILEND
The index of the tail of this ArcInst.

See Also:
Constant Field Values

HEADEND

public static final int HEADEND
The index of the head of this ArcInst.

See Also:
Constant Field Values

ARC_NAME

public static final Variable.Key ARC_NAME
Key of the obsolete variable holding arc name.

Constructor Detail

ArcInst

public ArcInst(Topology topology,
               ImmutableArcInst d,
               PortInst headPort,
               PortInst tailPort)
Private constructor of ArcInst.

Parameters:
topology - the Topology of the ArcInst.
d - persistent data of ArcInst.
headPort - the head end PortInst.
tailPort - the tail end PortInst.
Method Detail

makeInstance

public static ArcInst makeInstance(ArcProto type,
                                   PortInst head,
                                   PortInst tail)
Method to create a new ArcInst with appropriate defaults, connecting two PortInsts. Since no coordinates are given, the ArcInst connects to the center of the PortInsts.

Parameters:
type - the prototype of the new ArcInst.
head - the head end PortInst.
tail - the tail end PortInst.
Returns:
the newly created ArcInst, or null if there is an error.

makeInstanceBase

public static ArcInst makeInstanceBase(ArcProto type,
                                       double baseWidth,
                                       PortInst head,
                                       PortInst tail)
Method to create a new ArcInst with appropriate defaults, connecting two PortInsts. Since no coordinates are given, the ArcInst connects to the center of the PortInsts.

Parameters:
type - the prototype of the new ArcInst.
baseWidth - the base width of the new ArcInst. The width must be > 0.
head - the head end PortInst.
tail - the tail end PortInst.
Returns:
the newly created ArcInst, or null if there is an error.

makeInstance

public static ArcInst makeInstance(ArcProto type,
                                   PortInst head,
                                   PortInst tail,
                                   java.awt.geom.Point2D headPt,
                                   java.awt.geom.Point2D tailPt,
                                   java.lang.String name)
Method to create a new ArcInst with appropriate defaults, connecting two PortInsts at specified locations. This is more general than the version that does not take coordinates.

Parameters:
type - the prototype of the new ArcInst.
head - the head end PortInst.
tail - the tail end PortInst.
headPt - the coordinate of the head end PortInst.
tailPt - the coordinate of the tail end PortInst.
name - the name of the new ArcInst
Returns:
the newly created ArcInst, or null if there is an error.

makeInstanceBase

public static ArcInst makeInstanceBase(ArcProto type,
                                       double baseWidth,
                                       PortInst head,
                                       PortInst tail,
                                       java.awt.geom.Point2D headPt,
                                       java.awt.geom.Point2D tailPt,
                                       java.lang.String name)
Method to create a new ArcInst with appropriate defaults, connecting two PortInsts at specified locations. This is more general than the version that does not take coordinates.

Parameters:
type - the prototype of the new ArcInst.
baseWidth - the base width of the new ArcInst. The width must be > 0.
head - the head end PortInst.
tail - the tail end PortInst.
headPt - the coordinate of the head end PortInst.
tailPt - the coordinate of the tail end PortInst.
name - the name of the new ArcInst
Returns:
the newly created ArcInst, or null if there is an error.

newInstanceBase

public static ArcInst newInstanceBase(ArcProto type,
                                      double baseWidth,
                                      PortInst head,
                                      PortInst tail)
Method to create a new ArcInst connecting two PortInsts. Since no coordinates are given, the ArcInst connects to the center of the PortInsts.

Parameters:
type - the prototype of the new ArcInst.
baseWidth - the base width of the new ArcInst. The width must be > 0.
head - the head end PortInst.
tail - the tail end PortInst.
Returns:
the newly created ArcInst, or null if there is an error.

newInstanceBase

public static ArcInst newInstanceBase(ArcProto type,
                                      double baseWidth,
                                      PortInst head,
                                      PortInst tail,
                                      java.awt.geom.Point2D headPt,
                                      java.awt.geom.Point2D tailPt,
                                      java.lang.String name,
                                      int defAngle)
Method to create a new ArcInst connecting two PortInsts at specified locations. This is more general than the version that does not take coordinates.

Parameters:
type - the prototype of the new ArcInst.
baseWidth - the base width of the new ArcInst. The width must be > 0.
head - the head end PortInst.
tail - the tail end PortInst.
headPt - the coordinate of the head end PortInst.
tailPt - the coordinate of the tail end PortInst.
name - the name of the new ArcInst
defAngle - default angle in case port points coincide
Returns:
the newly created ArcInst, or null if there is an error.

newInstanceBase

public static ArcInst newInstanceBase(ArcProto type,
                                      double baseWidth,
                                      PortInst head,
                                      PortInst tail,
                                      java.awt.geom.Point2D headPt,
                                      java.awt.geom.Point2D tailPt,
                                      java.lang.String name,
                                      int defAngle,
                                      int flags)
Method to create a new ArcInst connecting two PortInsts at specified locations. This is more general than the version that does not take coordinates.

Parameters:
type - the prototype of the new ArcInst.
baseWidth - the base width of the new ArcInst. The width must be > 0.
head - the head end PortInst.
tail - the tail end PortInst.
headPt - the coordinate of the head end PortInst.
tailPt - the coordinate of the tail end PortInst.
name - the name of the new ArcInst
defAngle - default angle in case port points coincide
flags - flags of thew new ArcInst
Returns:
the newly created ArcInst, or null if there is an error.

newInstance

public static ArcInst newInstance(Cell parent,
                                  ArcProto protoType,
                                  java.lang.String name,
                                  TextDescriptor nameDescriptor,
                                  PortInst headPort,
                                  PortInst tailPort,
                                  EPoint headPt,
                                  EPoint tailPt,
                                  long gridExtendOverMin,
                                  int angle,
                                  int flags)
Method to create a new ArcInst connecting two PortInsts at specified locations. This is more general than the version that does not take coordinates.

Parameters:
parent - the parent Cell of this ArcInst
protoType - the ArcProto of this ArcInst.
name - the name of this ArcInst
nameDescriptor - text descriptor of name of this ArcInst
headPort - the head end PortInst.
tailPort - the tail end PortInst.
headPt - the coordinate of the head end PortInst.
tailPt - the coordinate of the tail end PortInst.
gridExtendOverMin - the extend of this ArcInst over minimal-width arc of this type in grid units.
angle - angle in tenth-degrees.
flags - flag bits.
Returns:
the newly created ArcInst, or null if there is an error.

kill

public void kill()
Method to delete this ArcInst.


modify

public void modify(double dHeadX,
                   double dHeadY,
                   double dTailX,
                   double dTailY)
Method to change the width and end locations of this ArcInst.

Parameters:
dHeadX - the change to the X coordinate of the head of this ArcInst.
dHeadY - the change to the Y coordinate of the head of this ArcInst.
dTailX - the change to the X coordinate of the tail of this ArcInst.
dTailY - the change to the Y coordinate of the tail of this ArcInst.

setLambdaBaseWidth

public void setLambdaBaseWidth(double lambdaBaseWidth)
Method to change the width this ArcInst.

Parameters:
lambdaBaseWidth - new base width of the ArcInst in lambda units.

setGridBaseWidth

public void setGridBaseWidth(long gridBaseWidth)
Method to change the width this ArcInst.

Parameters:
gridBaseWidth - new base width of the ArcInst in lambda units.

replace

public ArcInst replace(ArcProto ap)
Method to replace this ArcInst with one of another type.

Parameters:
ap - the new type of arc.
Returns:
the new ArcInst (null on error).

getD

public ImmutableArcInst getD()
Returns persistent data of this ArcInst.

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

setD

public boolean setD(ImmutableArcInst newD,
                    boolean notify)
Modifies persistend data of this ArcInst.

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

setDInUndo

public void setDInUndo(ImmutableArcInst newD)

addVar

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

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

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.

delVar

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

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

lowLevelModify

public void lowLevelModify(ImmutableArcInst d)
Low-level method to change the width and end locations of this ArcInst. New persistent data may differ from old one only by width and end locations

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

getGridFullWidth

public long getGridFullWidth()
Method to return the full width of this ArcInst in grid units.

Returns:
the full width of this ArcInst in grid units.

getLambdaBaseWidth

public double getLambdaBaseWidth()
Method to return the base width of this ArcInst in lambda units.

Returns:
the base width of this ArcInst in lambda units.

getGridBaseWidth

public long getGridBaseWidth()
Method to return the base width of this ArcInst in grid units.

Returns:
the base width of this ArcInst in grid units.

getLambdaLength

public double getLambdaLength()
Method to return the length of this ArcInst in lambda units.

Returns:
the length of this ArcInst in lambda units.

getGridLength

public double getGridLength()
Method to return the length of this ArcInst in grid units.

Returns:
the length of this ArcInst in grid units.

isZeroLength

public boolean isZeroLength()
Returns true if length of this ArcInst is zero.

Returns:
true if length of this ArcInst is zero.

getAngle

public int getAngle()
Method to return the rotation angle of this ArcInst. This is an angle of direction from tailLocation to headLocation.

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

setAngle

public void setAngle(int angle)
Method to set the rotation angle of this ArcInst.

Parameters:
angle - the rotation angle of this ArcInst (in tenth-degrees). In general, you should not call this method because the constructors and modification methods update this correctly. If, however, you have a zero-length arc and want to explicitly set its angle, then use this method.

getShape

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

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

getBounds

public java.awt.geom.Rectangle2D getBounds()
Method to return the bounds of this ArcInst. 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 ArcInst.

redoGeometric

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


makeLambdaPoly

public Poly makeLambdaPoly(long gridWidth,
                           Poly.Type style)
Method to create a Poly object that describes an ArcInst in lambda units. The ArcInst is described by its width and style.

Parameters:
gridWidth - the width of the Poly in grid units.
style - the style of the ArcInst.
Returns:
a Poly that describes the ArcInst in lambda units.

curvedArcLambdaOutline

public Poly curvedArcLambdaOutline(Poly.Type style,
                                   long gridWidth,
                                   long gridRadius)
Method to fill polygon "poly" with the outline in lambda units of the curved arc in this ArcInst whose width in grid units is "gridWidth". The style of the polygon is set to "style". If there is no curvature information in the arc, the routine returns null, otherwise it returns the curved polygon.


numDisplayableVariables

public int numDisplayableVariables(boolean multipleStrings)
Method to return the number of displayable Variables on this ArcInst. A displayable Variable is one that will be shown with its object.

Overrides:
numDisplayableVariables in class ElectricObject
Returns:
the number of displayable Variables on this ArcInst.

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 Electric object to an array of Poly objects.

Overrides:
addDisplayableVariables in class ElectricObject
Parameters:
rect - a rectangle describing the bounds of the object 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 Variables that were added.

getDisplayableVariables

public Poly[] getDisplayableVariables(EditWindow0 wnd)
Method to get all displayable Variables on this ArcInst to an array of Poly objects.

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

getTail

public TailConnection getTail()
Method to return the Connection on the tail end of this ArcInst.

Returns:
the Connection on the tail end of this ArcInst.

getHead

public HeadConnection getHead()
Method to return the Connection on the head end of this ArcInst.

Returns:
the Connection on the head end of this ArcInst.

getConnection

public Connection getConnection(int connIndex)
Method to return the connection at an end of this ArcInst.

Parameters:
connIndex - TAILEND (0) for the tail of this ArcInst, HEADEND (1) for the head.

getTailPortInst

public PortInst getTailPortInst()
Method to return the PortInst on tail of this ArcInst.

Returns:
the PortInst on tail.

getHeadPortInst

public PortInst getHeadPortInst()
Method to return the PortInst on head of this ArcInst.

Returns:
the PortInst on head.

isConnected

public boolean isConnected(Geometric geom)
Method to tell whether this ArcInst 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.

getPortInst

public PortInst getPortInst(int connIndex)
Method to return the PortInst on an end of this ArcInst.

Parameters:
connIndex - TAILEND (0) for the tail of this ArcInst, HEADEND (1) for the head.
Returns:
the PortInst at an end.

getTailLocation

public EPoint getTailLocation()
Method to return the Location on tail of this ArcInst.

Returns:
the Location on tail.

getHeadLocation

public EPoint getHeadLocation()
Method to return the Location on head of this ArcInst.

Returns:
the Location on head.

getLocation

public EPoint getLocation(int connIndex)
Method to return the Location on an end of this ArcInst.

Parameters:
connIndex - TAILEND (0) for the tail of this ArcInst, HEADEND (1) for the head.
Returns:
the Location on an end.

tailStillInPort

public boolean tailStillInPort(java.awt.geom.Point2D pt,
                               boolean reduceForArc)
Method to tell whether a tail connection on this ArcInst contains a port location.

Parameters:
pt - the point in question.
reduceForArc - if true reduce width by width offset of it proto.
Returns:
true if the point is inside of the port.

headStillInPort

public boolean headStillInPort(java.awt.geom.Point2D pt,
                               boolean reduceForArc)
Method to tell whether a head connection on this ArcInst contains a port location.

Parameters:
pt - the point in question.
reduceForArc - if true reduce width by width offset of it proto.
Returns:
true if the point is inside of the port.

stillInPort

public boolean stillInPort(int connIndex,
                           java.awt.geom.Point2D pt,
                           boolean reduceForArc)
Method to tell whether a connection on this ArcInst contains a port location.

Parameters:
connIndex - TAILEND (0) for the tail of this ArcInst, HEADEND (1) for the head.
pt - the point in question.
reduceForArc - if true reduce width by width offset of it proto.
Returns:
true if the point is inside of the port.

getName

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

Returns:
the name of this ArcInst.

isUsernamed

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

Returns:
true if this ArcInst was named by user.

getNameKey

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

Returns:
the name key of this ArcInst, null if there is no name.

setName

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

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

getTextDescriptor

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

setTextDescriptor

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

isDeprecatedVariable

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

describe

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

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

compareTo

public int compareTo(ArcInst that)
Compares ArcInsts by their Cells and names.

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

toString

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

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

setRigid

public void setRigid(boolean state)
Method to set this ArcInst to be rigid. Rigid arcs cannot change length or the angle of their connection to a NodeInst.

Parameters:
state -

isRigid

public boolean isRigid()
Method to tell whether this ArcInst is rigid. Rigid arcs cannot change length or the angle of their connection to a NodeInst.

Returns:
true if this ArcInst is rigid.

setFixedAngle

public void setFixedAngle(boolean state)
Method to set this ArcInst to be fixed-angle. Fixed-angle arcs cannot change their angle, so if one end moves, the other may also adjust to keep the arc angle constant.

Parameters:
state -

isFixedAngle

public boolean isFixedAngle()
Method to tell whether this ArcInst is fixed-angle. Fixed-angle arcs cannot change their angle, so if one end moves, the other may also adjust to keep the arc angle constant.

Returns:
true if this ArcInst is fixed-angle.

setSlidable

public void setSlidable(boolean state)
Method to set this ArcInst to be slidable. Arcs that slide will not move their connected NodeInsts if the arc's end is still within the port area. Arcs that cannot slide will force their NodeInsts to move by the same amount as the arc. Rigid arcs cannot slide but nonrigid arcs use this state to make a decision.

Parameters:
state -

isSlidable

public boolean isSlidable()
Method to tell whether this ArcInst is slidable. Arcs that slide will not move their connected NodeInsts if the arc's end is still within the port area. Arcs that cannot slide will force their NodeInsts to move by the same amount as the arc. Rigid arcs cannot slide but nonrigid arcs use this state to make a decision.

Returns:
true if this ArcInst is slidable.

isArrowed

public boolean isArrowed(int connIndex)
Method to determine whether this ArcInst is directional, with an arrow on one end. Directional arcs have an arrow drawn on them to indicate flow. It is only for documentation purposes and does not affect the circuit.

Parameters:
connIndex - TAILEND (0) for the tail of this ArcInst, HEADEND (1) for the head.
Returns:
true if that end has a directional arrow on it.

isTailArrowed

public boolean isTailArrowed()
Method to determine whether this ArcInst is directional, with an arrow on the tail. Directional arcs have an arrow drawn on them to indicate flow. It is only for documentation purposes and does not affect the circuit.

Returns:
true if the arc's tail has a directional arrow on it.

isHeadArrowed

public boolean isHeadArrowed()
Method to determine whether this ArcInst is directional, with an arrow on the head. Directional arcs have an arrow drawn on them to indicate flow. It is only for documentation purposes and does not affect the circuit.

Returns:
true if the arc's head has a directional arrow on it.

isBodyArrowed

public boolean isBodyArrowed()
Method to determine whether this ArcInst is directional, with an arrow line drawn down the center. Directional arcs have an arrow drawn on them to indicate flow. It is only for documentation purposes and does not affect the circuit. The body is typically drawn when one of the ends has an arrow on it, but it may be drawin without an arrow head in order to continue an attached arc that has an arrow.

Returns:
true if the arc's tail has an arrow line on it.

setArrowed

public void setArrowed(int connIndex,
                       boolean state)
Method to set this ArcInst to be directional, with an arrow on one end. Directional arcs have an arrow drawn on them to indicate flow. It is only for documentation purposes and does not affect the circuit.

Parameters:
connIndex - TAILEND (0) for the tail of this ArcInst, HEADEND (1) for the head.
state - true to show a directional arrow on the specified end.

setTailArrowed

public void setTailArrowed(boolean state)
Method to set this ArcInst to be directional, with an arrow on the tail. Directional arcs have an arrow drawn on them to indicate flow. It is only for documentation purposes and does not affect the circuit.

Parameters:
state - true to show a directional arrow on the tail.

setHeadArrowed

public void setHeadArrowed(boolean state)
Method to set this ArcInst to be directional, with an arrow on the head. Directional arcs have an arrow drawn on them to indicate flow. It is only for documentation purposes and does not affect the circuit.

Parameters:
state - true to show a directional arrow on the head.

setBodyArrowed

public void setBodyArrowed(boolean state)
Method to set this ArcInst to be directional, with an arrow line drawn down the center. Directional arcs have an arrow drawn on them to indicate flow. It is only for documentation purposes and does not affect the circuit. The body is typically drawn when one of the ends has an arrow on it, but it may be drawin without an arrow head in order to continue an attached arc that has an arrow.

Parameters:
state - true to show a directional line on this arc.

isExtended

public boolean isExtended(int connIndex)
Method to tell whether an end of ArcInst has its ends extended. Extended arcs continue past their endpoint by half of their width. Most layout arcs want this so that they make clean connections to orthogonal arcs.

Parameters:
connIndex - TAILEND (0) for the tail of this ArcInst, HEADEND (1) for the head.
Returns:
true if that end of this ArcInst iss extended.

isTailExtended

public boolean isTailExtended()
Method to tell whether the tail of this arc is extended. Extended arcs continue past their endpoint by half of their width. Most layout arcs want this so that they make clean connections to orthogonal arcs.

Returns:
true if the tail of this arc is extended.

isHeadExtended

public boolean isHeadExtended()
Method to tell whether the head of this arc is extended. Extended arcs continue past their endpoint by half of their width. Most layout arcs want this so that they make clean connections to orthogonal arcs.

Returns:
true if the head of this arc is extended.

setExtended

public void setExtended(int connIndex,
                        boolean e)
Method to set whether an end of this arc is extended. Extended arcs continue past their endpoint by half of their width. Most layout arcs want this so that they make clean connections to orthogonal arcs.

Parameters:
connIndex - TAILEND (0) for the tail of this ArcInst, HEADEND (1) for the head.
e - true to set that end of this arc to be extended.

setTailExtended

public void setTailExtended(boolean e)
Method to set whether the tail of this arc is extended. Extended arcs continue past their endpoint by half of their width. Most layout arcs want this so that they make clean connections to orthogonal arcs.

Parameters:
e - true to set the tail of this arc to be extended.

setHeadExtended

public void setHeadExtended(boolean e)
Method to set whether the head of this arc is extended. Extended arcs continue past their endpoint by half of their width. Most layout arcs want this so that they make clean connections to orthogonal arcs.

Parameters:
e - true to set the head of this arc to be extended.

isNegated

public boolean isNegated(int connIndex)
Method to tell whether an end of this arc is negated. Negated arc have a negating bubble on them to indicate negation. This is only valid in schematics technologies.

Parameters:
connIndex - TAILEND (0) for the tail of this ArcInst, HEADEND (1) for the head.
Returns:
true if set that end of this arc is negated.

isTailNegated

public boolean isTailNegated()
Method to tell whether the tail of this arc is negated. Negated arc have a negating bubble on them to indicate negation. This is only valid in schematics technologies.

Returns:
true if set the tail of this arc is negated.

isHeadNegated

public boolean isHeadNegated()
Method to tell whether the head of this arc is negated. Negated arc have a negating bubble on them to indicate negation. This is only valid in schematics technologies.

Returns:
true if set the head of this arc is negated.

setNegated

public void setNegated(int connIndex,
                       boolean n)
Method to set whether an end of this arc is negated. Negated arc have a negating bubble on them to indicate negation. This is only valid in schematics technologies.

Parameters:
connIndex - TAILEND (0) for the tail of this ArcInst, HEADEND (1) for the head.
n - true to set that end of this arc to be negated.

setTailNegated

public void setTailNegated(boolean n)
Method to set whether the tail of this arc is negated. Negated arc have a negating bubble on them to indicate negation. This is only valid in schematics technologies.

Parameters:
n - true to set the tail of this arc to be negated.

setHeadNegated

public void setHeadNegated(boolean n)
Method to set whether the head of this arc is negated. Negated arc have a negating bubble on them to indicate negation. This is only valid in schematics technologies.

Parameters:
n - true to set the head of this arc to be negated.

checkAndRepair

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


check

public void check(Poly.Builder polyBuilder)
Method to check invariants in this ArcInst.

Throws:
java.lang.AssertionError - if invariants are not valid

getArcId

public final int getArcId()
Method to get the arcId of this ArcInst. The arcId is assign to ArcInst in chronological order The arcId doesn't relate to alpahnumeric ordering of arcs in the Cell.

Returns:
the index of this ArcInst.

isLinked

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

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

getProto

public ArcProto getProto()
Method to return the prototype of this ArcInst.

Returns:
the prototype of this ArcInst.

copyPropertiesFrom

public void copyPropertiesFrom(ArcInst fromAi)
Copies all properties (variables, constraints, and textdescriptor) from 'fraomAi' to this arcinst. This is basically the same as calling copyVarsFrom(), copyConstraintsFrom(), and setTextDescriptor().

Parameters:
fromAi - the arc from which to copy all arc properties

copyConstraintsFrom

public void copyConstraintsFrom(ArcInst fromAi)
Copies constraints (Rigid, Ends Extended, etc) from another arcinst to this arcinst It copies also attributes of Connections (arrow/negated/extended)

Parameters:
fromAi - the arcinst from which to copy constraints

setHardSelect

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

Parameters:
state -

isHardSelect

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

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

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 ArcInst

cropPerLayer

public Poly cropPerLayer(Poly poly)
Method to crop given polygon against a connecting transistor. Function similar to Quick.cropActiveArc

Parameters:
poly -
Returns:
new polygon if was cropped otherwise the original

isDiffusionArc

public boolean isDiffusionArc()
Method to determin if arc contains active diffusion

Returns:
True if contains active diffusion