Class 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)
    • 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.