Package ptolemy.vergil.actor
Class PortConnectSite
- java.lang.Object
-
- diva.canvas.AbstractSite
-
- ptolemy.vergil.actor.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)
-
-
Field Summary
-
Fields inherited from class diva.canvas.AbstractSite
_hasNormal, _normal
-
-
Constructor Summary
Constructors Constructor Description PortConnectSite(Figure figure, PortTerminal terminal, int id, double normal)Create a port connect site for the specified figure and id.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FiguregetFigure()Return the parent figure specified in the constructor.intgetID()Return the ID specified in the constructor.java.awt.geom.Point2DgetPoint(double normal)Get the position of this site.PortTerminalgetTerminal()Get the terminal to which this site belongs.doublegetX()Get the horizontal position of this site with the normal that was set up by the constructor.doublegetY()Get the vertical position of this site with the normal that was set up by the constructor.voidsetNormal(double normal)Do nothing.java.lang.StringtoString()Return a string representation of this connect site.-
Methods inherited from class diva.canvas.AbstractSite
getNormal, getPoint, getPoint, getPoint, getTransformContext, hasNormal, isNormal, translate
-
-
-
-
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:
getFigurein interfaceSite- Specified by:
getFigurein classAbstractSite- 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:
getIDin interfaceSite- Specified by:
getIDin classAbstractSite- Returns:
- The ID of the site.
-
getPoint
public java.awt.geom.Point2D getPoint(double normal)
Get the position of this site.- Specified by:
getPointin interfaceSite- Overrides:
getPointin classAbstractSite- 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:
getXin interfaceSite- Specified by:
getXin classAbstractSite- 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:
getYin interfaceSite- Specified by:
getYin classAbstractSite- 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:
setNormalin interfaceSite- Overrides:
setNormalin classAbstractSite- Parameters:
normal- The normal.
-
toString
public java.lang.String toString()
Return a string representation of this connect site.- Overrides:
toStringin classjava.lang.Object- Returns:
- The name of the port and the ID.
-
-