com.sun.electric.database
Class ImmutableNodeInst

java.lang.Object
  extended by com.sun.electric.database.ImmutableElectricObject
      extended by com.sun.electric.database.ImmutableNodeInst
Direct Known Subclasses:
ImmutableIconInst

public class ImmutableNodeInst
extends ImmutableElectricObject

Immutable class ImmutableNodeInst represents a node instance.


Nested Class Summary
static class ImmutableNodeInst.Flag
          Class to access user bits of ImmutableNodeInst.
 
Field Summary
 EPoint anchor
          anchor coordinate of this ImmutableNodeInst.
static ImmutableArrayList<ImmutableNodeInst> EMPTY_LIST
           
static ImmutableNodeInst.Flag HARD_SELECT
          Method to set an ImmutableNodeInst to be hard-to-select.
static ImmutableNodeInst.Flag LOCKED
          Method to set this ImmutableNodeInst to be locked.
 Name name
          name of this ImmutableNodeInst.
 TextDescriptor nameDescriptor
          The text descriptor of name of ImmutableNodeInst.
 int nodeId
          id of this NodeInst in parent.
static ImmutableNodeInst[] NULL_ARRAY
           
 Orientation orient
          Orientation of this ImmutableNodeInst.
 TextDescriptor protoDescriptor
          Text descriptor of prototype name.
 NodeProtoId protoId
          Prototype id.
 EPoint size
          size of this ImmutableNodeInst.
 byte techBits
          Tech specifiic bits for this ImmutableNodeInsts.
static ImmutableNodeInst.Flag VIS_INSIDE
          Flag to set an ImmutableNodeInst to be visible-inside.
 
Fields inherited from class com.sun.electric.database.ImmutableElectricObject
flags
 
Method Summary
 void check()
          Checks invariant of this ImmutableNodeInst.
 void computeBounds(NodeInst real, java.awt.geom.Rectangle2D.Double dstBounds)
           
 boolean equalsExceptVariables(ImmutableElectricObject o)
          Indicates whether fields of other ImmutableElectricObject are equal to fileds of this object.
static int flagsFromElib(int elibBits)
          Get flag bits from ELIB user bits.
 int getElibBits()
          Returns ELIB user bits of this ImmutableNodeInst in ELIB.
 ImmutablePortInst getPortInst(PortProtoId portProtoId)
          Returns ImmutablePortInst of this ImmutableNodeInst with the specified PortProtoId.
 java.util.Iterator<PortProtoId> getPortsWithVariables()
          Returns an Iterator over all PortProtoIds such that the correspondent PortInst on this ImmutablePortInst has variables.
 double getSerpentineTransistorLength()
          Method to return the length of this serpentine transistor.
 EPoint[] getTrace()
          Method to return the "outline" information on this ImmutableNodeInst.
 int hashCodeExceptVariables()
          Return a hash code value for fields of this object.
 boolean hasPortInstVariables()
          Returns true if this ImmutableNodeInst has variables on port instances.
 boolean is(ImmutableNodeInst.Flag flag)
          Tests specific flag is set on this ImmutableNodeInst.
static boolean isCellCenter(NodeProtoId protoId)
           
 boolean isUsernamed()
          Retruns true if this ImmutableNodeInst was named by user.
static ImmutableNodeInst newInstance(int nodeId, NodeProtoId protoId, Name name, TextDescriptor nameDescriptor, Orientation orient, EPoint anchor, EPoint size, int flags, int techBits, TextDescriptor protoDescriptor)
          Returns new ImmutableNodeInst or ImmutableIconInst object.
static int techSpecificFromElib(int elibBits)
          Get tech specific bits from ELIB user bits.
 ImmutableNodeInst withAnchor(EPoint anchor)
          Returns ImmutableNodeInst which differs from this ImmutableNodeInst by anchor point.
 ImmutableNodeInst withFlag(ImmutableNodeInst.Flag flag, boolean value)
          Returns ImmutableNodeInst which differs from this ImmutableNodeInst by flag bit.
 ImmutableNodeInst withName(Name name)
          Returns ImmutableNodeInst which differs from this ImmutableNodeInst by name.
 ImmutableNodeInst withNameDescriptor(TextDescriptor nameDescriptor)
          Returns ImmutableNodeInst which differs from this ImmutableNodeInst by name descriptor.
 ImmutableNodeInst withOrient(Orientation orient)
          Returns ImmutableNodeInst which differs from this ImmutableNodeInst by orientation.
 ImmutableNodeInst withoutVariable(Variable.Key key)
          Returns ImmutableNodeInst which differs from this ImmutableNodeInst by removing Variable with the specified key.
 ImmutableNodeInst withPortInst(PortProtoId portProtoId, ImmutablePortInst portInst)
          Returns ImmutableNodeInst which differs from this ImmutableNodeInst by additional Variable on PortInst.
 ImmutableNodeInst withProtoDescriptor(TextDescriptor protoDescriptor)
          Returns ImmutableNodeInst which differs from this ImmutableNodeInst by proto descriptor.
 ImmutableNodeInst withSize(EPoint size)
          Returns ImmutableNodeInst which differs from this ImmutableNodeInst by size.
 ImmutableNodeInst withStateBits(ImmutableNodeInst d)
          Returns ImmutableNodeInst which differs from this ImmutableNodeInst by state bits.
 ImmutableNodeInst withTechSpecific(int techBits)
          Returns ImmutableNodeInst which differs from this ImmutableNodeInst by tech specific bits.
 ImmutableNodeInst withVariable(Variable var)
          Returns ImmutableNodeInst which differs from this ImmutableNodeInst by additional Variable.
 
Methods inherited from class com.sun.electric.database.ImmutableElectricObject
getNumVariables, getVar, getVar, getVariables, getVarValue, searchVar, toVariableArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HARD_SELECT

public static final ImmutableNodeInst.Flag HARD_SELECT
Method to set an ImmutableNodeInst to be hard-to-select. Hard-to-select ImmutableNodeInsts cannot be selected by clicking on them. Instead, the "special select" command must be given.


VIS_INSIDE

public static final ImmutableNodeInst.Flag VIS_INSIDE
Flag to set an ImmutableNodeInst to be visible-inside. An ImmutableNodeInst 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).


LOCKED

public static final ImmutableNodeInst.Flag LOCKED
Method to set this ImmutableNodeInst to be locked. Locked ImmutableNodeInsts cannot be modified or deleted.


NULL_ARRAY

public static final ImmutableNodeInst[] NULL_ARRAY

EMPTY_LIST

public static final ImmutableArrayList<ImmutableNodeInst> EMPTY_LIST

nodeId

public final int nodeId
id of this NodeInst in parent.


protoId

public final NodeProtoId protoId
Prototype id.


name

public final Name name
name of this ImmutableNodeInst.


nameDescriptor

public final TextDescriptor nameDescriptor
The text descriptor of name of ImmutableNodeInst.


orient

public final Orientation orient
Orientation of this ImmutableNodeInst.


anchor

public final EPoint anchor
anchor coordinate of this ImmutableNodeInst.


size

public final EPoint size
size of this ImmutableNodeInst.


techBits

public final byte techBits
Tech specifiic bits for this ImmutableNodeInsts.


protoDescriptor

public final TextDescriptor protoDescriptor
Text descriptor of prototype name.

Method Detail

newInstance

public static ImmutableNodeInst newInstance(int nodeId,
                                            NodeProtoId protoId,
                                            Name name,
                                            TextDescriptor nameDescriptor,
                                            Orientation orient,
                                            EPoint anchor,
                                            EPoint size,
                                            int flags,
                                            int techBits,
                                            TextDescriptor protoDescriptor)
Returns new ImmutableNodeInst or ImmutableIconInst object.

Parameters:
nodeId - id of this NodeInst in parent.
protoId - the NodeProtoId of which this is an instance.
name - name of new ImmutableNodeInst.
nameDescriptor - TextDescriptor of name of this ImmutableNodeInst.
orient - Orientation of this ImmutableNodeInst.
anchor - the anchor location of this ImmutableNodeInst.
size - the size of this ImmutableNodeInst.
flags - flags of this NodeInst.
techBits - bits associated to different technologies
protoDescriptor - TextDescriptor of name of this ImmutableNodeInst
Returns:
new ImmutableNodeInst object.
Throws:
java.lang.NullPointerException - if protoId, name, orient or anchor is null.
java.lang.IllegalArgumentException - if nodeId or size is bad.

withName

public ImmutableNodeInst withName(Name name)
Returns ImmutableNodeInst which differs from this ImmutableNodeInst by name.

Parameters:
name - node name key.
Returns:
ImmutableNodeInst which differs from this ImmutableNodeInst by name.
Throws:
java.lang.NullPointerException - if name is null.

withNameDescriptor

public ImmutableNodeInst withNameDescriptor(TextDescriptor nameDescriptor)
Returns ImmutableNodeInst which differs from this ImmutableNodeInst by name descriptor.

Parameters:
nameDescriptor - TextDescriptor of name
Returns:
ImmutableNodeInst which differs from this ImmutableNodeInst by name descriptor.

withOrient

public ImmutableNodeInst withOrient(Orientation orient)
Returns ImmutableNodeInst which differs from this ImmutableNodeInst by orientation.

Parameters:
orient - Orientation.
Returns:
ImmutableNodeInst which differs from this ImmutableNodeInst by orientation.
Throws:
java.lang.NullPointerException - if orient is null.

withAnchor

public ImmutableNodeInst withAnchor(EPoint anchor)
Returns ImmutableNodeInst which differs from this ImmutableNodeInst by anchor point.

Parameters:
anchor - node anchor point.
Returns:
ImmutableNodeInst which differs from this ImmutableNodeInst by anchor point.
Throws:
java.lang.NullPointerException - if anchor is null.

withSize

public ImmutableNodeInst withSize(EPoint size)
Returns ImmutableNodeInst which differs from this ImmutableNodeInst by size.

Parameters:
size - a point with x as size and y as height.
Returns:
ImmutableNodeInst which differs from this ImmutableNodeInst by size.
Throws:
java.lang.IllegalArgumentException - if width or height is negative.

withStateBits

public ImmutableNodeInst withStateBits(ImmutableNodeInst d)
Returns ImmutableNodeInst which differs from this ImmutableNodeInst by state bits. State bits are flags and tech-specifiic bits.

Parameters:
d - another ImmutableNodeInst where to take state bits.
Returns:
ImmutableNodeInst which differs from this ImmutableNodeInst by state bit.

withFlag

public ImmutableNodeInst withFlag(ImmutableNodeInst.Flag flag,
                                  boolean value)
Returns ImmutableNodeInst which differs from this ImmutableNodeInst by flag bit.

Parameters:
flag - Flag selector.
value - new value of flag.
Returns:
ImmutableNodeInst which differs from this ImmutableNodeInst by flag bit.

withTechSpecific

public ImmutableNodeInst withTechSpecific(int techBits)
Returns ImmutableNodeInst which differs from this ImmutableNodeInst by tech specific bits. 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:
techBits - the Technology-specific value to store on this NodeInst.
Returns:
ImmutableNodeInst which differs from this ImmutableNodeInst by tech bits.

withProtoDescriptor

public ImmutableNodeInst withProtoDescriptor(TextDescriptor protoDescriptor)
Returns ImmutableNodeInst which differs from this ImmutableNodeInst by proto descriptor.

Parameters:
protoDescriptor - TextDescriptor of proto
Returns:
ImmutableNodeInst which differs from this ImmutableNodeInst by proto descriptor.

withVariable

public ImmutableNodeInst withVariable(Variable var)
Returns ImmutableNodeInst which differs from this ImmutableNodeInst by additional Variable. If this ImmutableNideInst has Variable with the same key as new, the old variable will not be in new ImmutableNodeInst.

Parameters:
var - additional Variable.
Returns:
ImmutableNodeInst with additional Variable.
Throws:
java.lang.NullPointerException - if var is null

withoutVariable

public ImmutableNodeInst withoutVariable(Variable.Key key)
Returns ImmutableNodeInst which differs from this ImmutableNodeInst by removing Variable with the specified key. Returns this ImmutableNodeInst if it doesn't contain variable with the specified key.

Parameters:
key - Variable Key to remove.
Returns:
ImmutableNodeInst without Variable with the specified key.
Throws:
java.lang.NullPointerException - if key is null

withPortInst

public ImmutableNodeInst withPortInst(PortProtoId portProtoId,
                                      ImmutablePortInst portInst)
Returns ImmutableNodeInst which differs from this ImmutableNodeInst by additional Variable on PortInst. If this ImmutableNideInst has Variable on PortInst with the same key as new, the old variable will not be in new ImmutableNodeInst.

Parameters:
portProtoId - PortProtoId of port instance.
Returns:
ImmutableNodeInst with additional Variable.
Throws:
java.lang.NullPointerException - if var is null

isUsernamed

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

Returns:
true if this ImmutableNodeInst was named by user.

getPortInst

public ImmutablePortInst getPortInst(PortProtoId portProtoId)
Returns ImmutablePortInst of this ImmutableNodeInst with the specified PortProtoId.

Parameters:
portProtoId - PortProtoId of port instance.
Returns:
ImmutablePortInst of this ImmutableNodeInst with the specified PortProtoId.
Throws:
java.lang.NullPointerException - if portProtoId is null.
IlleagalArgumentException - if parent of portProtoId is not protoId of this ImmutableNodeInst.

getPortsWithVariables

public java.util.Iterator<PortProtoId> getPortsWithVariables()
Returns an Iterator over all PortProtoIds such that the correspondent PortInst on this ImmutablePortInst has variables.

Returns:
an Iterator over all PortProtoIds with variables.
Throws:
java.lang.NullPointerException - if portProtoId is null.
IlleagalArgumentException - if parent of portProtoId is not protoId of this ImmutableNodeInst.

hasPortInstVariables

public boolean hasPortInstVariables()
Returns true if this ImmutableNodeInst has variables on port instances.

Returns:
true if this ImmutableNodeInst has variables on port instances.

is

public boolean is(ImmutableNodeInst.Flag flag)
Tests specific flag is set on this ImmutableNodeInst.

Parameters:
flag - flag selector.
Returns:
true if specific flag is set,

hashCodeExceptVariables

public int hashCodeExceptVariables()
Return a hash code value for fields of this object. Variables of objects are not compared

Specified by:
hashCodeExceptVariables in class ImmutableElectricObject

equalsExceptVariables

public boolean equalsExceptVariables(ImmutableElectricObject o)
Indicates whether fields of other ImmutableElectricObject are equal to fileds of this object. Variables of objects are not compared.

Specified by:
equalsExceptVariables in class ImmutableElectricObject
Parameters:
o - other ImmutableElectricObject.
Returns:
true if fields of objects are equal.

check

public void check()
Checks invariant of this ImmutableNodeInst.

Throws:
java.lang.AssertionError - if invariant is broken.

isCellCenter

public static boolean isCellCenter(NodeProtoId protoId)

getElibBits

public int getElibBits()
Returns ELIB user bits of this ImmutableNodeInst in ELIB.

Returns:
ELIB user bits of this ImmutableNodeInst.

flagsFromElib

public static int flagsFromElib(int elibBits)
Get flag bits from ELIB user bits.

Parameters:
elibBits - ELIB user bits.
Returns:
flag bits.

techSpecificFromElib

public static int techSpecificFromElib(int elibBits)
Get tech specific bits from ELIB user bits.

Parameters:
elibBits - ELIB user bits.
Returns:
tech specific bits.

computeBounds

public void computeBounds(NodeInst real,
                          java.awt.geom.Rectangle2D.Double dstBounds)

getTrace

public EPoint[] getTrace()
Method to return the "outline" information on this ImmutableNodeInst. 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 EPoint in database coordinates.

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.