public class PrimitivePort extends java.lang.Object implements PortProto, java.lang.Comparable<PrimitivePort>, java.io.Serializable
Modifier | Constructor and Description |
---|---|
protected |
PrimitivePort(PrimitiveNode parent,
ArcProto[] portArcs,
java.lang.String protoName,
boolean isSingle,
int portAngle,
int portRange,
int portTopology,
PortCharacteristic characteristic,
boolean isolated,
boolean negatable,
EdgeH left,
EdgeV bottom,
EdgeH right,
EdgeV top)
The constructor is only called from the factory method "newInstance".
|
Modifier and Type | Method and Description |
---|---|
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.
|
protected void |
genShape(AbstractShapeBuilder b,
ImmutableNodeInst n)
Puts into shape builder s the polygons that describe node "n", given a set of
NodeLayer objects to use.
|
protected void |
genShape(AbstractShapeBuilder b,
ImmutableNodeInst n,
java.awt.geom.Point2D selectPt)
Puts into shape builder s the polygons that describe node "n", given a set of
NodeLayer objects to use.
|
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(PrimitiveNode parent,
ArcProto[] portArcs,
java.lang.String protoName,
boolean isSingle,
int portAngle,
int portRange,
int portTopology,
PortCharacteristic characteristic,
boolean isolated,
boolean negatable,
EdgeH left,
EdgeV bottom,
EdgeH right,
EdgeV top)
Method to create a new PrimitivePort from the parameters.
|
static PrimitivePort |
newInstance(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.
|
static PrimitivePort |
single(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.
|
java.lang.String |
toString()
Returns a printable version of this PrimitivePort.
|
protected java.lang.Object |
writeReplace() |
protected PrimitivePort(PrimitiveNode parent, ArcProto[] portArcs, java.lang.String protoName, boolean isSingle, int portAngle, int portRange, int portTopology, PortCharacteristic characteristic, boolean isolated, boolean negatable, EdgeH left, EdgeV bottom, EdgeH right, EdgeV top)
protected java.lang.Object writeReplace()
public static PrimitivePort newInstance(PrimitiveNode parent, ArcProto[] portArcs, java.lang.String protoName, int portAngle, int portRange, int portTopology, PortCharacteristic characteristic, EdgeH left, EdgeV bottom, EdgeH right, EdgeV top)
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.public static PrimitivePort single(PrimitiveNode parent, ArcProto[] portArcs, java.lang.String protoName, int portAngle, int portRange, int portTopology, PortCharacteristic characteristic, EdgeH left, EdgeV bottom, EdgeH right, EdgeV top)
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.public static PrimitivePort newInstance(PrimitiveNode parent, ArcProto[] portArcs, java.lang.String protoName, boolean isSingle, int portAngle, int portRange, int portTopology, PortCharacteristic characteristic, boolean isolated, boolean negatable, EdgeH left, EdgeV bottom, EdgeH right, EdgeV top)
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.isSingle
- true if this is a single PrimitivePort on PrimitiveNodeportAngle
- 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.)isolated
- true if PrimtivePort is isolatednegatable
- true if PrimitivePort is negatableleft
- 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.public PrimitivePortId getId()
public Name getNameKey()
getNameKey
in interface PortProto
public java.lang.String getName()
public PrimitiveNode getParent()
public int getPortIndex()
getPortIndex
in interface PortProto
public ArcProto[] getConnections(TechPool allTechs)
allTechs
- pool of all known technologiespublic ArcProto[] getConnections()
public ArcProto getConnection()
public PrimitivePort getBasePort()
getBasePort
in interface PortProto
public EdgeH getLeft()
public EdgeH getRight()
public EdgeV getTop()
public EdgeV getBottom()
public PortCharacteristic getCharacteristic()
getCharacteristic
in interface PortProto
public boolean isPower()
public boolean isGround()
public boolean isWellPort()
public boolean isNamedGround()
public int getAngle()
public int getAngleRange()
public int getTopology()
public boolean isIsolated()
public boolean isNegatable()
public boolean connectsTo(ArcProto arc)
connectsTo
in interface PortProto
arc
- the ArcProto to test for connectivity.protected void genShape(AbstractShapeBuilder b, ImmutableNodeInst n)
b
- shape builder where to put polygonsn
- the ImmutableNodeInst that is being described.protected void genShape(AbstractShapeBuilder b, ImmutableNodeInst n, java.awt.geom.Point2D selectPt)
b
- shape builder where to put polygonsn
- the ImmutableNodeInst that is being described.selectPt
- requests a new location on the port,
away from existing arcs, and close to this point.
This is useful for "area" ports such as the left side of AND and OR gates.java.lang.NullPointerException
- if any argument is null.public java.awt.Color getPortColor(GraphicsPreferences gp)
gp
- specified GraphicsPreferencespublic int compareTo(PrimitivePort that)
compareTo
in interface java.lang.Comparable<PrimitivePort>
that
- the other PrimitivePort.public java.lang.String toString()
toString
in class java.lang.Object