-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathExtendedOccurrences.kerml
More file actions
50 lines (45 loc) · 1.83 KB
/
ExtendedOccurrences.kerml
File metadata and controls
50 lines (45 loc) · 1.83 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package ExtendedOccurrences {
class Interval;
class Moment :> Interval;
class Timeslice {
feature interval : Interval;
:>> self : Timeslice;
}
class Snapshot :> Timeslice {
feature moment :>> interval : Moment;
:>> self : Snapshot;
}
class Life :> Timeslice;
class ExtendedOccurrence :> Life {
:>> timeSlices : Timeslice [1..*];
:>> snapshots :> timeSlices : Snapshot [1..*];
expr at {
:>> that : Timeslice;
in interval : Interval;
return result : Timeslice;
binding result.portionOf = that;
binding result.interval = interval;
}
expr while {
in timeslice : Timeslice;
return result : Timeslice = at(timeslice.interval);
}
var feature activeOccurrences :> Occurrences::occurrences {
connector : Occurrences::HappensDuring from [1] that to [1] self;
}
var feature activeSuboccurrences :> Occurrences::occurrences {
connector : Occurrences::HappensDuring from [1] that to [1] self;
}
// occurrences and performances are abstract package-level features.
// It would be nice to put the variable next to them, but they cannot
// be package-level, or featured by Anything. Nevertheless, since
// Occurrence is a specialization of Anything, it will have these
// features (might be worth redefining them explicitly), so the
// variables can subset them. In the case below, performances will
// contain every step in the occurrence, which is the correct domain
// for the variable.
var feature activePerformances :> Performances::performances {
connector : Occurrences::HappensDuring from [1] that to [1] self;
}
}
}