My favorites | Sign in
Project Home Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
\chapter{OCL Code Sample}

\begin{oclcode}
library mine
metamodel uml
require ocl_library_imports

public definitions
context Edge
inv: self.from <> self.to
inv: self.oclIsTypeOf(from)
inv: self->includes(from)
inv: self.allInstances
inv: self.isUnique(self)
inv: from or to.name = "hello"
inv: from and to
inv: self->isEmpty()
inv: self->exists(from | a)
inv: self->forAll(from | a)
inv: self.size() = 1

context Frame::allRedirectsTo() : Set(Frame) body:
allRedirectsTo = self.redirectsTo()->union(
self.redirectsTo()->collect(p | p.allRedirectsTo())

context Frame::redirectsTo() : Set(Frame) body:
redirectsTo = if self.onAccess->oclIsUndefined() then OrderedSet{}
else self.onAccess.listeners.to->collect(p | p.oclIsKindOf(Frame))
endif

context Frame inv:
not self.allRedirectsTo()->includes(self)

enddefinitions
endlibrary
\end{oclcode}

Change log

r3010 by soundasleep on Jul 12, 2011   Diff
adding 'then' to OCL pygments
updating OCL example code
Go to: 
Project members, sign in to write a code review

Older revisions

r2347 by soundasleep on Jun 13, 2010   Diff
adding pygments styles for Crocopat,
LTL and OCL (initial implementations)
All revisions of this file

File info

Size: 977 bytes, 36 lines
Powered by Google Project Hosting