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,293 @@
|
|
|
1
|
+
standard library package Performances {
|
|
2
|
+
doc
|
|
3
|
+
/*
|
|
4
|
+
* This package defines classifiers and features that related to the typing of performances and evaluations.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
private import Base::Anything;
|
|
8
|
+
private import Base::things;
|
|
9
|
+
private import Occurrences::Occurrence;
|
|
10
|
+
private import Occurrences::occurrences;
|
|
11
|
+
private import Occurrences::HappensDuring;
|
|
12
|
+
private import Objects::Object;
|
|
13
|
+
private import Links::BinaryLink;
|
|
14
|
+
private import Metaobjects::Metaobject;
|
|
15
|
+
private import Transfers::Transfer;
|
|
16
|
+
private import Transfers::transfers;
|
|
17
|
+
private import Transfers::TransferBefore;
|
|
18
|
+
private import Transfers::transfersBefore;
|
|
19
|
+
private import ScalarValues::*;
|
|
20
|
+
private import SequenceFunctions::includes;
|
|
21
|
+
|
|
22
|
+
abstract behavior Performance specializes Occurrence disjoint from Object {
|
|
23
|
+
doc
|
|
24
|
+
/*
|
|
25
|
+
* Performance is the most general class of behavioral Occurrences that may be performed over time.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
feature self: Performance redefines Occurrence::self;
|
|
29
|
+
|
|
30
|
+
feature involvedObjects: Object[0..*] {
|
|
31
|
+
doc
|
|
32
|
+
/*
|
|
33
|
+
* Objects that are involved in this Performance.
|
|
34
|
+
*/
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
feature performers: Object[0..*] subsets involvedObjects {
|
|
38
|
+
doc
|
|
39
|
+
/*
|
|
40
|
+
* Objects that enact this Performance.
|
|
41
|
+
*/
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
feature redefines isDispatch default true;
|
|
45
|
+
feature redefines dispatchScope default thisPerformance;
|
|
46
|
+
|
|
47
|
+
step enclosedPerformances: Performance[0..*] subsets performances, timeEnclosedOccurrences
|
|
48
|
+
intersects performances, timeEnclosedOccurrences {
|
|
49
|
+
doc
|
|
50
|
+
/*
|
|
51
|
+
* timeEnclosedOccurrences of this Performance that are also Performances.
|
|
52
|
+
*/
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
feature thisPerformance: Performance [1] default self {
|
|
56
|
+
doc
|
|
57
|
+
/*
|
|
58
|
+
* Defaults to the root of the subperformance composition tree.
|
|
59
|
+
*/
|
|
60
|
+
}
|
|
61
|
+
connector :HappensDuring from [1] self to [1] thisPerformance;
|
|
62
|
+
|
|
63
|
+
composite step subperformances: Performance[0..*] subsets enclosedPerformances, suboccurrences
|
|
64
|
+
intersects enclosedPerformances, suboccurrences {
|
|
65
|
+
doc
|
|
66
|
+
/*
|
|
67
|
+
* enclosedPerformances that are composite.
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
feature redefines this default (that as Performance).this {
|
|
71
|
+
doc
|
|
72
|
+
/*
|
|
73
|
+
* The default "this" context of a subperformance is the same as that of its owning Performance.
|
|
74
|
+
* This means that the context for any Performance that is in a composition tree rooted
|
|
75
|
+
* in a Performance that is not itself owned by an Object is the root Performance. If the
|
|
76
|
+
* root Performance is an ownedPerformance of an Object, then that Object is the context.
|
|
77
|
+
*/
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
feature redefines thisPerformance default (that as Performance).thisPerformance;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
abstract function Evaluation specializes Performance {
|
|
85
|
+
doc
|
|
86
|
+
/*
|
|
87
|
+
* Evaluation is the most general class of functions that may be evaluated to compute
|
|
88
|
+
* a result.
|
|
89
|
+
*/
|
|
90
|
+
|
|
91
|
+
return result: Anything[0..*] nonunique;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
abstract predicate BooleanEvaluation specializes Evaluation {
|
|
95
|
+
doc
|
|
96
|
+
/*
|
|
97
|
+
* BooleanEvaluation is a specialization of Evaluation that is the most general class of
|
|
98
|
+
* Predicates that may be evaluated to produce a Boolean truth value.
|
|
99
|
+
*/
|
|
100
|
+
|
|
101
|
+
return : Boolean[1];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
abstract function MetadataAccessEvaluation specializes Evaluation {
|
|
105
|
+
doc
|
|
106
|
+
/*
|
|
107
|
+
* MetadataAccessEvaluation is a specialization of Evaluation for the case of MetadataAccessExpressions.
|
|
108
|
+
*/
|
|
109
|
+
|
|
110
|
+
return : Metaobject[1..*];
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
abstract function LiteralEvaluation specializes Evaluation {
|
|
114
|
+
doc
|
|
115
|
+
/*
|
|
116
|
+
* LiteralEvaluation is a specialization of Evaluation for the case of LiteralExpressions.
|
|
117
|
+
*/
|
|
118
|
+
|
|
119
|
+
return : ScalarValue[1];
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
abstract predicate LiteralBooleanEvaluation specializes LiteralEvaluation, BooleanEvaluation
|
|
123
|
+
intersects LiteralEvaluation, BooleanEvaluation {
|
|
124
|
+
doc
|
|
125
|
+
/*
|
|
126
|
+
* LiteralBooleanEvaluation is a specialization of LiteralEvaluation for the case of LiteralBooleans.
|
|
127
|
+
* It is also a predicate and thus a specialization of BooleanEvaluation.
|
|
128
|
+
*/
|
|
129
|
+
|
|
130
|
+
return : Boolean[1];
|
|
131
|
+
}
|
|
132
|
+
abstract function LiteralIntegerEvaluation specializes LiteralEvaluation {
|
|
133
|
+
doc
|
|
134
|
+
/*
|
|
135
|
+
* LiteralIntegerEvaluation is a specialization of LiteralEvaluation for the case of LiteralIntegers.
|
|
136
|
+
*/
|
|
137
|
+
|
|
138
|
+
return : Integer[1];
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
abstract function LiteralRationalEvaluation specializes LiteralEvaluation {
|
|
142
|
+
doc
|
|
143
|
+
/*
|
|
144
|
+
* LiteralRationalEvaluation is a specialization of LiteralEvaluation for the case of LiteralRationals.
|
|
145
|
+
* (Note: Return type is Real to allow easy type conformance of LiteralRationals when a Real result is expected.)
|
|
146
|
+
*/
|
|
147
|
+
|
|
148
|
+
return : Real[1];
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
abstract function LiteralStringEvaluation specializes LiteralEvaluation {
|
|
152
|
+
doc
|
|
153
|
+
/*
|
|
154
|
+
* LiteralStringEvaluation is a specialization of LiteralEvaluation for the case of LiteralStrings.
|
|
155
|
+
*/
|
|
156
|
+
|
|
157
|
+
return : String[1];
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function NullEvaluation specializes Evaluation {
|
|
161
|
+
doc
|
|
162
|
+
/*
|
|
163
|
+
* NullEvaluation is a specialization of Evaluation for the case of NullExpressions.
|
|
164
|
+
*/
|
|
165
|
+
|
|
166
|
+
return : Anything[0..0];
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
assoc all InvolvedIn specializes BinaryLink {
|
|
170
|
+
doc
|
|
171
|
+
/*
|
|
172
|
+
* InvolvedIn asserts that the involvedObject is involved in the Behavior carried out by the
|
|
173
|
+
* involvingPerformance.
|
|
174
|
+
*/
|
|
175
|
+
|
|
176
|
+
end feature involvedObject: Object redefines source crosses involvingPerformance.involvedObjects;
|
|
177
|
+
end feature involvingPerformance: Performance redefines target crosses involvedObject.involvingPerformances;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
assoc all Performs specializes InvolvedIn {
|
|
181
|
+
doc
|
|
182
|
+
/*
|
|
183
|
+
* Performs asserts that the performer enacts the Behavior carried out by the performance.
|
|
184
|
+
*/
|
|
185
|
+
|
|
186
|
+
end feature performerObject: Object redefines involvedObject crosses performance.performers;
|
|
187
|
+
end feature performance: Performance redefines involvingPerformance crosses performerObject.enactedPerformances;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
abstract step performances: Performance[0..*] nonunique subsets occurrences {
|
|
191
|
+
doc
|
|
192
|
+
/*
|
|
193
|
+
* performances is the most general feature for performances of Behaviors.
|
|
194
|
+
*/
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
abstract expr evaluations: Evaluation[0..*] nonunique subsets performances {
|
|
198
|
+
doc
|
|
199
|
+
/*
|
|
200
|
+
* evaluations is a specialization of performances for evaluations of Functions.
|
|
201
|
+
*/
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
abstract expr constructorEvaluations [0..*] nonunique subsets evaluations {
|
|
205
|
+
doc
|
|
206
|
+
/*
|
|
207
|
+
* constructorEvaluations is a specialization of evaluations that restricts the multiplicity
|
|
208
|
+
* of its result parameter to 1..1, requiring a constructorEvaluation to result in a single value.
|
|
209
|
+
*/
|
|
210
|
+
|
|
211
|
+
return result [1..1];
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
abstract expr booleanEvaluations: BooleanEvaluation[0..*] nonunique subsets evaluations {
|
|
215
|
+
doc
|
|
216
|
+
/*
|
|
217
|
+
* booleanEvaluations is a specialization of evaluations restricted to type BooleanEvaluation.
|
|
218
|
+
*/
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
abstract expr trueEvaluations subsets booleanEvaluations {
|
|
222
|
+
doc
|
|
223
|
+
/*
|
|
224
|
+
* trueEvaluations is a subset of booleanEvaluations that result in true. It is the most general
|
|
225
|
+
* feature of invariants that are not negated.
|
|
226
|
+
*/
|
|
227
|
+
|
|
228
|
+
private feature trueValue = true;
|
|
229
|
+
binding result = trueValue;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
abstract expr falseEvaluations subsets booleanEvaluations {
|
|
233
|
+
doc
|
|
234
|
+
/*
|
|
235
|
+
* falseEvaluations is a subset of booleanEvaluations that result in false. It is the most general
|
|
236
|
+
* feature of invariants that are negated.
|
|
237
|
+
*/
|
|
238
|
+
|
|
239
|
+
private feature falseValue = false;
|
|
240
|
+
binding result = falseValue;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
abstract expr metadataAccessEvaluations: MetadataAccessEvaluation[0..*] nonunique subsets evaluations {
|
|
244
|
+
doc
|
|
245
|
+
/*
|
|
246
|
+
* metadataAccessEvaluations is a specialization of evaluations restricted to type MetadataAccessEvaluation.
|
|
247
|
+
*/
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
abstract expr literalEvaluations: LiteralEvaluation[0..*] nonunique subsets evaluations {
|
|
251
|
+
doc
|
|
252
|
+
/*
|
|
253
|
+
* literalEvaluations is a specialization of evaluations restricted to type LiteralEvaluation.
|
|
254
|
+
*/
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
abstract expr literalBooleanEvaluations: LiteralBooleanEvaluation[0..*] nonunique subsets literalEvaluations, booleanEvaluations
|
|
258
|
+
intersects literalEvaluations, booleanEvaluations {
|
|
259
|
+
doc
|
|
260
|
+
/*
|
|
261
|
+
* literaBooleanlEvaluations is a specialization of literalEvaluations and booleanEvaluations restricted
|
|
262
|
+
* to type LiteralBooleanEvaluation.
|
|
263
|
+
*/
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
abstract expr literalIntegerEvaluations: LiteralIntegerEvaluation[0..*] nonunique subsets literalEvaluations {
|
|
267
|
+
doc
|
|
268
|
+
/*
|
|
269
|
+
* literalEvaluations is a specialization of evaluations restricted to type LiteralEvaluation.
|
|
270
|
+
*/
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
abstract expr literalRationalEvaluations: LiteralRationalEvaluation[0..*] nonunique subsets literalEvaluations {
|
|
274
|
+
doc
|
|
275
|
+
/*
|
|
276
|
+
* literalRationalEvaluations is a specialization of literalEvaluations restricted to type LiteralRationalEvaluation.
|
|
277
|
+
*/
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
abstract expr literalStringEvaluations: LiteralStringEvaluation[0..*] nonunique subsets literalEvaluations {
|
|
281
|
+
doc
|
|
282
|
+
/*
|
|
283
|
+
* literalStringEvaluations is a specialization of literalEvaluations restricted to type LiteralStringEvaluation.
|
|
284
|
+
*/
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
abstract expr nullEvaluations: NullEvaluation[0..*] nonunique subsets evaluations {
|
|
288
|
+
doc
|
|
289
|
+
/*
|
|
290
|
+
* nullEvaluations is a specialization of evaluations restricted to type NullEvaluation.
|
|
291
|
+
*/
|
|
292
|
+
}
|
|
293
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
standard library package RationalFunctions {
|
|
2
|
+
doc
|
|
3
|
+
/*
|
|
4
|
+
* This package defines Functions on Rational values, including concrete specializations of the
|
|
5
|
+
* general arithmetic and comparison operations.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
public import ScalarValues::*;
|
|
9
|
+
|
|
10
|
+
function rat { in numer: Integer[1]; in denum: Integer[1]; return : Rational[1]; }
|
|
11
|
+
function numer { in rat: Rational[1]; return : Integer[1]; }
|
|
12
|
+
function denom { in rat: Rational[1]; return : Integer[1]; }
|
|
13
|
+
|
|
14
|
+
function abs specializes RealFunctions::abs { in x: Rational[1]; return : Rational[1]; }
|
|
15
|
+
|
|
16
|
+
function '+' specializes RealFunctions::'+' { in x: Rational[1]; in y: Rational[0..1]; return : Rational[1]; }
|
|
17
|
+
function '-' specializes RealFunctions::'-' { in x: Rational[1]; in y: Rational[0..1]; return : Rational[1]; }
|
|
18
|
+
function '*' specializes RealFunctions::'*' { in x: Rational[1]; in y: Rational[1]; return : Rational[1]; }
|
|
19
|
+
function '/' specializes RealFunctions::'/' { in x: Rational[1]; in y: Rational[1]; return : Rational[1]; }
|
|
20
|
+
function '**' specializes RealFunctions::'**' { in x: Rational[1]; in y: Rational[1]; return : Rational[1]; }
|
|
21
|
+
function '^' specializes RealFunctions::'^' { in x: Rational[1]; in y: Rational[1]; return : Rational[1]; }
|
|
22
|
+
|
|
23
|
+
function '<' specializes RealFunctions::'<' { in x: Rational[1]; in y: Rational[1]; return : Boolean[1]; }
|
|
24
|
+
function '>' specializes RealFunctions::'>' { in x: Rational[1]; in y: Rational[1]; return : Boolean[1]; }
|
|
25
|
+
function '<=' specializes RealFunctions::'<=' { in x: Rational[1]; in y: Rational[1]; return : Boolean[1]; }
|
|
26
|
+
function '>=' specializes RealFunctions::'>=' { in x: Rational[1]; in y: Rational[1]; return : Boolean[1]; }
|
|
27
|
+
|
|
28
|
+
function max specializes RealFunctions::max { in x: Rational[1]; in y: Rational[1]; return : Rational[1]; }
|
|
29
|
+
function min specializes RealFunctions::min { in x: Rational[1]; in y: Rational[1]; return : Rational[1]; }
|
|
30
|
+
|
|
31
|
+
function '==' specializes RealFunctions::'==' { in x: Rational[0..1]; in y: Rational[0..1]; return : Boolean[1]; }
|
|
32
|
+
|
|
33
|
+
function gcd{ in x: Rational[1]; in y: Rational[1]; return : Integer[1]; }
|
|
34
|
+
|
|
35
|
+
function floor specializes RealFunctions::floor { in x: Rational[1]; return : Integer[1]; }
|
|
36
|
+
function round specializes RealFunctions::round { in x: Rational[1]; return : Integer[1]; }
|
|
37
|
+
|
|
38
|
+
function ToString specializes RealFunctions::ToString { in x: Rational[1]; return : String[1]; }
|
|
39
|
+
function ToInteger{ in x: Rational[1]; return : Integer[1]; }
|
|
40
|
+
function ToRational{ in x: String[1]; return : Rational[1]; }
|
|
41
|
+
|
|
42
|
+
function sum specializes RealFunctions::sum { in collection: Rational[0..*];
|
|
43
|
+
return : Rational[1] default NumericalFunctions::sum0(collection, rat(0, 1));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function product specializes RealFunctions::product { in collection: Rational[0..*];
|
|
47
|
+
return : Rational[1] default NumericalFunctions::product1(collection, rat(1, 1));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
standard library package RealFunctions {
|
|
2
|
+
doc
|
|
3
|
+
/*
|
|
4
|
+
* This package defines Functions on Real values, including concrete specializations of the
|
|
5
|
+
* general arithmetic and comparison operations.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
public import ScalarValues::*;
|
|
9
|
+
|
|
10
|
+
function re :> ComplexFunctions::re{ in x: Real[1];
|
|
11
|
+
return : Real[1] = x;
|
|
12
|
+
}
|
|
13
|
+
function im :> ComplexFunctions::im{ in x: Real[1];
|
|
14
|
+
return : Real[1] = 0.0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function abs specializes ComplexFunctions::abs { in x: Real[1]; return : Real[1]; }
|
|
18
|
+
function arg specializes ComplexFunctions::arg { in x: Real[1];
|
|
19
|
+
return : Real[1] = 0.0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function '+' specializes ComplexFunctions::'+' { in x: Real[1]; in y: Real[0..1]; return : Real[1]; }
|
|
23
|
+
function '-' specializes ComplexFunctions::'-' { in x: Real[1]; in y: Real[0..1]; return : Real[1]; }
|
|
24
|
+
function '*' specializes ComplexFunctions::'*' { in x: Real[1]; in y: Real[1]; return : Real[1]; }
|
|
25
|
+
function '/' specializes ComplexFunctions::'/' { in x: Real[1]; in y: Real[1]; return : Real[1]; }
|
|
26
|
+
function '**' specializes ComplexFunctions::'**' { in x: Real[1]; in y: Real[1]; return : Real[1]; }
|
|
27
|
+
function '^' specializes ComplexFunctions::'^' { in x: Real[1]; in y: Real[1]; return : Real[1]; }
|
|
28
|
+
|
|
29
|
+
function '<' specializes NumericalFunctions::'<' { in x: Real[1]; in y: Real[1]; return : Boolean[1]; }
|
|
30
|
+
function '>' specializes NumericalFunctions::'>' { in x: Real[1]; in y: Real[1]; return : Boolean[1]; }
|
|
31
|
+
function '<=' specializes NumericalFunctions::'<=' { in x: Real[1]; in y: Real[1]; return : Boolean[1]; }
|
|
32
|
+
function '>=' specializes NumericalFunctions::'>=' { in x: Real[1]; in y: Real[1]; return : Boolean[1]; }
|
|
33
|
+
|
|
34
|
+
function max specializes NumericalFunctions::max { in x: Real[1]; in y: Real[1]; return : Real[1]; }
|
|
35
|
+
function min specializes NumericalFunctions::min { in x: Real[1]; in y: Real[1]; return : Real[1]; }
|
|
36
|
+
|
|
37
|
+
function '==' specializes ComplexFunctions::'==' { in x: Real[0..1]; in y: Real[0..1]; return : Boolean[1]; }
|
|
38
|
+
|
|
39
|
+
function sqrt{ in x: Real[1]; return : Real[1]; }
|
|
40
|
+
|
|
41
|
+
function floor{ in x: Real[1]; return : Integer[1]; }
|
|
42
|
+
function round{ in x: Real[1]; return : Integer[1]; }
|
|
43
|
+
|
|
44
|
+
function ToString specializes ComplexFunctions::ToString { in x: Real[1]; return : String[1]; }
|
|
45
|
+
function ToInteger{ in x: Real[1]; return : Integer[1]; }
|
|
46
|
+
function ToRational{ in x: Real[1]; return : Rational[1]; }
|
|
47
|
+
function ToReal{ in x: String[1]; return : Real[1]; }
|
|
48
|
+
|
|
49
|
+
function sum specializes ComplexFunctions::sum { in collection: Real[0..*];
|
|
50
|
+
return : Real default NumericalFunctions::sum0(collection, 0.0);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function product specializes ComplexFunctions::product { in collection: Real[0..*];
|
|
54
|
+
return : Real default NumericalFunctions::product1(collection, 1.0);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
standard library package ScalarFunctions {
|
|
2
|
+
doc
|
|
3
|
+
/*
|
|
4
|
+
* This package defines abstract functions that specialize the DataFunctions for use with ScalarValues.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
public import ScalarValues::*;
|
|
8
|
+
|
|
9
|
+
abstract function '+' specializes DataFunctions::'+' { in x: ScalarValue[1]; in y: ScalarValue[0..1]; return : ScalarValue[1]; }
|
|
10
|
+
abstract function '-' specializes DataFunctions::'-' { in x: ScalarValue[1]; in y: ScalarValue[0..1]; return : ScalarValue[1]; }
|
|
11
|
+
abstract function '*' specializes DataFunctions::'*' { in x: ScalarValue[1]; in y: ScalarValue[1]; return : ScalarValue[1]; }
|
|
12
|
+
abstract function '/' specializes DataFunctions::'/' { in x: ScalarValue[1]; in y: ScalarValue[1]; return : ScalarValue[1]; }
|
|
13
|
+
abstract function '**' specializes DataFunctions::'**' { in x: ScalarValue[1]; in y: ScalarValue[1]; return : ScalarValue[1]; }
|
|
14
|
+
abstract function '^' specializes DataFunctions::'^' { in x: ScalarValue[1]; in y: ScalarValue[1]; return : ScalarValue[1]; }
|
|
15
|
+
abstract function '%' specializes DataFunctions::'%' { in x: ScalarValue[1]; in y: ScalarValue[1]; return : ScalarValue[1]; }
|
|
16
|
+
|
|
17
|
+
abstract function 'not' specializes DataFunctions::'not' { in x: ScalarValue[1]; return : ScalarValue[1]; }
|
|
18
|
+
abstract function 'xor' specializes DataFunctions::'xor' { in x: ScalarValue[1]; in y: ScalarValue[1]; return : ScalarValue[1]; }
|
|
19
|
+
|
|
20
|
+
abstract function '~' specializes DataFunctions::'~' { in x: ScalarValue[1]; return : ScalarValue[1]; }
|
|
21
|
+
abstract function '|' specializes DataFunctions::'|' { in x: ScalarValue[1]; in y: ScalarValue[1]; return : ScalarValue[1]; }
|
|
22
|
+
abstract function '&' specializes DataFunctions::'&' { in x: ScalarValue[1]; in y: ScalarValue[1]; return : ScalarValue[1]; }
|
|
23
|
+
|
|
24
|
+
abstract function '<' specializes DataFunctions::'<' { in x: ScalarValue[1]; in y: ScalarValue[1]; return : Boolean[1]; }
|
|
25
|
+
abstract function '>' specializes DataFunctions::'>' { in x: ScalarValue[1]; in y: ScalarValue[1]; return : Boolean[1]; }
|
|
26
|
+
abstract function '<=' specializes DataFunctions::'<=' { in x: ScalarValue[1]; in y: ScalarValue[1]; return : Boolean[1]; }
|
|
27
|
+
abstract function '>=' specializes DataFunctions::'>=' { in x: ScalarValue[1]; in y: ScalarValue[1]; return : Boolean[1]; }
|
|
28
|
+
|
|
29
|
+
abstract function max specializes DataFunctions::max { in x: ScalarValue[1]; in y: ScalarValue[1]; return : ScalarValue[1]; }
|
|
30
|
+
abstract function min specializes DataFunctions::min { in x: ScalarValue[1]; in y: ScalarValue[1]; return : ScalarValue[1]; }
|
|
31
|
+
|
|
32
|
+
abstract function '..' specializes DataFunctions::'..' { in lower: ScalarValue[1]; in upper: ScalarValue[1]; return : ScalarValue[0..*]; }
|
|
33
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
standard library package ScalarValues {
|
|
2
|
+
doc
|
|
3
|
+
/*
|
|
4
|
+
* This package contains a basic set of primitive scalar (non-collection) data types.
|
|
5
|
+
* These include Boolean and String types and a hierarchy of concrete Number types, from
|
|
6
|
+
* the most general type of Complex numbers to the most specific type of Positive integers.</p>
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
private import Base::DataValue;
|
|
10
|
+
|
|
11
|
+
abstract datatype ScalarValue specializes DataValue;
|
|
12
|
+
datatype Boolean specializes ScalarValue;
|
|
13
|
+
datatype String specializes ScalarValue;
|
|
14
|
+
abstract datatype NumericalValue specializes ScalarValue;
|
|
15
|
+
|
|
16
|
+
abstract datatype Number specializes NumericalValue;
|
|
17
|
+
datatype Complex specializes Number;
|
|
18
|
+
datatype Real specializes Complex;
|
|
19
|
+
datatype Rational specializes Real;
|
|
20
|
+
datatype Integer specializes Rational;
|
|
21
|
+
datatype Natural specializes Integer;
|
|
22
|
+
datatype Positive specializes Natural;
|
|
23
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
standard library package SequenceFunctions {
|
|
2
|
+
doc
|
|
3
|
+
/*
|
|
4
|
+
* This package defines functions that operate on general sequences of values. (For functions that
|
|
5
|
+
* operate on Collection values, see CollectionFunctions.)
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
private import Base::Anything;
|
|
9
|
+
private import Occurrences::SelfSameLifeLink;
|
|
10
|
+
private import ScalarValues::*;
|
|
11
|
+
private import ControlFunctions::*;
|
|
12
|
+
|
|
13
|
+
function '#' specializes BaseFunctions::'#' { in seq: Anything[0..*] ordered nonunique; in index: Positive[1];
|
|
14
|
+
return : Anything[0..1];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function equals{ in x: Anything[0..*] ordered nonunique; in y: Anything[0..*] ordered nonunique;
|
|
18
|
+
return : Boolean[1] =
|
|
19
|
+
size(x) == size(y) and
|
|
20
|
+
(1..size(x))->forAll {in i; x#(i) == y#(i)};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function same{ in x: Anything[0..*] ordered nonunique; in y: Anything[0..*] ordered nonunique;
|
|
24
|
+
return : Boolean[1] =
|
|
25
|
+
size(x) == size(y) and
|
|
26
|
+
(1..size(x))->forAll {in i; x#(i) === y#(i)};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function size{ in seq: Anything[0..*] nonunique;
|
|
30
|
+
return : Natural[1] = if isEmpty(seq)? 0 else size(tail(seq)) + 1;
|
|
31
|
+
}
|
|
32
|
+
function isEmpty{ in seq: Anything[0..*] nonunique;
|
|
33
|
+
return : Boolean[1] = seq == null;
|
|
34
|
+
}
|
|
35
|
+
function notEmpty{ in seq: Anything[0..*] nonunique;
|
|
36
|
+
return : Boolean[1] = not isEmpty(seq);
|
|
37
|
+
}
|
|
38
|
+
function includes{ in seq1: Anything[0..*] nonunique; in seq2: Anything[0..*] nonunique;
|
|
39
|
+
return : Boolean[1] = seq2->forAll {in x; seq1->exists{in y; x == y}};
|
|
40
|
+
}
|
|
41
|
+
function includesOnly{ in seq1: Anything[0..*] nonunique; in seq2: Anything[0..*] nonunique;
|
|
42
|
+
return : Boolean[1] = seq1->includes(seq2) and seq2->includes(seq1);
|
|
43
|
+
}
|
|
44
|
+
function excludes{ in seq1: Anything[0..*] nonunique; in seq2: Anything[0..*] nonunique;
|
|
45
|
+
return : Boolean[1] = seq2->forAll {in x; seq1->excludes(x)};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function union{ in seq1: Anything[0..*] ordered nonunique; in seq2: Anything[0..*] ordered nonunique;
|
|
49
|
+
return : Anything[0..*] ordered nonunique = (seq1, seq2);
|
|
50
|
+
}
|
|
51
|
+
function intersection{ in seq1: Anything[0..*] ordered nonunique; in seq2: Anything[0..*] ordered nonunique;
|
|
52
|
+
return : Anything[0..*] ordered nonunique = seq1->select {in x; seq2->includes(x)};
|
|
53
|
+
}
|
|
54
|
+
function including{ in seq: Anything[0..*] ordered nonunique; in values: Anything[0..*] ordered nonunique;
|
|
55
|
+
return : Anything[0..*] ordered nonunique = union(seq, values);
|
|
56
|
+
}
|
|
57
|
+
function includingAt{ in seq: Anything[0..*] ordered nonunique; in values: Anything[0..*] ordered nonunique;
|
|
58
|
+
in index: Positive[1];
|
|
59
|
+
return : Anything[0..*] ordered nonunique =
|
|
60
|
+
(seq->subsequence(1, index - 1), values, seq->subsequence(index + 1));
|
|
61
|
+
}
|
|
62
|
+
function excluding{ in seq: Anything[0..*] ordered nonunique; in values: Anything[0..*];
|
|
63
|
+
return : Anything[0..*] ordered nonunique = seq->reject {in x; values->includes(x)};
|
|
64
|
+
}
|
|
65
|
+
function excludingAt{ in seq: Anything[0..*] ordered nonunique;
|
|
66
|
+
in startIndex: Positive[1]; in endIndex: Positive[1] default startIndex;
|
|
67
|
+
return : Anything[0..*] ordered nonunique =
|
|
68
|
+
(seq->subsequence(1, startIndex - 1), seq->subsequence(endIndex + 1));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function subsequence{ in seq: Anything[0..*] ordered nonunique;
|
|
72
|
+
in startIndex: Positive[1]; in endIndex: Positive[1] default size(seq);
|
|
73
|
+
return : Anything[0..*] = (startIndex..endIndex)->collect {in i; seq#(i)};
|
|
74
|
+
}
|
|
75
|
+
function head{ in seq: Anything[0..*] ordered nonunique;
|
|
76
|
+
return : Anything[0..1] = seq#(1);
|
|
77
|
+
}
|
|
78
|
+
function tail{ in seq: Anything[0..*] ordered nonunique;
|
|
79
|
+
return : Anything[0..*] ordered nonunique = subsequence(seq, 2);
|
|
80
|
+
}
|
|
81
|
+
function last{ in seq: Anything[0..*] ordered nonunique;
|
|
82
|
+
return : Anything[0..1] = seq#(size(seq));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
behavior add { inout seq: Anything[0..*] ordered nonunique; in values: Anything[0..*] ordered nonunique;
|
|
86
|
+
private feature newSeq = seq->including(values);
|
|
87
|
+
feature redefines endShot: add {
|
|
88
|
+
binding seq = newSeq;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
behavior addAt { inout seq: Anything[0..*] ordered nonunique; in values: Anything[0..*] ordered nonunique;
|
|
92
|
+
in index: Positive[1];
|
|
93
|
+
private feature newSeq = seq->includingAt(values, index);
|
|
94
|
+
feature redefines endShot: addAt {
|
|
95
|
+
binding seq = newSeq;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
behavior remove{ inout seq: Anything[0..*] ordered nonunique; in values: Anything[0..*];
|
|
99
|
+
private feature newSeq = seq->excluding(values);
|
|
100
|
+
feature redefines endShot: remove {
|
|
101
|
+
binding seq = newSeq;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
behavior removeAt{ inout seq: Anything[0..*] ordered nonunique;
|
|
105
|
+
in startIndex: Positive[1]; in endIndex: Positive[1] default startIndex;
|
|
106
|
+
private feature newSeq = seq->excludingAt(startIndex, endIndex);
|
|
107
|
+
feature redefines endShot: removeAt {
|
|
108
|
+
binding seq = newSeq;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|