03.08.2013 Views

PTOLEMY II - CiteSeerX

PTOLEMY II - CiteSeerX

PTOLEMY II - CiteSeerX

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

MoML<br />

<br />

<br />

<br />

<br />

Here, the element named “x” appears both in “top” and in “.top.y”, i.e. the same instance appears in<br />

two different places. Thus, it would have two full names, “.top.x” and “.top.y.x”. However, Ptolemy <strong>II</strong><br />

does not support this, as it implements a strict container relationship, where an object can have only<br />

one container. Thus, attempting to parse the above MoML will result in an exception being thrown.<br />

7.3.6 Properties<br />

Entities (and some other elements) can be parameterized. There are two mechanisms. The simplest<br />

one is to use the property element:<br />

<br />

<br />

<br />

The property element has a name, at minimum (the value and class are optional). It is common for the<br />

enclosing class to already contain properties, in which case the property element is used only to set the<br />

value. For example:<br />

<br />

<br />

<br />

In the above, the enclosing object (source, an instance of ptolemy.actor.lib.Ramp) must already<br />

contain a property with the name init. This is typically how library components are parameterized. In<br />

Ptolemy <strong>II</strong>, the value of a property may be an expression, as in “PI/50”. The expression may refer to<br />

other properties of the containing entity or of its container. Note that the expression language is not<br />

part of MoML, but is rather part of Ptolemy <strong>II</strong>. In MoML, a property value is simply an uninterpreted<br />

string. It is up to a MoML tool, such as Ptolemy <strong>II</strong>, to interpret that string.<br />

A property can be declared without a class and without a pre-existing property if it is a pure property,<br />

one with only a name and no value. For example:<br />

<br />

<br />

<br />

A property can also contain a property, as in<br />

<br />

<br />

<br />

A second, much more flexible mechanism is provided for parameterizing entities. The configure<br />

Heterogeneous Concurrent Modeling and Design 201

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

Saved successfully!

Ooh no, something went wrong!