Package ptolemy.vergil.actor
Class PortTerminal
- java.lang.Object
-
- diva.canvas.AbstractFigure
-
- diva.canvas.connector.TerminalFigure
-
- ptolemy.vergil.actor.PortTerminal
-
- All Implemented Interfaces:
CanvasComponent
,Terminal
,Figure
,VisibleComponent
,UserObjectContainer
public class PortTerminal extends TerminalFigure
A terminal figure for ports that supports multiports. In particular, this figure provides a method to determine the "order index" of a link to the port. When multiple relations are linked to a port, the order in which they are linked matters. The provided method returns the position within that order.When this is constructed, a figure is specified for the port, and properties of this figure, such as its bounds, whether it intersects other objects, etc., are determined by that figure. The extra decorations added to support multiple connections are not treated as part of the figure.
- Since:
- Ptolemy II 5.2
- Version:
- $Id$
- Author:
- Edward A. Lee
- See Also:
PortSite
- Pt.AcceptedRating:
- Red (eal)
- Pt.ProposedRating:
- Yellow (eal)
-
-
Field Summary
-
Fields inherited from class diva.canvas.connector.TerminalFigure
_connectSite
-
-
Constructor Summary
Constructors Constructor Description PortTerminal(IOPort port, Figure figure, double normal, boolean inside)
Construct a port terminal with the specified figure as the port figure.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getNumberOfLinks()
Return the number of links to relations that this port has.int
getOrderIndex(LinkManhattanConnector connector)
Return the order index of the connection represented by the specified connector.IOPort
getPort()
Return the port specified in the constructor.-
Methods inherited from class diva.canvas.connector.TerminalFigure
contains, getAttachSite, getBounds, getConnectSite, getFigure, getInteractor, getLayer, getOrigin, getParent, getShape, getToolTipText, getTransformContext, getUserObject, hit, intersects, isVisible, paint, paint, relocate, repaint, repaint, setAttachSite, setInteractor, setParent, setToolTipText, setUserObject, setVisible, transform, translate
-
-
-
-
Constructor Detail
-
PortTerminal
public PortTerminal(IOPort port, Figure figure, double normal, boolean inside)
Construct a port terminal with the specified figure as the port figure.- Parameters:
port
- The port.figure
- The associated figure.normal
- The normal direction.inside
- True if this is external port and the terminal represents inside connections.
-
-
Method Detail
-
getNumberOfLinks
public int getNumberOfLinks()
Return the number of links to relations that this port has.- Returns:
- The size of the inside or outside relations list of the port.
-
getOrderIndex
public int getOrderIndex(LinkManhattanConnector connector)
Return the order index of the connection represented by the specified connector. That is, return 0 if it is the first connection, 1 if it is the second, etc. If the connector is not known, then return -1.- Parameters:
connector
- The connector.- Returns:
- The order index of the connection.
-
getPort
public IOPort getPort()
Return the port specified in the constructor.- Returns:
- The port for which this is a terminal.
-
-