com.sun.electric.technology
Class PrimitivePort

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

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

A PrimitivePort lives in a PrimitiveNode in a Tecnology. It contains a list of ArcProto types that it accepts connections from.

See Also:
Serialized Form

Method Summary
 int compareTo(PrimitivePort that)
          Compares PrimtivePorts by their PrimitiveNodes and definition order.
 boolean connectsTo(ArcProto arc)
          Method to return true if this PrimitivePort can connect to an arc of a given type.
 int getAngle()
          Method to return the angle of this PrimitivePort.
 int getAngleRange()
          Method to return the angle range of this PrimitvePort.
 PrimitivePort getBasePort()
          Method to return the base-level port that this PortProto is created from.
 EdgeV getBottom()
          Method to return the bottom edge of the PrimitivePort as a value that scales with the actual NodeInst.
 PortCharacteristic getCharacteristic()
          Method to return the PortCharacteristic of this PortProto.
 ArcProto getConnection()
          Method to return one of allowable connections on this PrimitivePort.
 ArcProto[] getConnections()
          Method to return the list of allowable connections on this PrimitivePort.
 ArcProto[] getConnections(TechPool allTechs)
          Method to return the list of allowable connections on this PrimitivePort.
 PrimitivePortId getId()
          Method to return PortProtoId of this PrimitivePort.
 EdgeH getLeft()
          Method to return the left edge of the PrimitivePort as a value that scales with the actual NodeInst.
 java.lang.String getName()
          Method to return the name of this PrimitivePort.
 Name getNameKey()
          Method to return the name key of this PrimitivePort.
 PrimitiveNode getParent()
          Method to return the parent NodeProto of this PrimitivePort.
 java.awt.Color getPortColor(GraphicsPreferences gp)
          Method to compute the color of this PrimitivePort in specified GraphicsPreferences.
 int getPortIndex()
          Method to get the index of this PrimitivePort.
 EdgeH getRight()
          Method to return the right edge of the PrimitivePort as a value that scales with the actual NodeInst.
 EdgeV getTop()
          Method to return the top edge of the PrimitivePort as a value that scales with the actual NodeInst.
 int getTopology()
          Method to get the topology of this PrimitivePort.
 boolean isGround()
          Method to determine whether this PrimitivePort is of type Ground.
 boolean isIsolated()
          Method to tell whether this PrimitivePort is isolated.
 boolean isNamedGround()
          Method to determine whether this PortProto has a name that suggests Ground.
 boolean isNegatable()
          Method to tell whether this type of port can be negated.
 boolean isPower()
          Method to determine whether this PrimitivePort is of type Power.
 boolean isWellPort()
          Method to tell whether this portproto is a "well" port on a transistor (for bias connections).
static PrimitivePort newInstance(Technology tech, PrimitiveNode parent, ArcProto[] portArcs, java.lang.String protoName, int portAngle, int portRange, int portTopology, PortCharacteristic characteristic, EdgeH left, EdgeV bottom, EdgeH right, EdgeV top)
          Method to create a new PrimitivePort from the parameters.
 void setConnections(ArcProto[] portArcs)
          Method to set the list of allowable connections on this PrimitivePort.
 void setIsolated()
          Method to set this PrimitivePort to be isolated.
 void setNegatable(boolean negatable)
          Method to tell set this type of port can be negated.
 java.lang.String toString()
          Returns a printable version of this PrimitivePort.
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()

newInstance

public static PrimitivePort newInstance(Technology tech,
                                        PrimitiveNode parent,
                                        ArcProto[] portArcs,
                                        java.lang.String protoName,
                                        int portAngle,
                                        int portRange,
                                        int portTopology,
                                        PortCharacteristic characteristic,
                                        EdgeH left,
                                        EdgeV bottom,
                                        EdgeH right,
                                        EdgeV top)
Method to create a new PrimitivePort from the parameters.

Parameters:
tech - the Technology in which this PrimitivePort is being created.
parent - the PrimitiveNode on which this PrimitivePort resides.
portArcs - an array of ArcProtos which can connect to this PrimitivePort.
protoName - the name of this PrimitivePort. It may not have unprintable characters, spaces, or tabs in it.
portAngle - the primary angle that the PrimitivePort faces on the PrimitiveNode (in degrees). This angle is measured counter-clockwise from a right-pointing direction.
portRange - the range about the angle of allowable connections (in degrees). Arcs must connect to this port within this many degrees of the port connection angle. When this value is 180, then all angles are permissible, since arcs can connect at up to 180 degrees in either direction from the port angle.
portTopology - is a small integer that is unique among PrimitivePorts on the PrimitiveNode. When two PrimitivePorts have the same topology number, it indicates that these ports are connected.
characteristic - describes the nature of this PrimitivePort (input, output, power, ground, etc.)
left - is an EdgeH that describes the left side of the port in a scalable way.
bottom - is an EdgeV that describes the bottom side of the port in a scalable way.
right - is an EdgeH that describes the right side of the port in a scalable way.
top - is an EdgeV that describes the top side of the port in a scalable way.
Returns:
the newly created PrimitivePort.

getId

public PrimitivePortId getId()
Method to return PortProtoId of this PrimitivePort. PortProtoId identifies PrimitivePort independently of threads.

Specified by:
getId in interface PortProto
Returns:
PortProtoId of this PrimtivePort.

getNameKey

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

Specified by:
getNameKey in interface PortProto
Returns:
the Name key of this PrimitivePort.

getName

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

Specified by:
getName in interface PortProto
Returns:
the name of this PrimitivePort.

getParent

public PrimitiveNode getParent()
Method to return the parent NodeProto of this PrimitivePort.

Specified by:
getParent in interface PortProto
Returns:
the parent NodeProto of this PrimitivePort.

getPortIndex

public int getPortIndex()
Method to get the index of this PrimitivePort. This is a zero-based index of ports on the PrimitiveNode.

Specified by:
getPortIndex in interface PortProto
Returns:
the index of this PrimitivePort.

setConnections

public void setConnections(ArcProto[] portArcs)
Method to set the list of allowable connections on this PrimitivePort.

Parameters:
portArcs - an array of ArcProtos which can connect to this PrimitivePort.

getConnections

public ArcProto[] getConnections(TechPool allTechs)
Method to return the list of allowable connections on this PrimitivePort.

Parameters:
allTechs - pool of all known technologies
Returns:
an array of ArcProtos which can connect to this PrimitivePort.

getConnections

public ArcProto[] getConnections()
Method to return the list of allowable connections on this PrimitivePort.

Returns:
an array of ArcProtos which can connect to this PrimitivePort.

getConnection

public ArcProto getConnection()
Method to return one of allowable connections on this PrimitivePort.

Returns:
ArcProto which can connect to this PrimitivePort.

getBasePort

public PrimitivePort getBasePort()
Method to return the base-level port that this PortProto is created from. Since it is a PrimitivePort, it simply returns itself.

Specified by:
getBasePort in interface PortProto
Returns:
the base-level port that this PortProto is created from (this).

getLeft

public EdgeH getLeft()
Method to return the left edge of the PrimitivePort as a value that scales with the actual NodeInst.

Returns:
an EdgeH object that describes the left edge of the PrimitivePort.

getRight

public EdgeH getRight()
Method to return the right edge of the PrimitivePort as a value that scales with the actual NodeInst.

Returns:
an EdgeH object that describes the right edge of the PrimitivePort.

getTop

public EdgeV getTop()
Method to return the top edge of the PrimitivePort as a value that scales with the actual NodeInst.

Returns:
an EdgeV object that describes the top edge of the PrimitivePort.

getBottom

public EdgeV getBottom()
Method to return the bottom edge of the PrimitivePort as a value that scales with the actual NodeInst.

Returns:
an EdgeV object that describes the bottom edge of the PrimitivePort.

getCharacteristic

public PortCharacteristic getCharacteristic()
Method to return the PortCharacteristic of this PortProto.

Specified by:
getCharacteristic in interface PortProto
Returns:
the PortCharacteristic of this PortProto.

isPower

public boolean isPower()
Method to determine whether this PrimitivePort is of type Power. This is determined by having the proper PortCharacteristic.

Specified by:
isPower in interface PortProto
Returns:
true if this PrimitivePort is of type Power.

isGround

public boolean isGround()
Method to determine whether this PrimitivePort is of type Ground. This is determined by having the proper PortCharacteristic.

Specified by:
isGround in interface PortProto
Returns:
true if this PrimitivePort is of type Ground.

isWellPort

public boolean isWellPort()
Method to tell whether this portproto is a "well" port on a transistor (for bias connections).

Returns:
true if this is a Well port on a transistor.

isNamedGround

public boolean isNamedGround()
Method to determine whether this PortProto has a name that suggests Ground. This is determined by either having a name starting with "vss", "gnd", or "ground".

Returns:
true if this PortProto has a name that suggests Ground.

getAngle

public int getAngle()
Method to return the angle of this PrimitivePort. This is the primary angle that the PrimitivePort faces on the PrimitveNode.

Returns:
the angle of this PrimitivePort.

getAngleRange

public int getAngleRange()
Method to return the angle range of this PrimitvePort. This is the range about the angle of allowable connections. When this value is 180, then all angles are permissible, since arcs can connect at up to 180 degrees in either direction from the port angle.

Returns:
the angle range of this PrimitivePort.

getTopology

public int getTopology()
Method to get the topology of this PrimitivePort. This is a small integer that is unique among PrimitivePorts on this PrimitiveNode. When two PrimitivePorts have the same topology number, it indicates that these ports are connected.

Returns:
the topology of this PrimitvePort.

setIsolated

public void setIsolated()
Method to set this PrimitivePort to be isolated. Isolated ports do not electrically connect their arcs. This occurs in the multiple inputs to a schematic gate that all connect to the same port but do not themselves connect.


isIsolated

public boolean isIsolated()
Method to tell whether this PrimitivePort is isolated. Isolated ports do not electrically connect their arcs. This occurs in the multiple inputs to a schematic gate that all connect to the same port but do not themselves connect.

Returns:
true if this PrimitivePort is isolated.

isNegatable

public boolean isNegatable()
Method to tell whether this type of port can be negated.

Returns:
true if this type of port can be negated.

setNegatable

public void setNegatable(boolean negatable)
Method to tell set this type of port can be negated.

Parameters:
negatable - true if this type of port can be negated.

connectsTo

public boolean connectsTo(ArcProto arc)
Method to return true if this PrimitivePort can connect to an arc of a given type.

Specified by:
connectsTo in interface PortProto
Parameters:
arc - the ArcProto to test for connectivity.
Returns:
true if this PrimitivePort can connect to the arc, false if it can't

getPortColor

public java.awt.Color getPortColor(GraphicsPreferences gp)
Method to compute the color of this PrimitivePort in specified GraphicsPreferences. Combines all arcs that can connect.

Parameters:
gp - specified GraphicsPreferences
Returns:
the color to use for this PrimitivePort.

compareTo

public int compareTo(PrimitivePort that)
Compares PrimtivePorts by their PrimitiveNodes and definition order.

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

toString

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

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