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

This unlinks a port from the specified relation. If the port is linked more than once to the specified relation,<br />

then all links to this relation are removed. It makes no difference whether the link is an inside link<br />

or an outside link, since this can be determined from the containers of the port and the relation.<br />

The unlink elements may appear anywhere in the body of the entity or class element. They<br />

will be processed after all the contained entities, properties, and relations are created, and before any<br />

are removed. However, the order of the unlink elements relative to each other does matter.<br />

The second and third forms are<br />

<br />

<br />

These both remove a link by index number. The first is used for an outside link, and the second for an<br />

inside link. The valid indices range from 0 to one less than the number of links that the port has. If the<br />

port is not a multiport, then there is at most one valid index, number 0. If an invalid index is given then<br />

the element is ignored. Note that the indexes of links above that of the removed link will be decremented<br />

by one.<br />

The unlink element can also be used to remove null links. For example, if we have created a link<br />

with<br />

<br />

where there was previously no link on this port, then this leaves a null link (not linked to anything)<br />

with index 0 (see section 7.3.9), and of course a link to relation r with index 1. The null link can be<br />

removed with<br />

<br />

which leaves the link to r as the sole link, having index 0.<br />

Note that the index is not the same thing as the channel number. A relation may have a width<br />

greater than one, so a single link may represent more than one channel (actually, it could even represent<br />

zero channels if that relation is not linked to other suitable ports).<br />

7.4.10 Grouping Elements<br />

Occasionally, you may wish to incrementally parse a set of elements. For example, in the Ptolemy<br />

<strong>II</strong> implementation, the parser has a method for setting the context, so you could set the context to a<br />

CompositeEntity and then create several entities by parsing the following MoML:<br />

<br />

<br />

<br />

However, the XML parser will fail to parse this because it requires that there be a single top-level element.<br />

The group element is provided for this purpose:<br />

<br />

Heterogeneous Concurrent Modeling and Design 217

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

Saved successfully!

Ooh no, something went wrong!