31.01.2014 Views

Ph.D. - geht es zur Homepage der Informatik des Fachbereiches 3 ...

Ph.D. - geht es zur Homepage der Informatik des Fachbereiches 3 ...

Ph.D. - geht es zur Homepage der Informatik des Fachbereiches 3 ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 7. openETCS Meta Model<br />

Listing 7.6: gFunctionBlock constraint 1<br />

The OCL closure [63, pp. 30-31] statement (lin<strong>es</strong> 4 to 7) is not only used to check this constraint<br />

for each graph instance separately but also to include gSubFunctionBlock graphs referenced by<br />

oSubFunction object decompositions. In other words, if an input port is already connected in a<br />

gMainFunctionBlock graph and also in a gSubFunctionBlock graph included by a oSubFunction<br />

object, this constraints fails. Due to the easy usage of this complex operation, the closure<br />

statement is also used for further constraints.<br />

Because oVariableStorage objects do not have any input ports, an additional constraint for<br />

their input count must be defined.<br />

1 context CProject<br />

2 inv : m_GraphSet−>s e l e c t (m_Type = ’ gMainFunctionBlock ’ or m_Type =<br />

’ gSubFunctionBlock ’ )−>f o r A l l (<br />

3 graph |<br />

4 graph . m_ObjectSet−>s e l e c t (m_Type = ’ oSubFunction ’ ) . m_pDecomposition−>c l o s u r e (<br />

5 subgraph |<br />

6 subgraph . m_ObjectSet−>s e l e c t (m_Type = ’ oSubFunction ’ ) . m_pDecomposition<br />

7 )−>i n c l u d i n g ( graph )−>f o r A l l (<br />

8 graph |<br />

9 graph . m_ObjectSet−>s e l e c t (m_Type = ’ o V a r i a b l e S t o r a g e ’ )−>f o r A l l (<br />

10 o b j e c t |<br />

11 graph . m_BindingSet−>s e l e c t ( m_Connection . m_Calls−>e x i s t s (<br />

12 m_pObject = o b j e c t and m_pRole . m_Type = ’ DataInput ’<br />

13 ) )−>s i z e ( ) = 1<br />

14 )<br />

15 )<br />

16 )<br />

Listing 7.7: gFunctionBlock constraint 2<br />

Regarding the inclusion of gSubFunctionBlock graphs, it is important that a model instance<br />

do<strong>es</strong> not hold a recursive inclusion of gSubFunctionBlock graphs by oSubFunction objects.<br />

Recursive inclusion means that a parent graph which includ<strong>es</strong> a child graph by an oSubFunction<br />

object is also included in the child graph repr<strong>es</strong>entation – or any other further child graph – by<br />

another oSubFunction object.<br />

1 context CProject<br />

2 inv : m_GraphSet−>s e l e c t (m_Type = ’ gMainFunctionBlock ’ or m_Type =<br />

’ gSubFunctionBlock ’ )−>f o r A l l (<br />

3 graph |<br />

4 l e t s u b o b j e c t s : Collection (GOPPRR: : CObject ) =<br />

5 graph . m_ObjectSet−>s e l e c t (m_Type = ’ oSubFunction ’ ) . m_pDecomposition−>c l o s u r e (<br />

6 subgraph |<br />

7 subgraph . m_ObjectSet−>s e l e c t (m_Type = ’ oSubFunction ’ ) . m_pDecomposition<br />

8 )−>i n c l u d i n g ( graph ) . m_ObjectSet−>f l a t t e n ( )−>s e l e c t (m_Type = ’ oSubFunction ’ )<br />

9 i n<br />

10 s u b o b j e c t s −>s i z e ( ) = s u b o b j e c t s −>a s S e t ( )−>s i z e ( )<br />

11 )<br />

Listing 7.8: gFunctionBlock constraint 3<br />

The constraint that each instance of oSubFunction must have a decomposition is not extremely<br />

nec<strong>es</strong>sary, but it is defined to ensure model correctn<strong>es</strong>s.<br />

100

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

Saved successfully!

Ooh no, something went wrong!