sysmlpy 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sysmlpy/__init__.py +226 -0
- sysmlpy/__main__.py +75 -0
- sysmlpy/antlr/README.md +146 -0
- sysmlpy/antlr/SysMLv2Lexer.interp +695 -0
- sysmlpy/antlr/SysMLv2Lexer.py +1123 -0
- sysmlpy/antlr/SysMLv2Lexer.tokens +444 -0
- sysmlpy/antlr/SysMLv2Parser.interp +960 -0
- sysmlpy/antlr/SysMLv2Parser.py +40750 -0
- sysmlpy/antlr/SysMLv2Parser.tokens +444 -0
- sysmlpy/antlr/SysMLv2ParserListener.py +4485 -0
- sysmlpy/antlr/SysMLv2ParserVisitor.py +2498 -0
- sysmlpy/antlr/src/sysmlpy/grammar/antlr4/SysMLv2Lexer.interp +695 -0
- sysmlpy/antlr/src/sysmlpy/grammar/antlr4/SysMLv2Lexer.py +1123 -0
- sysmlpy/antlr/src/sysmlpy/grammar/antlr4/SysMLv2Lexer.tokens +444 -0
- sysmlpy/antlr_parser.py +185 -0
- sysmlpy/antlr_visitor.py +10864 -0
- sysmlpy/definition.py +1115 -0
- sysmlpy/examples/attribute_values.py +161 -0
- sysmlpy/examples/part_attributes.py +139 -0
- sysmlpy/examples/tuples_sequences.py +231 -0
- sysmlpy/formatting.py +47 -0
- sysmlpy/grammar/antlr4/README.md +30 -0
- sysmlpy/grammar/antlr4/SysMLv2Lexer.g4 +931 -0
- sysmlpy/grammar/antlr4/SysMLv2Lexer.interp +695 -0
- sysmlpy/grammar/antlr4/SysMLv2Lexer.py +1123 -0
- sysmlpy/grammar/antlr4/SysMLv2Lexer.tokens +444 -0
- sysmlpy/grammar/antlr4/SysMLv2Parser.g4 +2432 -0
- sysmlpy/grammar/antlr4/SysMLv2Parser.interp +960 -0
- sysmlpy/grammar/antlr4/SysMLv2Parser.py +40750 -0
- sysmlpy/grammar/antlr4/SysMLv2Parser.tokens +444 -0
- sysmlpy/grammar/antlr4/SysMLv2ParserListener.py +4485 -0
- sysmlpy/grammar/antlr4/SysMLv2ParserVisitor.py +2498 -0
- sysmlpy/grammar/antlr4/desc.xml +7 -0
- sysmlpy/grammar/antlr4/examples/camera.sysml +14 -0
- sysmlpy/grammar/antlr4/examples/toaster-system.sysml +193 -0
- sysmlpy/grammar/antlr4/examples/vehicle-model.sysml +118 -0
- sysmlpy/grammar/antlr4/pom.xml +59 -0
- sysmlpy/grammar/classes.py +8610 -0
- sysmlpy/library/LICENSE +165 -0
- sysmlpy/library/README.md +52 -0
- sysmlpy/library/__init__.py +0 -0
- sysmlpy/library/domain/Analysis/AnalysisTooling.sysml +34 -0
- sysmlpy/library/domain/Analysis/SampledFunctions.sysml +119 -0
- sysmlpy/library/domain/Analysis/StateSpaceRepresentation.sysml +143 -0
- sysmlpy/library/domain/Analysis/TradeStudies.sysml +171 -0
- sysmlpy/library/domain/Cause and Effect/CausationConnections.sysml +83 -0
- sysmlpy/library/domain/Cause and Effect/CauseAndEffect.sysml +81 -0
- sysmlpy/library/domain/Geometry/ShapeItems.sysml +899 -0
- sysmlpy/library/domain/Geometry/SpatialItems.sysml +168 -0
- sysmlpy/library/domain/Metadata/ImageMetadata.sysml +78 -0
- sysmlpy/library/domain/Metadata/ModelingMetadata.sysml +143 -0
- sysmlpy/library/domain/Metadata/ParametersOfInterestMetadata.sysml +39 -0
- sysmlpy/library/domain/Metadata/RiskMetadata.sysml +100 -0
- sysmlpy/library/domain/Quantities and Units/ISQ.sysml +42 -0
- sysmlpy/library/domain/Quantities and Units/ISQAcoustics.sysml +439 -0
- sysmlpy/library/domain/Quantities and Units/ISQAtomicNuclear.sysml +2726 -0
- sysmlpy/library/domain/Quantities and Units/ISQBase.sysml +206 -0
- sysmlpy/library/domain/Quantities and Units/ISQCharacteristicNumbers.sysml +1991 -0
- sysmlpy/library/domain/Quantities and Units/ISQChemistryMolecular.sysml +1353 -0
- sysmlpy/library/domain/Quantities and Units/ISQCondensedMatter.sysml +1223 -0
- sysmlpy/library/domain/Quantities and Units/ISQElectromagnetism.sysml +2333 -0
- sysmlpy/library/domain/Quantities and Units/ISQInformation.sysml +958 -0
- sysmlpy/library/domain/Quantities and Units/ISQLight.sysml +1537 -0
- sysmlpy/library/domain/Quantities and Units/ISQMechanics.sysml +1564 -0
- sysmlpy/library/domain/Quantities and Units/ISQSpaceTime.sysml +1169 -0
- sysmlpy/library/domain/Quantities and Units/ISQThermodynamics.sysml +1256 -0
- sysmlpy/library/domain/Quantities and Units/MeasurementRefCalculations.sysml +30 -0
- sysmlpy/library/domain/Quantities and Units/MeasurementReferences.sysml +526 -0
- sysmlpy/library/domain/Quantities and Units/Quantities.sysml +107 -0
- sysmlpy/library/domain/Quantities and Units/QuantityCalculations.sysml +70 -0
- sysmlpy/library/domain/Quantities and Units/SI.sysml +378 -0
- sysmlpy/library/domain/Quantities and Units/SIPrefixes.sysml +48 -0
- sysmlpy/library/domain/Quantities and Units/TensorCalculations.sysml +50 -0
- sysmlpy/library/domain/Quantities and Units/Time.sysml +274 -0
- sysmlpy/library/domain/Quantities and Units/USCustomaryUnits.sysml +260 -0
- sysmlpy/library/domain/Quantities and Units/VectorCalculations.sysml +62 -0
- sysmlpy/library/domain/Requirement Derivation/DerivationConnections.sysml +63 -0
- sysmlpy/library/domain/Requirement Derivation/RequirementDerivation.sysml +39 -0
- sysmlpy/library/kernel/Base.kerml +95 -0
- sysmlpy/library/kernel/BaseFunctions.kerml +80 -0
- sysmlpy/library/kernel/BooleanFunctions.kerml +22 -0
- sysmlpy/library/kernel/Clocks.kerml +156 -0
- sysmlpy/library/kernel/CollectionFunctions.kerml +68 -0
- sysmlpy/library/kernel/Collections.kerml +147 -0
- sysmlpy/library/kernel/ComplexFunctions.kerml +47 -0
- sysmlpy/library/kernel/ControlFunctions.kerml +117 -0
- sysmlpy/library/kernel/ControlPerformances.kerml +135 -0
- sysmlpy/library/kernel/DataFunctions.kerml +43 -0
- sysmlpy/library/kernel/FeatureReferencingPerformances.kerml +190 -0
- sysmlpy/library/kernel/IntegerFunctions.kerml +43 -0
- sysmlpy/library/kernel/KerML.kerml +483 -0
- sysmlpy/library/kernel/Links.kerml +67 -0
- sysmlpy/library/kernel/Metaobjects.kerml +58 -0
- sysmlpy/library/kernel/NaturalFunctions.kerml +27 -0
- sysmlpy/library/kernel/NumericalFunctions.kerml +43 -0
- sysmlpy/library/kernel/Objects.kerml +212 -0
- sysmlpy/library/kernel/Observation.kerml +161 -0
- sysmlpy/library/kernel/OccurrenceFunctions.kerml +154 -0
- sysmlpy/library/kernel/Occurrences.kerml +992 -0
- sysmlpy/library/kernel/Performances.kerml +293 -0
- sysmlpy/library/kernel/RationalFunctions.kerml +49 -0
- sysmlpy/library/kernel/RealFunctions.kerml +56 -0
- sysmlpy/library/kernel/ScalarFunctions.kerml +33 -0
- sysmlpy/library/kernel/ScalarValues.kerml +23 -0
- sysmlpy/library/kernel/SequenceFunctions.kerml +111 -0
- sysmlpy/library/kernel/SpatialFrames.kerml +197 -0
- sysmlpy/library/kernel/StatePerformances.kerml +145 -0
- sysmlpy/library/kernel/StringFunctions.kerml +25 -0
- sysmlpy/library/kernel/Transfers.kerml +281 -0
- sysmlpy/library/kernel/TransitionPerformances.kerml +66 -0
- sysmlpy/library/kernel/TrigFunctions.kerml +35 -0
- sysmlpy/library/kernel/Triggers.kerml +188 -0
- sysmlpy/library/kernel/VectorFunctions.kerml +273 -0
- sysmlpy/library/kernel/VectorValues.kerml +64 -0
- sysmlpy/library/systems/Actions.sysml +552 -0
- sysmlpy/library/systems/Allocations.sysml +29 -0
- sysmlpy/library/systems/AnalysisCases.sysml +38 -0
- sysmlpy/library/systems/Attributes.sysml +25 -0
- sysmlpy/library/systems/Calculations.sysml +37 -0
- sysmlpy/library/systems/Cases.sysml +71 -0
- sysmlpy/library/systems/Connections.sysml +60 -0
- sysmlpy/library/systems/Constraints.sysml +44 -0
- sysmlpy/library/systems/Flows.sysml +126 -0
- sysmlpy/library/systems/Interfaces.sysml +89 -0
- sysmlpy/library/systems/Items.sysml +153 -0
- sysmlpy/library/systems/Metadata.sysml +32 -0
- sysmlpy/library/systems/Parts.sysml +81 -0
- sysmlpy/library/systems/Ports.sysml +54 -0
- sysmlpy/library/systems/Requirements.sysml +194 -0
- sysmlpy/library/systems/StandardViewDefinitions.sysml +123 -0
- sysmlpy/library/systems/States.sysml +103 -0
- sysmlpy/library/systems/SysML.sysml +539 -0
- sysmlpy/library/systems/UseCases.sysml +57 -0
- sysmlpy/library/systems/VerificationCases.sysml +103 -0
- sysmlpy/library/systems/Views.sysml +164 -0
- sysmlpy/navigate.py +272 -0
- sysmlpy/store.py +547 -0
- sysmlpy/usage.py +2978 -0
- sysmlpy-0.1.0.dist-info/METADATA +230 -0
- sysmlpy-0.1.0.dist-info/RECORD +143 -0
- sysmlpy-0.1.0.dist-info/WHEEL +4 -0
- sysmlpy-0.1.0.dist-info/entry_points.txt +3 -0
- sysmlpy-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
standard library package Objects {
|
|
2
|
+
doc
|
|
3
|
+
/*
|
|
4
|
+
* This package defines classifiers and features that are related to the typing of objects, including link objects.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
private import Base::Anything;
|
|
8
|
+
private import Base::things;
|
|
9
|
+
private import Links::*;
|
|
10
|
+
private import Occurrences::Occurrence;
|
|
11
|
+
private import Occurrences::occurrences;
|
|
12
|
+
private import Occurrences::HappensLink;
|
|
13
|
+
private import Occurrences::SelfSameLifeLink;
|
|
14
|
+
private import Occurrences::WithinBoth;
|
|
15
|
+
private import Performances::Performance;
|
|
16
|
+
private import Performances::performances;
|
|
17
|
+
private import SequenceFunctions::isEmpty;
|
|
18
|
+
private import SequenceFunctions::notEmpty;
|
|
19
|
+
private import SequenceFunctions::union;
|
|
20
|
+
private import CollectionFunctions::contains;
|
|
21
|
+
private import ScalarValues::Integer;
|
|
22
|
+
private import ScalarValues::Natural;
|
|
23
|
+
|
|
24
|
+
abstract struct Object specializes Occurrence {
|
|
25
|
+
doc
|
|
26
|
+
/*
|
|
27
|
+
* Object is the most general class of structural occurrences that may change over time.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
feature self: Object redefines Occurrence::self;
|
|
31
|
+
|
|
32
|
+
composite feature subobjects: Object[0..*] subsets objects, suboccurrences
|
|
33
|
+
intersects objects, suboccurrences {
|
|
34
|
+
doc
|
|
35
|
+
/*
|
|
36
|
+
* The suboccurrences of this Object that are also Objects.
|
|
37
|
+
*/
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
feature involvingPerformances: Performance[0..*] subsets performances {
|
|
41
|
+
doc
|
|
42
|
+
/*
|
|
43
|
+
* Performances in which this object is involved.
|
|
44
|
+
*/
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
abstract step enactedPerformances: Performance[0..*] subsets involvingPerformances, timeEnclosedOccurrences
|
|
48
|
+
intersects involvingPerformances, timeEnclosedOccurrences {
|
|
49
|
+
doc
|
|
50
|
+
/*
|
|
51
|
+
* Performances that are enacted by this object.
|
|
52
|
+
*/
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
composite step ownedPerformances: Performance[0..*] subsets involvingPerformances, timeEnclosedOccurrences, suboccurrences
|
|
56
|
+
intersects involvingPerformances, timeEnclosedOccurrences, suboccurrences {
|
|
57
|
+
doc
|
|
58
|
+
/*
|
|
59
|
+
* Performances that are owned by this object.
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
feature redefines this default that {
|
|
63
|
+
doc
|
|
64
|
+
/*
|
|
65
|
+
* The owning object is the default "this" reference for all ownedPerformances.
|
|
66
|
+
*/
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
portion structuredSpaceBoundary : StructuredSpaceObject[0..1] subsets spaceBoundary {
|
|
71
|
+
doc
|
|
72
|
+
/*
|
|
73
|
+
* A space boundary that is a structured space object.
|
|
74
|
+
*/
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
abstract assoc struct LinkObject specializes Link, Object intersects Link, Object {
|
|
79
|
+
doc
|
|
80
|
+
/*
|
|
81
|
+
* LinkObject is the most general association structure, being both a Link and an Object.
|
|
82
|
+
*/
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
assoc struct BinaryLinkObject specializes BinaryLink, LinkObject intersects BinaryLink, LinkObject {
|
|
86
|
+
doc
|
|
87
|
+
/*
|
|
88
|
+
* BinaryLinkObject is the most general binary association structure, being both a
|
|
89
|
+
* BinaryLink and a LinkObject.
|
|
90
|
+
*/
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
abstract feature objects: Object[0..*] nonunique subsets occurrences {
|
|
94
|
+
doc
|
|
95
|
+
/*
|
|
96
|
+
* objects is a specialization of occurrences restricted to type Object.
|
|
97
|
+
*/
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
abstract feature linkObjects: LinkObject[0..*] nonunique subsets links, objects intersects links, objects {
|
|
101
|
+
doc
|
|
102
|
+
/*
|
|
103
|
+
* linkObjects is a specializations of links and objects restricted to type LinkObjects.
|
|
104
|
+
*/
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
abstract feature binaryLinkObjects: BinaryLinkObject[0..*] nonunique subsets binaryLinks, linkObjects
|
|
108
|
+
intersects binaryLinks, linkObjects {
|
|
109
|
+
doc
|
|
110
|
+
/*
|
|
111
|
+
* binaryLinkObjects is a specialization of binaryLinks and linkObjects restricted to
|
|
112
|
+
* type BinaryLinkObjects.
|
|
113
|
+
*/
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
struct all Body specializes Object {
|
|
118
|
+
doc
|
|
119
|
+
/*
|
|
120
|
+
* A Body is an Object of inner space dimension 3.
|
|
121
|
+
*/
|
|
122
|
+
|
|
123
|
+
feature redefines innerSpaceDimension = 3;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
struct all Surface specializes Object {
|
|
127
|
+
doc
|
|
128
|
+
/*
|
|
129
|
+
* A Surface is an Object of inner space dimension 2.
|
|
130
|
+
*/
|
|
131
|
+
|
|
132
|
+
feature redefines innerSpaceDimension = 2;
|
|
133
|
+
/* The number of "holes" in this Surface, assuming it isClosed. */
|
|
134
|
+
feature genus : Natural[0..1] default 0;
|
|
135
|
+
|
|
136
|
+
inv { notEmpty(genus) implies isClosed }
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
struct all Curve specializes Object {
|
|
140
|
+
doc
|
|
141
|
+
/*
|
|
142
|
+
* A Curve is an Object of inner space dimension 1.
|
|
143
|
+
*/
|
|
144
|
+
|
|
145
|
+
feature redefines innerSpaceDimension = 1;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
struct all Point specializes Object {
|
|
149
|
+
doc
|
|
150
|
+
/*
|
|
151
|
+
* A Point is an Object of inner space dimension 0.
|
|
152
|
+
*/
|
|
153
|
+
|
|
154
|
+
feature redefines innerSpaceDimension = 0;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
abstract struct StructuredSpaceObject specializes Object {
|
|
158
|
+
doc
|
|
159
|
+
/*
|
|
160
|
+
* A StructuredSpaceObject is an Object that is broken up into smaller structured space objects (cells) of
|
|
161
|
+
* the same or lower inner space dimension: faces that are surfaces, edges that are curves, and vertices
|
|
162
|
+
* that are points, with edges and vertices on the boundary of faces, and vertices on the boundary of
|
|
163
|
+
* edges. Cells meet when a structured space object is closed, as required to be a space boundary of
|
|
164
|
+
* an object (faces meet at their edges and/or vertices, while edges meet at their vertices). The
|
|
165
|
+
* inner space dimension of structured space object is the highest of their cells.
|
|
166
|
+
*/
|
|
167
|
+
|
|
168
|
+
abstract portion feature structuredSpaceObjectCells : StructuredSpaceObject[1..*] subsets Occurrence::spaceSlices {
|
|
169
|
+
feature cellOrientation : Integer [0..1];
|
|
170
|
+
inv { notEmpty(cellOrientation) implies (cellOrientation >= -1 & cellOrientation <= 1) }
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
comment about StructuredSurface, StructuredCurve, StructuredPoint
|
|
174
|
+
/*
|
|
175
|
+
* The structures StructuredSurface, StructuredCurve and StructuredPoint provide common, necessary redefinitions of
|
|
176
|
+
* innerSpaceDimension. They also provide single types for the StructuredSpaceObject features faces, edges and
|
|
177
|
+
* vertices, which avoids problems when these features are related by connectors with ends that have owned
|
|
178
|
+
* cross features.
|
|
179
|
+
*/
|
|
180
|
+
struct StructuredSurface specializes StructuredSpaceObject, Surface {
|
|
181
|
+
feature redefines StructuredSpaceObject::innerSpaceDimension, Surface::innerSpaceDimension;
|
|
182
|
+
}
|
|
183
|
+
struct StructuredCurve specializes StructuredSpaceObject, Curve {
|
|
184
|
+
feature redefines StructuredSpaceObject::innerSpaceDimension, Curve::innerSpaceDimension;
|
|
185
|
+
}
|
|
186
|
+
struct StructuredPoint specializes StructuredSpaceObject, Point {
|
|
187
|
+
feature redefines StructuredSpaceObject::innerSpaceDimension, Point::innerSpaceDimension;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
portion feature faces : StructuredSurface[0..*] ordered subsets structuredSpaceObjectCells {
|
|
191
|
+
feature redefines that : StructuredSpaceObject;
|
|
192
|
+
feature redefines edges subsets that.edges;
|
|
193
|
+
feature redefines vertices subsets that.vertices;
|
|
194
|
+
derived feature redefines spaceBoundary;
|
|
195
|
+
inv { isEmpty(spaceBoundary) == isEmpty(union(edges, vertices)) }
|
|
196
|
+
inv { notEmpty(spaceBoundary) implies contains(spaceBoundary.unionsOf, union(edges, vertices)) }
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
portion feature edges : StructuredCurve[0..*] ordered subsets structuredSpaceObjectCells {
|
|
200
|
+
feature redefines that : StructuredSpaceObject;
|
|
201
|
+
feature redefines vertices subsets that.vertices;
|
|
202
|
+
derived feature redefines spaceBoundary;
|
|
203
|
+
inv { isEmpty(spaceBoundary) == isEmpty(vertices) }
|
|
204
|
+
inv { notEmpty(spaceBoundary) implies contains(spaceBoundary.unionsOf, vertices) }
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
portion feature vertices : StructuredPoint[0..*] ordered subsets structuredSpaceObjectCells;
|
|
208
|
+
|
|
209
|
+
derived feature redefines innerSpaceDimension =
|
|
210
|
+
if notEmpty(faces) ? 2 else if notEmpty(edges) ? 1 else 0;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
standard library package Observation {
|
|
2
|
+
doc
|
|
3
|
+
/*
|
|
4
|
+
* This package models a framework for monitoring Boolean conditions and notifying
|
|
5
|
+
* registered observers when they change from false to true.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
private import ScalarValues::Boolean;
|
|
9
|
+
private import Occurrences::Occurrence;
|
|
10
|
+
private import Occurrences::Life;
|
|
11
|
+
private import SequenceFunctions::including;
|
|
12
|
+
private import SequenceFunctions::excluding;
|
|
13
|
+
private import ControlFunctions::select;
|
|
14
|
+
private import ControlPerformances::DecisionPerformance;
|
|
15
|
+
private import ControlPerformances::IfThenPerformance;
|
|
16
|
+
private import FeatureReferencingPerformances::FeatureWritePerformance;
|
|
17
|
+
private import FeatureReferencingPerformances::BooleanEvaluationResultToMonitorPerformance;
|
|
18
|
+
private import Transfers::TransferBefore;
|
|
19
|
+
|
|
20
|
+
private struct DefaultMonitorLife[1] :> ChangeMonitor, Life {
|
|
21
|
+
doc
|
|
22
|
+
/*
|
|
23
|
+
* DefaultMonitorLife is the classifier of the singleton Life of the defaultMonitor.
|
|
24
|
+
*/
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
feature defaultMonitor[1] : DefaultMonitorLife {
|
|
28
|
+
doc
|
|
29
|
+
/*
|
|
30
|
+
* defaultMonitor is a single ChangeMonitor that can be used as a default.
|
|
31
|
+
*/
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
struct ChangeSignal {
|
|
35
|
+
doc
|
|
36
|
+
/*
|
|
37
|
+
* A ChangeSignal is a signal to be sent when the Boolean result of its
|
|
38
|
+
* changeCondition Expression changes from false to true.
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
bool signalCondition {
|
|
42
|
+
doc
|
|
43
|
+
/*
|
|
44
|
+
* A BooleanExpression whose result is being monitored.
|
|
45
|
+
*/
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
feature signalMonitor : ChangeMonitor {
|
|
49
|
+
doc
|
|
50
|
+
/*
|
|
51
|
+
* The ChangeMonitor responsible for monitoring the signalCondition.
|
|
52
|
+
*/
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
private behavior ObserveChange {
|
|
57
|
+
doc
|
|
58
|
+
/*
|
|
59
|
+
* Each Performance of ObserveChange waits for the result of the Boolean
|
|
60
|
+
* condition of a given ChangeSignal to change from false to true, and, when
|
|
61
|
+
* it does, sends the ChangeSignal to a given observer Occurrence.
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
in feature changeObserver : Occurrence[1];
|
|
65
|
+
in feature changeSignal : ChangeSignal[1];
|
|
66
|
+
|
|
67
|
+
composite step wait : IfThenPerformance {
|
|
68
|
+
doc
|
|
69
|
+
/*
|
|
70
|
+
* If the result of the changeSignal.signalCondition is false, then wait for
|
|
71
|
+
* it to become true.
|
|
72
|
+
*/
|
|
73
|
+
|
|
74
|
+
in bool redefines ifTest {
|
|
75
|
+
not changeSignal.signalCondition()
|
|
76
|
+
}
|
|
77
|
+
in step redefines thenClause : BooleanEvaluationResultToMonitorPerformance {
|
|
78
|
+
in bool onOccurrence = changeSignal.signalCondition;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
succession wait then transfer;
|
|
83
|
+
|
|
84
|
+
step transfer : TransferBefore[1]
|
|
85
|
+
redefines outgoingTransfersFromSelf
|
|
86
|
+
subsets changeObserver.incomingTransfers {
|
|
87
|
+
doc
|
|
88
|
+
/*
|
|
89
|
+
* Then send changeSignal to changeObserver.
|
|
90
|
+
*/
|
|
91
|
+
|
|
92
|
+
end feature source {
|
|
93
|
+
feature redefines sourceOutput = changeSignal;
|
|
94
|
+
}
|
|
95
|
+
end feature target;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
struct ChangeMonitor {
|
|
100
|
+
doc
|
|
101
|
+
/*
|
|
102
|
+
* A ChangeMonitor is a collection of ongoing ChangeSignal observations
|
|
103
|
+
* for various observer Occurrences. It provides convenient operations for
|
|
104
|
+
* starting and canceling the observations it manages.
|
|
105
|
+
*/
|
|
106
|
+
|
|
107
|
+
private thisMonitor : ChangeMonitor redefines self;
|
|
108
|
+
private composite feature observations[0..*] : ObserveChange;
|
|
109
|
+
|
|
110
|
+
private behavior AssignObservations specializes FeatureWritePerformance {
|
|
111
|
+
doc
|
|
112
|
+
/*
|
|
113
|
+
* Assign a replacement set of observations as those being managed by a
|
|
114
|
+
* given ChangeMonitor.
|
|
115
|
+
*/
|
|
116
|
+
|
|
117
|
+
in feature monitor : ChangeMonitor redefines onOccurrence {
|
|
118
|
+
feature redefines startingAt {
|
|
119
|
+
feature redefines accessedFeature, observations;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
inout feature redefines replacementValues[0..*] : ObserveChange;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
step startObservation {
|
|
126
|
+
doc
|
|
127
|
+
/*
|
|
128
|
+
* Start an observation of a given ChangeSignal for a given Occurrence.
|
|
129
|
+
*/
|
|
130
|
+
|
|
131
|
+
in observer : Occurrence[1];
|
|
132
|
+
in signal : ChangeSignal[1];
|
|
133
|
+
private composite step observation : ObserveChange {
|
|
134
|
+
in changeObserver = observer;
|
|
135
|
+
in changeSignal = signal;
|
|
136
|
+
}
|
|
137
|
+
private composite step addObservation : AssignObservations[1] {
|
|
138
|
+
in monitor = thisMonitor;
|
|
139
|
+
inout replacementValues = observations->including(observation);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
step cancelObservation {
|
|
144
|
+
doc
|
|
145
|
+
/*
|
|
146
|
+
* Cancel all observations of a given ChangeSignal for a given Occurrence.
|
|
147
|
+
*/
|
|
148
|
+
|
|
149
|
+
in observer : Occurrence[1];
|
|
150
|
+
in signal : ChangeSignal[1];
|
|
151
|
+
private feature observations[0..*] : ObserveChange =
|
|
152
|
+
observations->select{in observation : ObserveChange;
|
|
153
|
+
observation.changeObserver == observer and observation.changeSignal == signal
|
|
154
|
+
};
|
|
155
|
+
private composite step removeObservation : AssignObservations[1] {
|
|
156
|
+
in monitor = thisMonitor;
|
|
157
|
+
inout replacementValues = observations->excluding(observations);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
standard library package OccurrenceFunctions {
|
|
2
|
+
doc
|
|
3
|
+
/*
|
|
4
|
+
* This package defines utility functions that operate on occurrences, primarily related to
|
|
5
|
+
* time during which those occurrences exist.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
private import Occurrences::Occurrence;
|
|
9
|
+
private import Occurrences::HappensDuring;
|
|
10
|
+
private import ScalarValues::Boolean;
|
|
11
|
+
private import ScalarValues::Positive;
|
|
12
|
+
private import SequenceFunctions::notEmpty;
|
|
13
|
+
private import SequenceFunctions::size;
|
|
14
|
+
private import SequenceFunctions::add;
|
|
15
|
+
private import SequenceFunctions::addAt;
|
|
16
|
+
private import SequenceFunctions::remove;
|
|
17
|
+
private import SequenceFunctions::removeAt;
|
|
18
|
+
private import ControlFunctions::forAll;
|
|
19
|
+
|
|
20
|
+
function '===' specializes BaseFunctions::'===' {
|
|
21
|
+
doc
|
|
22
|
+
/*
|
|
23
|
+
* Test whether two occurrences are portions of the same life. That is, whether they
|
|
24
|
+
* represent different portions of the same entity (colloquially, whether they have
|
|
25
|
+
* the same "identity").
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
in x: Occurrence[0..1];
|
|
29
|
+
in y: Occurrence[0..1];
|
|
30
|
+
|
|
31
|
+
return : Boolean[1] = x.portionOfLife == y.portionOfLife;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function isDuring {
|
|
35
|
+
doc
|
|
36
|
+
/*
|
|
37
|
+
* Test whether a performance of this function happens during the input occurrence.
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
in occ: Occurrence[1];
|
|
41
|
+
|
|
42
|
+
private connector all during: HappensDuring[0..1] from self to occ;
|
|
43
|
+
|
|
44
|
+
return : Boolean[1] = notEmpty(during);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function create {
|
|
48
|
+
doc
|
|
49
|
+
/*
|
|
50
|
+
* Ensure that the start of a given occurrence happens during a performance of this
|
|
51
|
+
* function. The occurrence is also returned from the function.
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
inout occ: Occurrence[1];
|
|
55
|
+
|
|
56
|
+
private connector : HappensDuring from occ.startShot to self;
|
|
57
|
+
|
|
58
|
+
return : Occurrence[1] = occ;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function destroy {
|
|
62
|
+
doc
|
|
63
|
+
/*
|
|
64
|
+
* Ensure that the end of a given occurrence happens during a performance of this
|
|
65
|
+
* function. The occurrence is also returned from the function.
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
inout occ: Occurrence[0..1];
|
|
69
|
+
|
|
70
|
+
private connector : HappensDuring from [0..1] occ.endShot to self;
|
|
71
|
+
|
|
72
|
+
return : Occurrence[0..1] = occ;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function addNew {
|
|
76
|
+
doc
|
|
77
|
+
/*
|
|
78
|
+
* Add a newly created occurrence to the given group of occurrences and return the
|
|
79
|
+
* new occurrence.
|
|
80
|
+
*/
|
|
81
|
+
|
|
82
|
+
inout group: Occurrence[0..*] nonunique;
|
|
83
|
+
inout occ: Occurrence[1];
|
|
84
|
+
|
|
85
|
+
private composite step : add {
|
|
86
|
+
inout seq1 = group;
|
|
87
|
+
in seq2 = create(occ);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return : Occurrence[1] = occ;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function addNewAt {
|
|
94
|
+
doc
|
|
95
|
+
/*
|
|
96
|
+
* Add a newly created occurrence to the given ordered group of occurrences at the given
|
|
97
|
+
* index and return the new occurrence.
|
|
98
|
+
*/
|
|
99
|
+
|
|
100
|
+
inout group: Occurrence[0..*] ordered nonunique;
|
|
101
|
+
inout occ: Occurrence[1];
|
|
102
|
+
in index: Positive[1];
|
|
103
|
+
|
|
104
|
+
private composite step : addAt {
|
|
105
|
+
inout seq = group;
|
|
106
|
+
in values = create(occ);
|
|
107
|
+
in startIndex = index;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return : Occurrence[1] = occ;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
behavior removeOld {
|
|
114
|
+
doc
|
|
115
|
+
/*
|
|
116
|
+
* Remove a given occurrence from a group of occurrences and destroy it.
|
|
117
|
+
*/
|
|
118
|
+
|
|
119
|
+
inout group: Occurrence[0..*] nonunique;
|
|
120
|
+
inout occ: Occurrence[0..1];
|
|
121
|
+
|
|
122
|
+
private composite step removeStep : remove {
|
|
123
|
+
inout seq = group;
|
|
124
|
+
in values = occ;
|
|
125
|
+
}
|
|
126
|
+
private succession removeStep then destroyStep;
|
|
127
|
+
private composite step destroyStep : destroy {
|
|
128
|
+
inout occ = removeOld::occ;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
behavior removeOldAt {
|
|
134
|
+
doc
|
|
135
|
+
/*
|
|
136
|
+
* Removes the occurrence at a given index in an ordered group of occurrences
|
|
137
|
+
* and destroy it.
|
|
138
|
+
*/
|
|
139
|
+
inout group: Occurrence[0..*] ordered nonunique;
|
|
140
|
+
in index: Positive[1];
|
|
141
|
+
|
|
142
|
+
private feature oldOcc = group#(index);
|
|
143
|
+
|
|
144
|
+
private composite step removeStep : remove {
|
|
145
|
+
inout seq = group;
|
|
146
|
+
in index = removeOldAt::index;
|
|
147
|
+
}
|
|
148
|
+
private succession removeStep then destroyStep;
|
|
149
|
+
private composite step destroyStep : destroy {
|
|
150
|
+
inout occ = oldOcc;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
}
|
|
154
|
+
}
|