Skip to content

Commit 131f3ab

Browse files
committed
Merge branch 'master' into ST6RI-178
2 parents 045e1af + 14f1d77 commit 131f3ab

454 files changed

Lines changed: 120253 additions & 65321 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

kerml/src/examples/KerML Spec Annex A Examples/A-3-8-ChangingFeatureValues.kerml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ package ChangingFeatureValuesModelToBeExecuted {
2323
}
2424

2525
struct Product {
26-
feature isPainted : Boolean [1] := false;
27-
feature isDry : Boolean [1] := true;
28-
feature isShipped : Boolean [1] := false;
26+
var feature isPainted : Boolean [1] := false;
27+
var feature isDry : Boolean [1] := true;
28+
var feature isShipped : Boolean [1] := false;
2929
}
3030

3131
behavior Paint {
@@ -80,9 +80,9 @@ package ChangingFeatureValuesExecution {
8080
private import FeatureReferencingPerformances::FeatureWritePerformance;
8181

8282
struct ProductTimeSlice specializes Product {
83-
readonly feature redefines isPainted;
84-
readonly feature redefines isDry;
85-
readonly feature redefines isShipped;
83+
feature redefines isPainted;
84+
feature redefines isDry;
85+
feature redefines isShipped;
8686
}
8787

8888
#atom

kerml/src/examples/Simple Tests/ArgumentResolution.kerml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ package ArgumentResolutionBug {
55

66
behavior B {
77
in feature x;
8-
out feature : A = A(x);
8+
out feature : A = new A(x);
99
}
1010

1111
class C {

kerml/src/examples/Simple Tests/Behaviors.kerml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ package Behaviors {
88
}
99
behavior B specializes A {
1010
in x1;
11-
out y1;
11+
out var y1;
12+
}
13+
class C {
14+
var z = A().y;
15+
step a : A;
16+
binding z = a.y;
1217
}
1318
}

kerml/src/examples/Simple Tests/Expressions.kerml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ package Expressions {
5656
bb : Boolean = f.s(1);
5757

5858
class C {
59-
count : ScalarValues::Integer := 0;
59+
var count : ScalarValues::Integer := 0;
6060
}
6161

6262
feature obj1 : C;
@@ -70,6 +70,6 @@ package Expressions {
7070
feature count : ScalarValues::Integer = c#(1).count;
7171
}
7272

73-
feature l = L();
73+
feature l = new L();
7474
feature w1 = w(xx);
7575
}

kerml/src/examples/Simple Tests/Features.kerml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,24 @@ package Features {
4949
feature guardian[1];
5050
}
5151

52-
classifier RegisteredAsset {
53-
composite readonly feature identifier[0..1];
54-
}
55-
56-
classifier Vehicle :> RegisteredAsset {
57-
derived feature vin[1] = identifier;
58-
}
59-
52+
class RegisteredAsset {
53+
composite var feature identifier[0..1];
54+
}
55+
56+
classifier Vehicle :> RegisteredAsset {
57+
derived var feature vin[1] = identifier;
58+
59+
var feature v : Vehicle;
60+
binding vin = v.vin;
61+
var feature w = v.vin;
62+
63+
feature x = vin;
64+
binding x = vin;
65+
}
6066
feature legalIdentification;
6167

6268
specialization Redef redefinition LegalRecord::guardian redefines parent;
63-
specialization redefinition Vehicle::vin redefines RegisteredAsset::identifier;
69+
specialization redefinition Vehicle::vin redefines RegisteredAsset::identifier;
6470

6571
redefinition Vehicle::vin redefines legalIdentification;
6672
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package Scoping {
2+
package P1 {
3+
class A {
4+
feature f;
5+
}
6+
package P2 {
7+
class A {
8+
feature g;
9+
}
10+
package P3 {
11+
class B :> A {
12+
feature :>> g;
13+
}
14+
}
15+
}
16+
package Objects {
17+
class Object {
18+
feature test1;
19+
}
20+
}
21+
package '$' {
22+
class Objects {
23+
class Object {
24+
feature test2;
25+
}
26+
}
27+
}
28+
package P4 {
29+
class C :> Objects::Object {
30+
feature :>> test1;
31+
}
32+
class D :> '$'::Objects::Object {
33+
feature :>> test2;
34+
}
35+
class E :> $::Objects::Object {
36+
feature :>> subobjects;
37+
}
38+
}
39+
}
40+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package ExtendedOccurrences {
2+
class Interval;
3+
class Moment :> Interval;
4+
class Timeslice {
5+
feature interval : Interval;
6+
:>> self : Timeslice;
7+
}
8+
class Snapshot :> Timeslice {
9+
feature moment :>> interval : Moment;
10+
:>> self : Snapshot;
11+
}
12+
class Life :> Timeslice;
13+
class ExtendedOccurrence :> Life {
14+
:>> timeSlices : Timeslice [1..*];
15+
:>> snapshots :> timeSlices : Snapshot [1..*];
16+
expr at {
17+
:>> that : Timeslice;
18+
in interval : Interval;
19+
return result : Timeslice;
20+
21+
binding result.portionOf = that;
22+
binding result.interval = interval;
23+
}
24+
25+
expr while {
26+
in timeslice : Timeslice;
27+
return result : Timeslice = at(timeslice.interval);
28+
}
29+
30+
var feature activeOccurrences :> Occurrences::occurrences {
31+
connector : Occurrences::HappensDuring from [1] that to [1] self;
32+
}
33+
34+
var feature activeSuboccurrences :> Occurrences::occurrences {
35+
connector : Occurrences::HappensDuring from [1] that to [1] self;
36+
}
37+
38+
// occurrences and performances are abstract package-level features.
39+
// It would be nice to put the variable next to them, but they cannot
40+
// be package-level, or featured by Anything. Nevertheless, since
41+
// Occurrence is a specialization of Anything, it will have these
42+
// features (might be worth redefining them explicitly), so the
43+
// variables can subset them. In the case below, performances will
44+
// contain every step in the occurrence, which is the correct domain
45+
// for the variable.
46+
var feature activePerformances :> Performances::performances {
47+
connector : Occurrences::HappensDuring from [1] that to [1] self;
48+
}
49+
}
50+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package Moments {
2+
private import Occurrences::Life;
3+
private import Occurrences::Occurrence;
4+
5+
class Eternity specializes Life {
6+
// Nothing before/after or outside.
7+
// Could be many of these, see universal below.
8+
redefines predecessors [0];
9+
redefines successors [0];
10+
redefines outsideOfOccurrences [0];
11+
}
12+
13+
class UniversalEternity [1] specializes Eternity {
14+
redefines timeSlices: Period; //Includes life.
15+
redefines snapshots : Moment;
16+
}
17+
18+
feature universalEternity : UniversalEternity [1];
19+
20+
class Period { //Includes life and snapshots.
21+
//↓↓ With UE redef, exactly UE timeslices.
22+
redefines timeSliceOf : UniversalEternity [1];
23+
}
24+
25+
class all InstantOccurrence specializes Occurrence {
26+
// Probly useful elsewhere, eg, to type snapshots.
27+
redefines snapshots [1]; // Or startShot subsets endShot;
28+
} // Or middleTimeslice [0];
29+
30+
class Moment specializes Period, InstantOccurrence {
31+
//↓↓ With UE redef, exactly UE snapshots.
32+
redefines snapshotOf : UniversalEternity [1]; }
33+
34+
private import Occurrence::spaceTimeCoincidentOccurrences;
35+
//UE portion "corresponding" to an occurrence.
36+
feature coincidentUEPortion : Occurrence [1] subsets spaceTimeCoincidentOccurrences,
37+
universalEternity.portions
38+
featured by Occurrence;
39+
}
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
package TimeVaryingFeaturesEnhanced {
2+
private import ExtendedOccurrences::*;
3+
4+
class CC1 :> ExtendedOccurrence {
5+
var feature x;
6+
//member feature x featured by CC1_snapshots {
7+
// member feature CC1_snapshots :>> ExtendedOccurrences::ExtendedOccurrence::snapshots featured by CC1;
8+
//}
9+
10+
// portions are not variable
11+
portion :>> startShot {
12+
var feature :>> x = 0;
13+
//member feature :>> CC1::x featured by CC1_startShot_snapshots = 0 {
14+
// member feature CC1_startShot_snapshots :>> CC1_snapshots featured by CC1::startShot;
15+
//}
16+
}
17+
18+
portion t :> timeSlices {
19+
var feature y;
20+
//member feature y featured by CC1_t_snapshots {
21+
// member feature CC1_t_snapshots :>> ExtendedOccurrences::ExtendedOccurrence::snapshots featured by CC1::t;
22+
//}
23+
portion :>> startShot {
24+
var feature :>> x = 0;
25+
//member feature :>> CC1::x featured by CC1_t_startShot_snapshots = 0 {
26+
// member feature CC1_t_startShot_snapshots :>> CC1_snapshots featured by CC1::t::startShot;
27+
//}
28+
var feature :>> y = 1;
29+
//member feature :>> CC1::t::y featured by CC1_t_startShot_snapshots = 1 {
30+
// member feature CC1_t_startShot_snapshots :>> CC1_t_snapshots featured by CC1::t::startShot;
31+
//}
32+
}
33+
portion t1 :> timeSlices {
34+
portion :>> startShot {
35+
var feature :>> x = 2;
36+
//member feature :>> CC1::x featured by CC1_t_t1_startShot_snapshots = 2 {
37+
// member feature CC1_t_t1_startShot_snapshots :>> CC1_snapshots featured by CC1::t::t1::startShot;
38+
//}
39+
var feature :>> y = 3;
40+
//member feature :>> CC1::t::y featured by CC1_t_t1_startShot_snapshots = 3 {
41+
// member feature CC1_t_t1_startShot_snapshots :>> CC1_t_snapshots featured by CC1::t::t1::startShot;
42+
//}
43+
}
44+
}
45+
}
46+
}
47+
48+
private import ScalarValues::Boolean;
49+
private import ScalarValues::Real;
50+
51+
class Car :> ExtendedOccurrence {
52+
var feature driver : Person [0..1];
53+
//member feature driver : Person [0..1] featured by Car_snapshots {
54+
// member feature Car_snapshots :>> ExtendedOccurrences::ExtendedOccurrence::snapshots featured by Car;
55+
//}
56+
var feature speed : Real [1];
57+
//member feature speed : Real [1] featured by Car_snapshots {
58+
// member feature Car_snapshots :>> ExtendedOccurrences::ExtendedOccurrence::snapshots featured by Car;
59+
//}
60+
61+
// bind the current speed to the current speed of the current driver
62+
// var binding driver.speed = speed;
63+
//member connector : Links::SelfLink featured by Car_snapshots {
64+
// :>> that : Car_snapshots;
65+
// end feature :>> thisThing references that.driver.while{interval = Car_snapshots::self}.speed;
66+
// end feature :>> thisThing references that.driver.at{timeslices = Car_snapshots::self.moment}.speed;
67+
// end feature :>> sameThing references that.speed;
68+
// member feature Car_snapshots :>> ExtendedOccurrences::ExtendedOccurrence::snapshots featured by Car;
69+
//}
70+
71+
portion operated [0..*] :> timeSlices {
72+
var feature :>> driver [1];
73+
//member feature :>> Car::driver [1] featured by Car_operated_snapshots {
74+
// member feature Car_operated_snapshots :>> Car_snapshots featured by Car::operated;
75+
76+
// var feature :>> isLicensed = true;
77+
// member feature isLicensed1 :>> Person::isLicensed featured by Car_operated_driver_snapshots = true {
78+
// member feature Car_operated_driver_snapshots :>> Person_snapshots featured by Car::operated::driver;
79+
// }
80+
//}
81+
82+
//portion :>> snapshots {
83+
// public import operated;
84+
//}
85+
}
86+
87+
var feature engine [1];
88+
//member feature engine [1] featured by Car_snapshots {
89+
// member feature Car_snapshots :>> ExtendedOccurrences::ExtendedOccurrence::snapshots featured by Car;
90+
//}
91+
92+
var feature transmission [1];
93+
//member feature transmission [1] featured by Car_snapshots {
94+
// member feature Car_snapshots :>> ExtendedOccurrences::ExtendedOccurrence::snapshots featured by Car;
95+
//}
96+
97+
var connector drive from engine to transmission;
98+
//member connector drive featured by Car_snapshots from engine to transmission {
99+
// member feature Car_snapshots :>> ExtendedOccurrences::ExtendedOccurrence::snapshots :> engine::Car_snapshots, transmission::Car_snapshots featured by Car;
100+
//}
101+
102+
portion inOperable [0..1] :> timeSlices;
103+
104+
// successions are not variable
105+
succession first operated then inOperable;
106+
}
107+
108+
class Person :> ExtendedOccurrence {
109+
var feature isLicensed : Boolean[0..1];
110+
//member feature isLicensed : Boolean[0..1] featured by Person_snapshots {
111+
// member feature Person_snapshots :>> ExtendedOccurrences::ExtendedOccurrence::snapshots featured by Person;
112+
//}
113+
var feature speed : Real[1];
114+
//member feature speed : Real[1] featured by Person_snapshots {
115+
// member feature Person_snapshots :>> ExtendedOccurrences::ExtendedOccurrence::snapshots featured by Person;
116+
//}
117+
}
118+
119+
struct Car1 :> ExtendedOccurrence { // May or may not be a life
120+
var feature driver : Person [0..1];
121+
//member feature driver : Person [0..1] featured by Car_snapshots {
122+
// member feature Car_snapshots :>> ExtendedOccurrences::ExtendedOccurrence::snapshots featured by Car1;
123+
//}
124+
125+
// :>> timeSlices : Car; <-- Don't do this!
126+
127+
portion :>> startShot { // Not a kind of Car!
128+
var feature :>> driver [0];
129+
//member feature :>> driver : Person [0] featured by Car_startShot_snapshots {
130+
// member feature Car_startShot_snapshots :>> Car_snapshots featured by Car1::startShot;
131+
//}
132+
}
133+
134+
succession first startShot then driven;
135+
136+
portion driven :> timeSlices {
137+
var feature :>> driver [1];
138+
// No conflict with multiplicity! (driven just can't be startshot)
139+
//member feature :>> driver : Person [1] featured by Car_driven_snapshots {
140+
// member feature Car_driven_snapshots :>> Car_snapshots featured by Car1::driven;
141+
//}
142+
}
143+
}
144+
145+
}

0 commit comments

Comments
 (0)