[kepler-dev] Ptoelmy Port and Parameter names should match the Java variable names + Mail actor.

Christopher Brooks cxh at eecs.berkeley.edu
Wed Feb 9 17:51:23 PST 2011


Hi Gongjing


On 2/8/11 4:27 PM, Gongjing Cao wrote:
> Hi, Christopher,
>
> Thanks for the reminder. Do you mean they have to be exact the same?

Yes, they should be the same, for example:

fromEmail = new PortParameter(this, "fromEmail");
...

public PortParameter fromEmail;

See
http://www.mail-archive.com/ptolemy-hackers@doppler.eecs.berkeley.edu/msg00348.html

See also page 168-169 of Volume of the Ptolemy Design doc:
http://ptolemy.eecs.berkeley.edu/ptolemyII/designdoc.htm
--start--

By convention, ports are public members of actors. They represent a set of input and output channels
through which tokens may pass to other ports. Figure 5.1 shows a single port portName that is an
instance of TypedIOPort, declared in the line
public TypedIOPort portName;
Most ports in actors are instances of TypedIOPort, unless they require domain-specific services, in
which case they may be instances of a domain-specific subclass, such as DEIOPort. The port is actually
created in the constructor by the line
portName = new TypedIOPort(this, "portName", true, false);
The first argument to the constructor is the container of the port, this actor. The second is the name of
the port, which can be any string, but by convention, is the same as the name of the public member. If
the port name is not the same as the public member, then there will be problems with cloning, which
depends on this naming convention. To present a different name to the user, call the setDisplayName()
method. Note that calling setDisplayName() is optional. The third argument specifies whether the port
is an input (it is in this example), and the fourth argument specifies whether it is an output (it is not in
this example). There is no difficulty with having a port that is both an input and an output, but it is
rarely useful to have one that is neither.
--end---

>
> "Cloning", do you mean the regular java cloning?

Yes, cloning happens with actor oriented classes.  It may happen at other times.

> Thanks for letting me know there is another mail actor.
>
> Best,
> Gongjing
>
>
>
>
> On Tue, Feb 8, 2011 at 3:12 PM, Christopher Brooks <cxh at eecs.berkeley.edu <mailto:cxh at eecs.berkeley.edu>> wrote:
>
>     Hi Gongjing,
>
>     BTW - If the parameter names do not match name of the variable,
>     then cloning the actor will fail.
>
>     Cloning occurs when Actor Oriented Classes are used.
>
>     Also, there is newish mail actor in the Ptolemy II tree at
>     ptolemy.actor.lib.mail.SendMail.java
>     To try out the actor, use
>     Tools -> Instantiate Component
>
>     _Christopher
>
>     On 2/8/11 3:04 PM, gongjing at ecoinformatics.org <mailto:gongjing at ecoinformatics.org> wrote:
>
>         Author: gongjing
>         Date: 2011-02-08 15:04:26 -0800 (Tue, 08 Feb 2011)
>         New Revision: 27048
>
>         Modified:
>             trunk/modules/koogle/src/org/kepler/actor/util/MailSender.java
>         Log:
>         typo
>
>         Modified: trunk/modules/koogle/src/org/kepler/actor/util/MailSender.java
>         ===================================================================
>         --- trunk/modules/koogle/src/org/kepler/actor/util/MailSender.java      2011-02-08 22:54:36 UTC (rev 27047)
>         +++ trunk/modules/koogle/src/org/kepler/actor/util/MailSender.java      2011-02-08 23:04:26 UTC (rev 27048)
>         @@ -55,7 +55,7 @@
>                   authTokenPParameter.setStringMode(true);
>                   tokenSecretPParameter = new PortParameter(this, "Token Secret");
>                   tokenSecretPParameter.setStringMode(true);
>         -        fromEmailPParameter = new PortParameter(this, "From Emial");
>         +        fromEmailPParameter = new PortParameter(this, "From Email");
>                   fromEmailPParameter.setStringMode(true);
>                   toEmailPParameter = new PortParameter(this, "To Emails");
>                   toEmailPParameter.setStringMode(true);
>
>         _______________________________________________
>         Kepler-cvs mailing list
>         Kepler-cvs at kepler-project.org <mailto:Kepler-cvs at kepler-project.org>
>         http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-cvs
>
>
>     --
>     Christopher Brooks, PMP                       University of California
>     CHESS Executive Director                      US Mail: 337 Cory Hall
>     Programmer/Analyst CHESS/Ptolemy/Trust        Berkeley, CA 94720-1774
>     ph: <tel:+15106439841>510.643.9841 <tel:+15106439841>                                  (Office: 545Q Cory)
>     home: (F-Tu) <tel:+17076650131>707.665.0131 <tel:+17076650131> cell: <tel:+17073320670>707.332.0670 <tel:+17073320670>
>
>

-- 
Christopher Brooks, PMP                       University of California
CHESS Executive Director                      US Mail: 337 Cory Hall
Programmer/Analyst CHESS/Ptolemy/Trust        Berkeley, CA 94720-1774
ph: 510.643.9841      	                      (Office: 545Q Cory)
home: (F-Tu) 707.665.0131 cell: 707.332.0670


More information about the Kepler-dev mailing list