com.sun.electric.technology
Class ArcProto

java.lang.Object
  extended by com.sun.electric.technology.ArcProto
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<ArcProto>

public class ArcProto
extends java.lang.Object
implements java.lang.Comparable<ArcProto>, java.io.Serializable

The ArcProto class defines a type of ArcInst.

Every arc in the database appears as one prototypical object and many instantiative objects. Thus, for a ArcProto such as the CMOS Metal-1 there is one object (called a ArcProto) that describes the wire prototype and there are many objects (called ArcInsts), one for every instance of a Metal-1 wire that appears in a circuit. ArcProtos are statically created and placed in the Technology objects.

The basic ArcProto has a name, default width, function, Layers that describes it graphically and more.

See Also:
Serialized Form

Nested Class Summary
static class ArcProto.Function
          Function is a typesafe enum class that describes the function of an ArcProto.
 
Method Summary
 void clearCurvable()
          Method to set this ArcProto so that instances of it cannot curve.
 void clearEdgeSelect()
          Method to set this ArcProto so that instances of it cannot be selected by their edge.
 void clearWipable()
          Method to set this ArcProto so that instances of it cannot wipe nodes.
 int compareTo(ArcProto that)
          Compares ArcProtos by their Technologies and definition order.
 java.lang.String describe()
          Method to describe this ArcProto as a string.
static ArcProto findArcProto(java.lang.String line)
          Method to find the ArcProto with the given name.
 PrimitiveNode findOverridablePinProto(EditingPreferences ep)
          Method to find the PrimitiveNode pin corresponding to this ArcProto type.
 PrimitiveNode findPinProto()
          Method to find the PrimitiveNode pin corresponding to this ArcProto type.
 int getAngleIncrement(EditingPreferences ep)
          Method to get the angle increment on this ArcProto.
 Technology.ArcLayer[] getArcLayers()
          Method to return the list of ArcLayers that comprise this ArcProto..
 long getDefaultGridBaseWidth(EditingPreferences ep)
          Method to return the default base width of this ArcProto in grid units.
 ImmutableArcInst getDefaultInst(EditingPreferences ep)
          Method to return the default immutable instance of this PrimitiveNode in specified EditingPreferences.
 double getDefaultLambdaBaseWidth()
          Method to return the default base width of this ArcProto in lambda units.
 double getDefaultLambdaBaseWidth(EditingPreferences ep)
          Method to return the default base width of this ArcProto in lambda units.
 int getFactoryAngleIncrement()
          Method to get the default angle increment on this ArcProto.
 double getFactoryAntennaRatio()
          Method to tell the default antenna ratio of this ArcProto.
 long getFactoryDefaultGridBaseWidth()
          Method to return the factory default base width of this ArcProto in grid units.
 ImmutableArcInst getFactoryDefaultInst()
          Method to return the factory default immutable instance of this PrimitiveNode
 double getFactoryDefaultLambdaBaseWidth()
          Method to return the factory default base width of this ArcProto in lambda units.
 java.lang.String getFullName()
          Method to return the full name of this ArcProto.
 ArcProto.Function getFunction()
          Method to return the function of this ArcProto.
 int getGridBaseExtend()
          Method to return the base width extend of this ArcProto in grid units.
 ArcProtoId getId()
          Method to return the Id of this ArcProto.
 double getLambdaBaseExtend()
          Method to return the base width extend of this ArcProto in lambda units.
 double getLambdaElibWidthOffset()
          Method to return the width offset of this ArcProto in lambda units.
 Layer getLayer(int arcLayerIndex)
          Method to return layer that comprises by its index in all layers
 int getLayerGridExtend(int arcLayerIndex)
          Returns the extend of specified layer that comprise this ArcProto over base arc width in grid units.
 long getLayerGridExtend(Layer layer)
          Returns the extend of specified layer that comprise this ArcProto over base arc width in grid units.
 java.util.Iterator<Layer> getLayerIterator()
          Method to return an iterator over the layers in this ArcProto.
 double getLayerLambdaExtend(int arcLayerIndex)
          Returns the extend of specified layer that comprise this ArcProto over base arc width in lambda units.
 double getLayerLambdaExtend(Layer layer)
          Returns the extend of specified layer that comprise this ArcProto over base arc width in lambda units.
 Poly.Type getLayerStyle(int arcLayerIndex)
          Returns the Poly.Style of specified layer that comprise this ArcLayer.
 Poly.Type getLayerStyle(Layer layer)
          Returns the Poly.Style of specified layer that comprise this ArcLayer.
 int getMaxLayerGridExtend()
          Method to return the maximal layer extend of this ArcProto in grid units.
 int getMinLayerGridExtend()
          Method to return the minimal layer extend of this ArcProto in grid units.
 java.lang.String getName()
          Method to return the name of this ArcProto.
 int getNumArcLayers()
          Method to return the number of layers that comprise this ArcProto.
 Poly[] getShapeOfDummyArc(double lambdaLength)
          Returns the polygons that describe dummy arc of this ArcProto with default width and specified length.
 Technology getTechnology()
          Method to return the Technology of this ArcProto.
 void getZValues(double[] array)
          Method to get MinZ and MaxZ of this ArcProto
 int indexOf(Layer layer)
          Method to find an index of Layer in a list of Layers that comprise this ArcProto.
 boolean isCurvable()
          Method to tell if instances of this ArcProto can curve.
 boolean isEdgeSelect()
          Method to tell if instances of this ArcProto can be selected by their edge.
 boolean isNotUsed()
          Method to tell if this ArcProto is used.
 boolean isSkipSizeInPalette()
          Method to tell if instaces of this ArcProto are special (don't appear in menu).
 boolean isSpecialArc()
          Method to tell if instaces of this ArcProto are special (don't appear in menu).
 boolean isWipable()
          Method to tell if instances of this ArcProto can wipe nodes.
 PrimitiveNode makeWipablePin(java.lang.String pinName, java.lang.String portName, double defSize, ArcProto... extraArcs)
           
 void setCurvable()
          Method to set this ArcProto so that instances of it can curve.
 void setEdgeSelect()
          Method to set this ArcProto so that instances of it can be selected by their edge.
 void setFactoryAngleIncrement(int angle)
          Method to set the factory-default angle of this ArcProto.
 void setFactoryAntennaRatio(double ratio)
          Method to set the factory antenna ratio of this ArcProto.
 void setFactoryExtended(boolean extended)
          Method to set the "factory default" end-extension state of this ArcProto.
 void setFactoryFixedAngle(boolean fixed)
          Method to set the "factory default" fixed-angle state of this ArcProto.
 void setFactoryRigid(boolean rigid)
          Method to set the "factory default" rigid state of this ArcProto.
 void setFactorySlidable(boolean slidable)
          Method to set the "factory default" slidability state of this ArcProto.
 void setNotUsed(boolean set)
          Method to set this ArcProto so that it is not used.
 void setSkipSizeInPalette()
          Method to allow instances of this ArcProto not to be considered in tech palette for the calculation of the largest icon.
 void setSpecialArc()
          Method to allow instances of this ArcProto to be special in menu.
 void setWipable()
          Method to set this ArcProto so that instances of it can wipe nodes.
 java.lang.String toString()
          Returns a printable version of this ArcProto.
protected  java.lang.Object writeReplace()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

writeReplace

protected java.lang.Object writeReplace()

getId

public ArcProtoId getId()
Method to return the Id of this ArcProto.

Returns:
the Id of this ArcProto.

getName

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

Returns:
the name of this ArcProto.

getFullName

public java.lang.String getFullName()
Method to return the full name of this ArcProto. Full name has format "techName:primName"

Returns:
the full name of this ArcProto.

getTechnology

public Technology getTechnology()
Method to return the Technology of this ArcProto.

Returns:
the Technology of this ArcProto.

getDefaultLambdaBaseWidth

public double getDefaultLambdaBaseWidth()
Method to return the default base width of this ArcProto in lambda units. This is the reported/selected width, which means that it does not include the width offset. For example, diffusion arcs are always accompanied by a surrounding well and select. This call returns only the width of the diffusion.

Returns:
the default base width of this ArcProto in lambda units.

getDefaultLambdaBaseWidth

public double getDefaultLambdaBaseWidth(EditingPreferences ep)
Method to return the default base width of this ArcProto in lambda units. This is the reported/selected width, which means that it does not include the width offset. For example, diffusion arcs are always accompanied by a surrounding well and select. This call returns only the width of the diffusion.

Parameters:
ep - EditingPreferences
Returns:
the default base width of this ArcProto in lambda units.

getFactoryDefaultLambdaBaseWidth

public double getFactoryDefaultLambdaBaseWidth()
Method to return the factory default base width of this ArcProto in lambda units. This is the reported/selected width, which means that it does not include the width offset. For example, diffusion arcs are always accompanied by a surrounding well and select. This call returns only the width of the diffusion.

Returns:
the factory default base width of this ArcProto in lambda units.

getDefaultGridBaseWidth

public long getDefaultGridBaseWidth(EditingPreferences ep)
Method to return the default base width of this ArcProto in grid units. This is the reported/selected width, which means that it does not include the width offset. For example, diffusion arcs are always accompanied by a surrounding well and select. This call returns only the width of the diffusion.

Parameters:
ep - EditingPreferences
Returns:
the default base width of this ArcProto in grid units.

getFactoryDefaultGridBaseWidth

public long getFactoryDefaultGridBaseWidth()
Method to return the factory default base width of this ArcProto in grid units. This is the reported/selected width, which means that it does not include the width offset. For example, diffusion arcs are always accompanied by a surrounding well and select. This call returns only the width of the diffusion.

Returns:
the factory default base width of this ArcProto in grid units.

getDefaultInst

public ImmutableArcInst getDefaultInst(EditingPreferences ep)
Method to return the default immutable instance of this PrimitiveNode in specified EditingPreferences.

Parameters:
ep - specified EditingPreferences
Returns:
the default immutable instance of this PrimitiveNode

getFactoryDefaultInst

public ImmutableArcInst getFactoryDefaultInst()
Method to return the factory default immutable instance of this PrimitiveNode

Returns:
the factory default immutable instance of this PrimitiveNode

getLambdaBaseExtend

public double getLambdaBaseExtend()
Method to return the base width extend of this ArcProto in lambda units. This is the reported/selected width. For example, diffusion arcs are always accompanied by a surrounding well and select. This call returns only the half width of the diffusion of minimal-width arc.

Returns:
the default base width extend of this ArcProto in lambda units.

getGridBaseExtend

public int getGridBaseExtend()
Method to return the base width extend of this ArcProto in grid units. This is the reported/selected width. For example, diffusion arcs are always accompanied by a surrounding well and select. This call returns only the half width of the diffusion of minimal-width arc.

Returns:
the default base width extend of this ArcProto in grid units.

getLambdaElibWidthOffset

public double getLambdaElibWidthOffset()
Method to return the width offset of this ArcProto in lambda units. The width offset excludes the surrounding implang material. For example, diffusion arcs are always accompanied by a surrounding well and select. The offset amount is the difference between the diffusion width and the overall width.

Returns:
the width offset of this ArcProto in lambda units.

getMinLayerGridExtend

public int getMinLayerGridExtend()
Method to return the minimal layer extend of this ArcProto in grid units.

Returns:
the minimal layer extend of this ArcProto in grid units.

getMaxLayerGridExtend

public int getMaxLayerGridExtend()
Method to return the maximal layer extend of this ArcProto in grid units.

Returns:
the maximal layer extend of this ArcProto in grid units.

setFactoryAntennaRatio

public void setFactoryAntennaRatio(double ratio)
Method to set the factory antenna ratio of this ArcProto. Antenna ratios are used in antenna checks that make sure the ratio of the area of a layer is correct.

Parameters:
ratio - the antenna ratio of this ArcProto.

getFactoryAntennaRatio

public double getFactoryAntennaRatio()
Method to tell the default antenna ratio of this ArcProto. Antenna ratios are used in antenna checks that make sure the ratio of the area of a layer is correct.

Returns:
the default antenna ratio of this ArcProto.

setFactoryRigid

public void setFactoryRigid(boolean rigid)
Method to set the "factory default" rigid state of this ArcProto. Rigid arcs cannot change length or the angle of their connection to a NodeInst.

Parameters:
rigid - true if this ArcProto should be rigid by factory-default.

setFactoryFixedAngle

public void setFactoryFixedAngle(boolean fixed)
Method to set the "factory default" fixed-angle state of this ArcProto. Fixed-angle arcs cannot change their angle, so if one end moves, the other may also adjust to keep the arc angle constant.

Parameters:
fixed - true if this ArcProto should be fixed-angle by factory-default.

setFactorySlidable

public void setFactorySlidable(boolean slidable)
Method to set the "factory default" slidability state of this ArcProto. 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:
slidable - true if this ArcProto should be slidability by factory-default.

setFactoryExtended

public void setFactoryExtended(boolean extended)
Method to set the "factory default" end-extension state of this ArcProto. End-extension causes an arc to extend past its endpoint by half of its width. Most layout arcs want this so that they make clean connections to orthogonal arcs.

Parameters:
extended - true if this ArcProto should be end-extended by factory-default.

setNotUsed

public void setNotUsed(boolean set)
Method to set this ArcProto so that it is not used. Unused arcs do not appear in the component menus and cannot be created by the user. The state is useful for hiding arcs that the user should not use.

Parameters:
set -

isNotUsed

public boolean isNotUsed()
Method to tell if this ArcProto is used. Unused arcs do not appear in the component menus and cannot be created by the user. The state is useful for hiding arcs that the user should not use.

Returns:
true if this ArcProto is used.

setSkipSizeInPalette

public void setSkipSizeInPalette()
Method to allow instances of this ArcProto not to be considered in tech palette for the calculation of the largest icon. Valid for menu display


isSkipSizeInPalette

public boolean isSkipSizeInPalette()
Method to tell if instaces of this ArcProto are special (don't appear in menu). Valid for menu display


setWipable

public void setWipable()
Method to set this ArcProto so that instances of it can wipe nodes. For display efficiency reasons, pins that have arcs connected to them should not bother being drawn. Those arc prototypes that can erase their connecting pins have this state set, and when instances of these arcs connect to the pins, those pins stop being drawn. It is necessary for the pin node prototype to enable wiping (with setArcsWipe). A NodeInst that becomes wiped out has "setWiped" called.


clearWipable

public void clearWipable()
Method to set this ArcProto so that instances of it cannot wipe nodes. For display efficiency reasons, pins that have arcs connected to them should not bother being drawn. Those arc prototypes that can erase their connecting pins have this state set, and when instances of these arcs connect to the pins, those pins stop being drawn. It is necessary for the pin node prototype to enable wiping (with setArcsWipe). A NodeInst that becomes wiped out has "setWiped" called.


isWipable

public boolean isWipable()
Method to tell if instances of this ArcProto can wipe nodes. For display efficiency reasons, pins that have arcs connected to them should not bother being drawn. Those arc prototypes that can erase their connecting pins have this state set, and when instances of these arcs connect to the pins, those pins stop being drawn. It is necessary for the pin node prototype to enable wiping (with setArcsWipe). A NodeInst that becomes wiped out has "setWiped" called.

Returns:
true if instances of this ArcProto can wipe nodes.

setCurvable

public void setCurvable()
Method to set this ArcProto so that instances of it can curve. Since arc curvature is complex to draw, arcs with this capability must be marked this way. A curved arc has the variable "arc_radius" on it with a curvature factor.


clearCurvable

public void clearCurvable()
Method to set this ArcProto so that instances of it cannot curve. Since arc curvature is complex to draw, arcs with this capability must be marked this way. A curved arc has the variable "arc_radius" on it with a curvature factor.


isCurvable

public boolean isCurvable()
Method to tell if instances of this ArcProto can curve. Since arc curvature is complex to draw, arcs with this capability must be marked this way. A curved arc has the variable "arc_radius" on it with a curvature factor.

Returns:
true if instances of this ArcProto can curve.

setEdgeSelect

public void setEdgeSelect()
Method to set this ArcProto so that instances of it can be selected by their edge. Artwork primitives that are not filled-in or are outlines want edge-selection, instead of allowing a click anywhere in the bounding box to work.


clearEdgeSelect

public void clearEdgeSelect()
Method to set this ArcProto so that instances of it cannot be selected by their edge. Artwork primitives that are not filled-in or are outlines want edge-selection, instead of allowing a click anywhere in the bounding box to work.


isEdgeSelect

public boolean isEdgeSelect()
Method to tell if instances of this ArcProto can be selected by their edge. Artwork primitives that are not filled-in or are outlines want edge-selection, instead of allowing a click anywhere in the bounding box to work.

Returns:
true if instances of this ArcProto can be selected by their edge.

setSpecialArc

public void setSpecialArc()
Method to allow instances of this ArcProto to be special in menu. Valid for menu display


isSpecialArc

public boolean isSpecialArc()
Method to tell if instaces of this ArcProto are special (don't appear in menu). Valid for menu display


getFunction

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

Returns:
function the function of this ArcProto.

setFactoryAngleIncrement

public void setFactoryAngleIncrement(int angle)
Method to set the factory-default angle of this ArcProto. This is only called from ArcProto during construction.

Parameters:
angle - the factory-default angle of this ArcProto.

getAngleIncrement

public int getAngleIncrement(EditingPreferences ep)
Method to get the angle increment on this ArcProto. The angle increment is the granularity on placement angle for instances of this ArcProto. It is in degrees. For example, a value of 90 requests that instances run at 0, 90, 180, or 270 degrees. A value of 0 allows arcs to be created at any angle.

Parameters:
ep - editing preferences with default increment
Returns:
the angle increment on this ArcProto.

getFactoryAngleIncrement

public int getFactoryAngleIncrement()
Method to get the default angle increment on this ArcProto. The angle increment is the granularity on placement angle for instances of this ArcProto. It is in degrees. For example, a value of 90 requests that instances run at 0, 90, 180, or 270 degrees. A value of 0 allows arcs to be created at any angle.

Returns:
the default angle increment on this ArcProto.

findOverridablePinProto

public PrimitiveNode findOverridablePinProto(EditingPreferences ep)
Method to find the PrimitiveNode pin corresponding to this ArcProto type. Users can override the pin to use, and this method returns the user setting. For example, if this ArcProto is metal-1 then return the Metal-1-pin, but the user could set it to Metal-1-Metal-2-Contact.

Parameters:
ep - editing preferences with user overrides
Returns:
the PrimitiveNode pin to use for arc bends.

findPinProto

public PrimitiveNode findPinProto()
Method to find the PrimitiveNode pin corresponding to this ArcProto type. For example, if this ArcProto is metal-1 then return the Metal-1-pin.

Returns:
the PrimitiveNode pin to use for arc bends.

makeWipablePin

public PrimitiveNode makeWipablePin(java.lang.String pinName,
                                    java.lang.String portName,
                                    double defSize,
                                    ArcProto... extraArcs)

findArcProto

public static ArcProto findArcProto(java.lang.String line)
Method to find the ArcProto with the given name. This can be prefixed by a Technology name.

Parameters:
line - the name of the ArcProto.
Returns:
the specified ArcProto, or null if none can be found.

getNumArcLayers

public int getNumArcLayers()
Method to return the number of layers that comprise this ArcProto.

Returns:
the number of layers that comprise this ArcProto.

getArcLayers

public Technology.ArcLayer[] getArcLayers()
Method to return the list of ArcLayers that comprise this ArcProto..

Returns:
the list of ArcLayers that comprise this ArcProto.

getLayer

public Layer getLayer(int arcLayerIndex)
Method to return layer that comprises by its index in all layers

Parameters:
arcLayerIndex - layer index
Returns:
specified layer that comprises this ArcProto.

getLayerLambdaExtend

public double getLayerLambdaExtend(int arcLayerIndex)
Returns the extend of specified layer that comprise this ArcProto over base arc width in lambda units.

Parameters:
arcLayerIndex - layer index
Returns:
the extend of specified layer that comprise this ArcProto over base arc width in lambda units.

getLayerGridExtend

public int getLayerGridExtend(int arcLayerIndex)
Returns the extend of specified layer that comprise this ArcProto over base arc width in grid units.

Parameters:
arcLayerIndex - layer index
Returns:
the extend of specified layer that comprise this ArcProto over base arc width in grid units.

getLayerStyle

public Poly.Type getLayerStyle(int arcLayerIndex)
Returns the Poly.Style of specified layer that comprise this ArcLayer.

Parameters:
arcLayerIndex - layer index
Returns:
the Poly.Style of specified layer that comprise this ArcLayer.

getLayerLambdaExtend

public double getLayerLambdaExtend(Layer layer)
Returns the extend of specified layer that comprise this ArcProto over base arc width in lambda units.

Parameters:
layer - specified Layer
Returns:
the extend of specified layer that comprise this ArcProto over base arc width in lambda units.
Throws:
java.lang.IndexOutOfBoundsException - when specified layer diesn't comprise this ArcProto

getLayerGridExtend

public long getLayerGridExtend(Layer layer)
Returns the extend of specified layer that comprise this ArcProto over base arc width in grid units.

Parameters:
layer - specified Layer
Returns:
the extend of specified layer that comprise this ArcProto over base arc width in grid units.
Throws:
java.lang.IndexOutOfBoundsException - when specified layer diesn't comprise this ArcProto

getLayerStyle

public Poly.Type getLayerStyle(Layer layer)
Returns the Poly.Style of specified layer that comprise this ArcLayer.

Parameters:
layer - specified Layer
Returns:
the Poly.Style of specified layer that comprise this ArcLayer.
Throws:
java.lang.IndexOutOfBoundsException - when specified layer diesn't comprise this ArcProto

getLayerIterator

public java.util.Iterator<Layer> getLayerIterator()
Method to return an iterator over the layers in this ArcProto.

Returns:
an iterator over the layers in this ArcProto.

indexOf

public int indexOf(Layer layer)
Method to find an index of Layer in a list of Layers that comprise this ArcProto. If this layer is not in the list, return -1

Parameters:
layer - the Layer to find.
Returns:
an index of Layer in a list of Layers that comprise this ArcProto, or -1.

getZValues

public void getZValues(double[] array)
Method to get MinZ and MaxZ of this ArcProto

Parameters:
array - array[0] is minZ and array[1] is max

getShapeOfDummyArc

public Poly[] getShapeOfDummyArc(double lambdaLength)
Returns the polygons that describe dummy arc of this ArcProto with default width and specified length.

Parameters:
lambdaLength - length of dummy arc in lambda units.
Returns:
an array of Poly objects that describes dummy arc graphically.

describe

public java.lang.String describe()
Method to describe this ArcProto as a string. Prepends the Technology name if it is not from the current technology (for example, "mocmos:Polysilicon-1").

Returns:
a String describing this ArcProto.

compareTo

public int compareTo(ArcProto that)
Compares ArcProtos by their Technologies and definition order.

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

toString

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

Overrides:
toString in class java.lang.Object
Returns:
a printable version of this ArcProto.