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 />

<br />

<br />

<br />

then there will be a link to r1 with index 0, a link to r2 with index 2 (note! not 1), and a link to r3 with<br />

index 1.<br />

If the specified index is beyond the existing number of links, then null links (i.e. links to nothing)<br />

are created to fill in. So for example, if the first link we create is given by<br />

<br />

then the port will have two links, not one, but the first one will be an empty link. If we then say<br />

<br />

then the port will have three links, with the first one being empty. If we then say<br />

<br />

then there will be four links, with the second one being empty.<br />

Normally, it is not necessary in MoML to specify whether a link occurs on the inside of a port or<br />

on the outside. This can be determined automatically by identifying the relation.For example, in figure<br />

5.4, port P4 is linked on the inside to relation R2 and on the outside to relations R3 and R4.<br />

However, close examination of the DTD reveals that the relation attribute is optional. If the relation<br />

attribute is not present, then a null link is inserted. However, if you do not specify a relation, then<br />

there is no way to determine whether an inside null link or an outside null link was intended. MoML<br />

defines the default to be an outside null link. To specify an inside null link, use the insertInsideAt<br />

attribute. For example, to insert a null link on the inside of P4 in figure 7.4 prior to the link to R2, use:<br />

<br />

<br />

<br />

Note that the index number is not the same thing as the channel number in Ptolemy <strong>II</strong>. In Ptolemy<br />

<strong>II</strong>, a relation may have a width greater than one, so a single link may represent more than one channel<br />

(actually, it could even represent zero channels if that relation is not linked to another ports).<br />

7.3.10 Classes<br />

So far, entities have been instances of externally defined classes accessed via a class loader. They<br />

can also be instances of classes defined in MoML. To define a class in MoML, use the class element,<br />

as in the following example: 6<br />

<br />

6. This is a simplified version of the Sinewave class, whose complete definition is given in the appendix.<br />

Heterogeneous Concurrent Modeling and Design 207

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

Saved successfully!

Ooh no, something went wrong!