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

every COMMUNITY owns some MASONS<br />

every MAN may belong to the MASONS<br />

The entity structures shown contain the automatically-generated ownership and membership pointers<br />

F.MASONS, L.MASONS, N.MASONS, P.MASONS, S.MASONS, and M.MASONS.<br />

COMMUNITY<br />

F.MASONS<br />

L.MASONS<br />

N.MASONS<br />

MAN1<br />

P.MASONS<br />

S.MASONS<br />

M.MASONS<br />

MAN 2<br />

P.MASONS<br />

S.MASONS<br />

M.MASONS<br />

MAN 3<br />

P.MASONS<br />

S.MASONS<br />

M.MASONS<br />

MAN 4<br />

P.MASONS<br />

S.MASONS<br />

M.MASONS<br />

Figure 4-5. Owner-member Set Relationships<br />

The set owner, the entity named COMMUNITY, has two attributes that point to the member entities<br />

that are logically first and last in the set MASONS. It also has an N.MASONS attribute, which in this<br />

case is 4. The member entities, here called MAN1, MAN2, MAN3, and MAN4, have two attributes<br />

that point to the members of the set that logically precede and succeed them. Thus, F.MASONS in<br />

COMMUNITY points to the entity structure of MAN1, indicating that it is the first entity (logically) in<br />

the set MASONS. The pointer P.MASONS of MAN1, points nowhere (has a zero value), as MAN1 has<br />

no predecessor in MASONS. Its S.MASONS pointer, however, points to MAN2, which logically<br />

follows it in MASONS. As shown, P.MASONS of MAN2 points back to its predecessor, MAN1. The<br />

same is true of MAN3. MAN4, as the last member of MASONS, differs somewhat. It has no successor<br />

(S.MASON = 0), and is pointed to directly by L.MASONS, the last-in-set pointer of COMMUNITY.<br />

Each MAN also has an M.MASONS attribute which is non-zero since each MAN is a member of the<br />

set MASONS.<br />

The items to note from this example are:<br />

1. A set is made up of entities that point to one another, thereby expressing their member relationships.<br />

2. First-in-set and last-in-set pointers connect a set's owner to its member entities.<br />

3. A specific entity can own or belong to any number of sets as long as it has the required<br />

pointer attributes. For example, the entity MAN might own the set CHILDREN whose members<br />

are also entities of the type MAN. These relationships might be defined by the statement:<br />

every MAN may belong to the MASONS,<br />

own some CHILDREN, and belong to the CHILDREN<br />

141

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

Saved successfully!

Ooh no, something went wrong!