03.08.2013 Views

PTOLEMY II - CiteSeerX

PTOLEMY II - CiteSeerX

PTOLEMY II - CiteSeerX

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

MoML<br />

A common convention, used in Ptolemy <strong>II</strong>, is to add doc elements with the name “tooltip” to<br />

define a tooltip for GUI views of the component. A tooltip is a small window with short documentation<br />

that pops up when the mouse lingers on the graphical component.<br />

Note that the same limitation of using markup within configure elements also applies to doc elements.<br />

7.3.8 Ports<br />

An entity can declare a port:<br />

<br />

<br />

<br />

In the above example, no class is given for the port. If a port with the specified name already exists in<br />

the class for entity A, then that port is the one referenced. Otherwise, a new port is created in Ptolemy<br />

<strong>II</strong> by calling the newPort() method of the container. Alternatively, we can specify a class name, as in<br />

<br />

<br />

<br />

In this case, a port will be created if one does not already exist. If it does already exist, then its class is<br />

checked for consistency with the declared class (the pre-existing port must be an instance of the<br />

declared class). In Ptolemy <strong>II</strong>, the typical classname for a port would be<br />

ptolemy.actor.TypedIOPort<br />

In Ptolemy <strong>II</strong>, the container of a port is required to be an instance of ptolemy.kernel.Entity or a derived<br />

class.<br />

It is often useful to declare a port to be an input, an output, or both. To do this, enclose in the port a<br />

property named “input” or “output” or both, as in the following example:<br />

<br />

<br />

<br />

This is an example of a pure property. Optionally, the property can be given a boolean value, as in<br />

<br />

<br />

<br />

The value can be either “true” or “false”, where the latter will define the port to not be an output. A<br />

port can be defined to be both an input and an output, as follows<br />

<br />

204 Ptolemy <strong>II</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!