com.sun.electric.database
Class ImmutableExport

java.lang.Object
  extended by com.sun.electric.database.ImmutableElectricObject
      extended by com.sun.electric.database.ImmutableExport

public class ImmutableExport
extends ImmutableElectricObject

Immutable class ImmutableExport represents an export.


Field Summary
 boolean alwaysDrawn
          True if this ImmutableExport to be always drawn.
 boolean bodyOnly
          True to exclude this ImmutableExport from the icon.
 PortCharacteristic characteristic
          PortCharacteristic of this ImmutableExport.
static ImmutableArrayList<ImmutableExport> EMPTY_LIST
           
 ExportId exportId
          id of this Export.
 Name name
          name of this ImmutableExport.
 TextDescriptor nameDescriptor
          The text descriptor of name of ImmutableExport.
static ImmutableExport[] NULL_ARRAY
           
 int originalNodeId
          The nodeId of original PortInst.
 PortProtoId originalPortId
          The PortProtoId of orignal PortInst.
 
Fields inherited from class com.sun.electric.database.ImmutableElectricObject
flags
 
Method Summary
static boolean alwaysDrawnFromElib(int elibBits)
          Get alwaysDrawn Export flag from ELIB user bits.
static boolean bodyOnlyFromElib(int elibBits)
          Get bodyOnly Export flag from ELIB user bits.
 void check()
          Checks invariant of this ImmutableExport.
 boolean equalsExceptVariables(ImmutableElectricObject o)
          Indicates whether fields of other ImmutableElectricObject are equal to fileds of this object.
 int getElibBits()
          Returns ELIB user bits of this ImmutableExport.
 int hashCodeExceptVariables()
          Return a hash code value for fields of this object.
static ImmutableExport newInstance(ExportId exportId, Name name, TextDescriptor nameDescriptor, int originalNodeId, PortProtoId originalPortId, boolean alwaysDrawn, boolean bodyOnly, PortCharacteristic characteristic)
          Returns new ImmutableExport object.
static PortCharacteristic portCharacteristicFromElib(int elibBits)
          Get PortCharacteristic of Export from ELIB user bits.
static Name validExportName(java.lang.String name, boolean busAllowed)
          Returns name key of string if string is a valid Export name, null if not.
 ImmutableExport withAlwaysDrawn(boolean alwaysDrawn)
          Returns ImmutableExport which differs from this ImmutableExport by alwaysDrawn flag.
 ImmutableExport withBodyOnly(boolean bodyOnly)
          Returns ImmutableExport which differs from this ImmutableExport by bodyOnly flag.
 ImmutableExport withCharacteristic(PortCharacteristic characteristic)
          Returns ImmutableExport which differs from this ImmutableExport by port characteristic.
 ImmutableExport withName(Name name)
          Returns ImmutableExport which differs from this ImmutableExport by name.
 ImmutableExport withNameDescriptor(TextDescriptor nameDescriptor)
          Returns ImmutableExport which differs from this ImmutableExport by name descriptor.
 ImmutableExport withOriginalPort(int originalNodeId, PortProtoId originalPortId)
          Returns ImmutableExport which differs from this ImmutableExport by original port.
 ImmutableExport withoutVariable(Variable.Key key)
          Returns ImmutableExport which differs from this ImmutableExport by removing Variable with the specified key.
 ImmutableExport withVariable(Variable var)
          Returns ImmutableExport which differs from this ImmutableExport 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

NULL_ARRAY

public static final ImmutableExport[] NULL_ARRAY

EMPTY_LIST

public static final ImmutableArrayList<ImmutableExport> EMPTY_LIST

exportId

public final ExportId exportId
id of this Export.


name

public final Name name
name of this ImmutableExport.


nameDescriptor

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


originalNodeId

public final int originalNodeId
The nodeId of original PortInst.


originalPortId

public final PortProtoId originalPortId
The PortProtoId of orignal PortInst.


alwaysDrawn

public final boolean alwaysDrawn
True if this ImmutableExport to be always drawn.


bodyOnly

public final boolean bodyOnly
True to exclude this ImmutableExport from the icon.


characteristic

public final PortCharacteristic characteristic
PortCharacteristic of this ImmutableExport.

Method Detail

newInstance

public static ImmutableExport newInstance(ExportId exportId,
                                          Name name,
                                          TextDescriptor nameDescriptor,
                                          int originalNodeId,
                                          PortProtoId originalPortId,
                                          boolean alwaysDrawn,
                                          boolean bodyOnly,
                                          PortCharacteristic characteristic)
Returns new ImmutableExport object.

Parameters:
exportId - id of new Export.
name - name of new ImmutableExport.
nameDescriptor - TextDescriptor of name of this ImmutableExport.
originalNodeId - node id of original PortInst.
originalPortId - port proto id of original PortInst.
alwaysDrawn - true if new ImmutableExport is always drawn.
bodyOnly - true to exclude new ImmutableExport from the icon.
characteristic - PortCharacteristic of new ImmutableExport.
Returns:
new ImmutableExport object.
Throws:
java.lang.NullPointerException - if exportId, name, originalPortId is null.
java.lang.IllegalArgumentException - if originalNodeId is bad.

withName

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

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

withNameDescriptor

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

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

withOriginalPort

public ImmutableExport withOriginalPort(int originalNodeId,
                                        PortProtoId originalPortId)
Returns ImmutableExport which differs from this ImmutableExport by original port.

Parameters:
originalNodeId - node id of original PortInst.
originalPortId - port proto id of original PortInst.
Returns:
ImmutableExport which differs from this ImmutableExport by original port.
Throws:
java.lang.NullPointerException - if originalPortId is null.

withAlwaysDrawn

public ImmutableExport withAlwaysDrawn(boolean alwaysDrawn)
Returns ImmutableExport which differs from this ImmutableExport by alwaysDrawn flag.

Parameters:
alwaysDrawn - true if new ImmutableExport is always drawn.
Returns:
ImmutableExport which differs from this ImmutableExport by alwaysDrawn flag.

withBodyOnly

public ImmutableExport withBodyOnly(boolean bodyOnly)
Returns ImmutableExport which differs from this ImmutableExport by bodyOnly flag.

Parameters:
bodyOnly - true to exclude new ImmutableExport from the icon.
Returns:
ImmutableExport which differs from this ImmutableExport by bodyOnly flag.

withCharacteristic

public ImmutableExport withCharacteristic(PortCharacteristic characteristic)
Returns ImmutableExport which differs from this ImmutableExport by port characteristic.

Parameters:
characteristic - PortCharacteristic of new ImmutableExport.
Returns:
ImmutableExport which differs from this ImmutableExport by port characteristic.

withVariable

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

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

withoutVariable

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

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

getElibBits

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

Returns:
ELIB user bits of this ImmutableExport.

alwaysDrawnFromElib

public static boolean alwaysDrawnFromElib(int elibBits)
Get alwaysDrawn Export flag from ELIB user bits.

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

bodyOnlyFromElib

public static boolean bodyOnlyFromElib(int elibBits)
Get bodyOnly Export flag from ELIB user bits.

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

portCharacteristicFromElib

public static PortCharacteristic portCharacteristicFromElib(int elibBits)
Get PortCharacteristic of Export from ELIB user bits.

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

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.

validExportName

public static Name validExportName(java.lang.String name,
                                   boolean busAllowed)
Returns name key of string if string is a valid Export name, null if not.

Parameters:
name - string to test.
busAllowed - true of arrayed export name is allowed
Returns:
name key or null.

check

public void check()
Checks invariant of this ImmutableExport.

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