Class PortConnectSite

  • All Implemented Interfaces:
    Site

    public class PortConnectSite
    extends AbstractSite
    A site for instances of PortTerminal. For non-muiltiports, a PortTerminal will have exactly one of these sites, and it will be the connect site for the terminal. Multiports, however, will generate distinct site for each connection to the multiport.

    The normal for this site (the direction in which connections are made to it) is fixed when the site is constructed, and cannot be changed after that.

    Since:
    Ptolemy II 5.2
    Version:
    $Id$
    Author:
    Edward A. Lee
    See Also:
    PortTerminal
    Pt.AcceptedRating:
    Red (eal)
    Pt.ProposedRating:
    Yellow (eal)
    • Constructor Detail

      • PortConnectSite

        public PortConnectSite​(Figure figure,
                               PortTerminal terminal,
                               int id,
                               double normal)
        Create a port connect site for the specified figure and id. An id of zero is the default site at the port icon. Larger ids are reserved for sites that are used to distinguish multiple connections to a multiport.
        Parameters:
        figure - The parent figure.
        terminal - The port terminal.
        id - The ID.
        normal - The normal for this connect site.
    • Method Detail

      • getFigure

        public Figure getFigure()
        Return the parent figure specified in the constructor.
        Specified by:
        getFigure in interface Site
        Specified by:
        getFigure in class AbstractSite
        Returns:
        The parent figure.
      • getID

        public int getID()
        Return the ID specified in the constructor. The default ID is zero. When additional instances of this site are associated with an instance of PortTerminal, they each get a unique ID starting with 1 and increasing by 1. The ID determines the position of the site relative to the port.
        Specified by:
        getID in interface Site
        Specified by:
        getID in class AbstractSite
        Returns:
        The ID of the site.
      • getPoint

        public java.awt.geom.Point2D getPoint​(double normal)
        Get the position of this site.
        Specified by:
        getPoint in interface Site
        Overrides:
        getPoint in class AbstractSite
        Parameters:
        normal - The normal.
        Returns:
        The position of this site.
      • getTerminal

        public PortTerminal getTerminal()
        Get the terminal to which this site belongs.
        Returns:
        The terminal to which this site belongs.
      • getX

        public double getX()
        Get the horizontal position of this site with the normal that was set up by the constructor.
        Specified by:
        getX in interface Site
        Specified by:
        getX in class AbstractSite
        Returns:
        The horizontal position of this site.
      • getY

        public double getY()
        Get the vertical position of this site with the normal that was set up by the constructor.
        Specified by:
        getY in interface Site
        Specified by:
        getY in class AbstractSite
        Returns:
        The vertical position of this site.
      • setNormal

        public void setNormal​(double normal)
        Do nothing. The normal is fixed at the time this is constructed.
        Specified by:
        setNormal in interface Site
        Overrides:
        setNormal in class AbstractSite
        Parameters:
        normal - The normal.
      • toString

        public java.lang.String toString()
        Return a string representation of this connect site.
        Overrides:
        toString in class java.lang.Object
        Returns:
        The name of the port and the ID.