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.

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

MoML<br />

In Ptolemy <strong>II</strong>, the typical classname for a relation would be ptolemy.actor.TypedIORelation.<br />

The classname may be omitted, in which case the newRelation() method of the container is used to create<br />

a new relation. The container is required to be an instance of ptolemy.kernel.CompositeEntity, or a<br />

derived class. As usual, the class attribute may be omitted if the relation already exists in the containing<br />

entity.<br />

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

be processed after all the contained entities, properties, and relations are created. However, the order of<br />

the link elements relative to each other does matter. Notice in this example that there are two distinct<br />

links to C.in from two different relations. The order of these links may be important to a MoML tool,<br />

so any MoML tool must preserve the order in which they are specified, as Ptolemy <strong>II</strong> does. We say that<br />

C has two links, indexed 0 and 1.<br />

The link element can explicitly give the index number at which to insert the link. For example,<br />

we could have achieved the same effect above by saying<br />

<br />

<br />

Whenever the insertAt option is not specified, the link is always appended to the end of the list of<br />

links.<br />

When the insertAt option is specified, the link is inserted at that position, so any pre-existing links<br />

with larger indices will have their index numbers incremented. For example, if we do<br />

A<br />

B<br />

FIGURE 7.6. Example topology.<br />

out<br />

out<br />

r1<br />

r2<br />

206 Ptolemy <strong>II</strong><br />

in<br />

C

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

Saved successfully!

Ooh no, something went wrong!