18.10.2014 Views

SIMSCRIPT II.5 Programming Language

SIMSCRIPT II.5 Programming Language

SIMSCRIPT II.5 Programming Language

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Modelling Concepts<br />

Because SPEED is an attribute common to both TANKER and TUG, it is possible to use a statement<br />

such as:<br />

if SPEED(SHIP) is not zero<br />

without regard to whether SHIP is a pointer to an instance of TANKER or a TUG.<br />

When temporary entities belong to common sets or own common sets, their set pointers are, of<br />

course, common attributes. It becomes possible to write:<br />

for each SHIP in HARBOR.SET<br />

with SPEED(SHIP) not zero<br />

do<br />

.<br />

.<br />

.<br />

—so the harbor master can track all the ships steaming around in the harbor.<br />

Under certain <strong>SIMSCRIPT</strong> <strong>II.5</strong> implementations, it is sufficient to name common attributes and sets<br />

in every statements, as shown. Other implementations require the use of "word numbers" as described<br />

in the relevant user's manuals. The above declarations could be rewritten as:<br />

every TANKER has a SPEED in word 1,<br />

a CARGO, and belongs to the HARBOR.SET<br />

and has a P.HARBOR.SET in word 2,<br />

and a S.HARBOR.SET in word 3,<br />

and a M.HARBOR.SET in word 4<br />

every TUG has a SPEED in word 1,<br />

and belongs to the HARBOR.SET<br />

and has a P.HARBOR.SET in word 2,<br />

and a S.HARBOR.SET in word 3,<br />

and a M.HARBOR.SET in word 4<br />

The entity structures of TANKER and TUG would look like figure 4-21.<br />

169

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

Saved successfully!

Ooh no, something went wrong!