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,47 @@
|
|
|
1
|
+
standard library package ComplexFunctions {
|
|
2
|
+
doc
|
|
3
|
+
/*
|
|
4
|
+
* This package defines functions on Complex values, including concrete specializations of the
|
|
5
|
+
* general arithmetic and comparison operations.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
public import ScalarValues::*;
|
|
9
|
+
|
|
10
|
+
feature i: Complex[1] = rect(0.0, 1.0);
|
|
11
|
+
|
|
12
|
+
function rect { in re: Real[1]; in im: Real[1]; return : Complex[1]; }
|
|
13
|
+
function polar { in abs: Real[1]; in arg: Real[1]; return : Complex[1]; }
|
|
14
|
+
|
|
15
|
+
function re { in x: Complex[1]; return : Real[1]; }
|
|
16
|
+
function im { in x: Complex[1]; return : Real[1]; }
|
|
17
|
+
|
|
18
|
+
function isZero specializes NumericalFunctions::isZero { in x : Complex[1];
|
|
19
|
+
return : Boolean[1] = re(x) == 0.0 and im(x) == 0.0;
|
|
20
|
+
}
|
|
21
|
+
function isUnit specializes NumericalFunctions::isUnit { in x : Complex[1];
|
|
22
|
+
return : Boolean[1] = re(x) == 1.0 and im(x) == 0.0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function abs specializes NumericalFunctions::abs { in x: Complex[1]; return : Real[1]; }
|
|
26
|
+
function arg { in x: Complex[1]; return : Real[1]; }
|
|
27
|
+
|
|
28
|
+
function '+' specializes NumericalFunctions::'+' { in x: Complex[1]; in y: Complex[0..1]; return : Complex[1]; }
|
|
29
|
+
function '-' specializes NumericalFunctions::'-' { in x: Complex[1]; in y: Complex[0..1]; return : Complex[1]; }
|
|
30
|
+
function '*' specializes NumericalFunctions::'*' { in x: Complex[1]; in y: Complex[1]; return : Complex[1]; }
|
|
31
|
+
function '/' specializes NumericalFunctions::'/' { in x: Complex[1]; in y: Complex[1]; return : Complex[1]; }
|
|
32
|
+
function '**' specializes NumericalFunctions::'**' { in x: Complex[1]; in y: Complex[1]; return : Complex[1]; }
|
|
33
|
+
function '^' specializes NumericalFunctions::'^' { in x: Complex[1]; in y: Complex[1]; return : Complex[1]; }
|
|
34
|
+
|
|
35
|
+
function '==' specializes DataFunctions::'==' { in x: Complex[0..1]; in y: Complex[0..1]; return : Boolean[1]; }
|
|
36
|
+
|
|
37
|
+
function ToString specializes BaseFunctions::ToString { in x: Complex[1]; return : String[1]; }
|
|
38
|
+
function ToComplex { in x: String[1]; return : Complex[1]; }
|
|
39
|
+
|
|
40
|
+
function sum specializes NumericalFunctions::sum { in collection: Complex[0..*];
|
|
41
|
+
return : Complex[1] default NumericalFunctions::sum0(collection, rect(0.0, 0.0));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function product specializes NumericalFunctions::product { in collection: Complex[0..*];
|
|
45
|
+
return : Complex[1] default NumericalFunctions::product1(collection, rect(1.0, 0.0));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
standard library package ControlFunctions {
|
|
2
|
+
doc
|
|
3
|
+
/*
|
|
4
|
+
* This package defines functions that correspond to operators in the KerML expression notation
|
|
5
|
+
* for which one or more operands are expressions whose evaluation is determined by another operand.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
private import Base::Anything;
|
|
9
|
+
private import ScalarValues::ScalarValue;
|
|
10
|
+
private import ScalarValues::Boolean;
|
|
11
|
+
private import ScalarFunctions::min;
|
|
12
|
+
private import ScalarFunctions::max;
|
|
13
|
+
|
|
14
|
+
abstract function '.' {
|
|
15
|
+
in feature source : Anything[0..*] nonunique {
|
|
16
|
+
abstract feature target : Anything[0..*] nonunique;
|
|
17
|
+
}
|
|
18
|
+
private feature chain chains source.target;
|
|
19
|
+
chain
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
abstract function 'if' {
|
|
23
|
+
in test: Boolean[1];
|
|
24
|
+
in expr thenValue[0..1] { return : Anything[0..*] ordered nonunique; }
|
|
25
|
+
in expr elseValue[0..1] { return : Anything[0..*] ordered nonunique; }
|
|
26
|
+
return : Anything[0..*] ordered nonunique;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
abstract function '??' {
|
|
30
|
+
in firstValue: Anything[0..*] ordered nonunique;
|
|
31
|
+
in expr secondValue[0..1] { return : Anything[0..*] ordered nonunique; }
|
|
32
|
+
return : Anything[0..*] ordered nonunique;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function 'and' {
|
|
36
|
+
in firstValue: Boolean[1];
|
|
37
|
+
in expr secondValue[0..1] { return : Boolean[1]; }
|
|
38
|
+
return : Boolean[1];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function 'or'{
|
|
42
|
+
in firstValue: Boolean[1];
|
|
43
|
+
in expr secondValue[0..1] { return : Boolean[1]; }
|
|
44
|
+
return : Boolean[1];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function 'implies'{
|
|
48
|
+
in firstValue: Boolean[1];
|
|
49
|
+
in expr secondValue[0..1] { return : Boolean[1]; }
|
|
50
|
+
return : Boolean[1];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
abstract function collect {
|
|
54
|
+
in collection: Anything[0..*] ordered nonunique;
|
|
55
|
+
in expr mapper[0..*] { in argument: Anything[1]; return : Anything[0..*] ordered nonunique; }
|
|
56
|
+
return : Anything[0..*] ordered nonunique;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
abstract function select {
|
|
60
|
+
in collection: Anything[0..*] ordered nonunique;
|
|
61
|
+
in expr selector[0..*] { in argument: Anything[1]; return : Boolean[1]; }
|
|
62
|
+
return : Anything[0..*] ordered nonunique;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function selectOne {
|
|
66
|
+
in collection: Anything[0..*] ordered nonunique;
|
|
67
|
+
in expr selector1[0..*] { in argument: Anything[1]; return : Boolean[1]; }
|
|
68
|
+
return : Anything[0..1] = collection->select {in x; selector1(x)}#(1);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
abstract function reject{
|
|
72
|
+
in collection: Anything[0..*] ordered nonunique;
|
|
73
|
+
in expr rejector[0..*] { in argument: Anything[1]; return : Boolean[1]; }
|
|
74
|
+
return : Anything[0..*] ordered nonunique;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
abstract function reduce {
|
|
78
|
+
in collection: Anything[0..*] ordered nonunique;
|
|
79
|
+
in expr reducer[0..*] { in firstArg: Anything[1]; in secondArg: Anything[1]; return : Anything[1]; }
|
|
80
|
+
return : Anything[0..*] ordered nonunique;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
abstract function forAll {
|
|
84
|
+
in collection: Anything[0..*] ordered nonunique;
|
|
85
|
+
in expr test[0..*] { in argument: Anything[1]; return : Boolean[1]; }
|
|
86
|
+
return : Boolean[1];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
abstract function exists {
|
|
90
|
+
in collection: Anything[0..*] ordered nonunique;
|
|
91
|
+
in expr test[0..*] { in argument: Anything[1]; return : Boolean[1]; }
|
|
92
|
+
return : Boolean[1];
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function allTrue {
|
|
96
|
+
in collection: Boolean[0..*];
|
|
97
|
+
return : Boolean[1] = collection->forAll {in x; x};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function anyTrue {
|
|
101
|
+
in collection: Boolean[0..*];
|
|
102
|
+
return : Boolean[1] = collection->exists {in x; x};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function minimize {
|
|
106
|
+
in collection: ScalarValue[1..*];
|
|
107
|
+
in expr fn[0..*] { in argument: ScalarValue[1]; return : ScalarValue[1]; }
|
|
108
|
+
return : ScalarValue[1] = collection->collect {in x; fn(x)}->reduce min;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function maximize {
|
|
112
|
+
in collection: ScalarValue[1..*];
|
|
113
|
+
in expr fn[0..*] { in argument: ScalarValue[1]; return : ScalarValue[1]; }
|
|
114
|
+
return : ScalarValue = collection->collect {in x; fn(x)}->reduce max;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
standard library package ControlPerformances {
|
|
2
|
+
doc
|
|
3
|
+
/*
|
|
4
|
+
* This package defines Behaviors to be used to type Steps that control the sequencing of performance
|
|
5
|
+
* of other Steps.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
private import ScalarValues::Boolean;
|
|
9
|
+
private import SequenceFunctions::size;
|
|
10
|
+
private import SequenceFunctions::notEmpty;
|
|
11
|
+
private import Occurrences::Occurrence;
|
|
12
|
+
private import Occurrences::HappensBefore;
|
|
13
|
+
private import Occurrences::SelfSameLifeLink;
|
|
14
|
+
private import Performances::Performance;
|
|
15
|
+
private import Performances::BooleanEvaluation;
|
|
16
|
+
|
|
17
|
+
behavior DecisionPerformance specializes Performance {
|
|
18
|
+
doc
|
|
19
|
+
/*
|
|
20
|
+
* A DecisionPerformance is a Performance that represents the selection of one of the Successions
|
|
21
|
+
* that have the DecisionPerforance behavior as their source. All such Successions must subset the
|
|
22
|
+
* outgoingHBLink feature of the source DecisionPerformance. For each instance of DecisionPerformance,
|
|
23
|
+
* the outgoingHBLink is an instance of exactly one of the Successions, ordering the DecisionPerformance
|
|
24
|
+
* as happening before an instance of the target of that Succcession.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
feature outgoingHBLink: HappensBefore[1] {
|
|
28
|
+
doc
|
|
29
|
+
/*
|
|
30
|
+
* Specializations subset this by all
|
|
31
|
+
* successions going out of a decision step.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
end feature redefines earlierOccurrence subsets that;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
behavior MergePerformance specializes Performance {
|
|
39
|
+
doc
|
|
40
|
+
/*
|
|
41
|
+
* A MergePerformance is a Performance that represents the merging of all Successions that
|
|
42
|
+
* target the MergePerforance behavior. All such Successions must subset the incomingHBLink
|
|
43
|
+
* feature of the target MergePerformance. For each instance of MergePerformance, the
|
|
44
|
+
* incomingHBLink is an instance of exactly one of the Successions, ordering the
|
|
45
|
+
* MergePerformance as happening after an instance of the source of that Succession.
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
feature incomingHBLink: HappensBefore[1] {
|
|
49
|
+
doc
|
|
50
|
+
/*
|
|
51
|
+
* Specializations subset this by all
|
|
52
|
+
* successions coming into a merge step.
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
end feature redefines laterOccurrence subsets that;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
abstract behavior IfPerformance specializes Performance {
|
|
60
|
+
doc
|
|
61
|
+
/*
|
|
62
|
+
* An IfPerformance is a Performance that determines whether the ifTest evaluation result is true
|
|
63
|
+
* (by whether ifTrue has a value).
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
in ifTest : BooleanEvaluation[1];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
behavior IfThenPerformance specializes IfPerformance {
|
|
70
|
+
doc
|
|
71
|
+
/*
|
|
72
|
+
* An IfThenPerformance is an IfPerformance where the thenClause occurs after and only after the
|
|
73
|
+
* ifTest evaluation result is true.
|
|
74
|
+
*/
|
|
75
|
+
|
|
76
|
+
in redefines ifTest;
|
|
77
|
+
in thenClause : Occurrence[0..1];
|
|
78
|
+
succession [1] ifTest then [0..1] thenClause;
|
|
79
|
+
inv { ifTest() == thenClause->notEmpty() }
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
behavior IfElsePerformance specializes IfPerformance {
|
|
83
|
+
doc
|
|
84
|
+
/*
|
|
85
|
+
* An IfElsePerformance is an IfPerformance where the elseClause occurs after and only
|
|
86
|
+
* after the ifTest evaluation result is not true.
|
|
87
|
+
*/
|
|
88
|
+
|
|
89
|
+
in redefines ifTest;
|
|
90
|
+
in elseClause : Occurrence[0..1];
|
|
91
|
+
succession [1] ifTest then [0..1] elseClause;
|
|
92
|
+
inv { not ifTest() == elseClause->notEmpty() }
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
behavior IfThenElsePerformance specializes IfThenPerformance {
|
|
96
|
+
doc
|
|
97
|
+
/*
|
|
98
|
+
* An IfThenElsePerformance is an IfThenPerformance with an additional elseClause that
|
|
99
|
+
* occurs after and only after the ifTest evaluation is false.
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
in redefines ifTest;
|
|
103
|
+
in redefines thenClause;
|
|
104
|
+
in elseClause : Occurrence[0..1];
|
|
105
|
+
succession [1] ifTest then [0..1] elseClause;
|
|
106
|
+
inv { not ifTest() == elseClause->notEmpty() }
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
behavior LoopPerformance specializes Performance {
|
|
110
|
+
doc
|
|
111
|
+
/*
|
|
112
|
+
* A LoopPerformance is a Performance where the body occurs repeatedly in sequence (iterates)
|
|
113
|
+
* as long as the whileTest evaluation result is true before each iteration (and after the
|
|
114
|
+
* previous one, except the first time) and the untilTest evaluation result is not true after
|
|
115
|
+
* each iteration and before the next one (except the last one).
|
|
116
|
+
*/
|
|
117
|
+
|
|
118
|
+
in whileTest : BooleanEvaluation[1..*];
|
|
119
|
+
in body : Occurrence[0..*];
|
|
120
|
+
in untilTest : BooleanEvaluation[0..*];
|
|
121
|
+
|
|
122
|
+
step whileDecision : IfThenPerformance[1..*];
|
|
123
|
+
step untilDecision : IfElsePerformance[0..*];
|
|
124
|
+
|
|
125
|
+
binding [1] whileDecision.ifTest = [1] whileTest;
|
|
126
|
+
binding [1] whileDecision.thenClause = [1] body;
|
|
127
|
+
|
|
128
|
+
succession body then untilDecision;
|
|
129
|
+
|
|
130
|
+
binding [1] untilDecision.ifTest = [1] untilTest;
|
|
131
|
+
binding loopBack of [0..1] untilDecision.elseClause = [1] whileDecision;
|
|
132
|
+
|
|
133
|
+
inv { loopBack->size() == whileDecision->size() - 1 }
|
|
134
|
+
}
|
|
135
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
standard library package DataFunctions {
|
|
2
|
+
doc
|
|
3
|
+
/*
|
|
4
|
+
* This package defines the abstract base functions corresponding to all the unary and binary operators
|
|
5
|
+
* in the KerML expression notation that might be defined on various kinds of DataValues.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
private import Base::DataValue;
|
|
9
|
+
private import ScalarValues::Boolean;
|
|
10
|
+
private import ControlFunctions::reduce;
|
|
11
|
+
|
|
12
|
+
abstract function '==' specializes BaseFunctions::'==' { in x: DataValue[0..1]; in y: DataValue[0..1];
|
|
13
|
+
return : Boolean[1];
|
|
14
|
+
}
|
|
15
|
+
function '===' specializes BaseFunctions::'==='{ in x: DataValue[0..1]; in y: DataValue[0..1];
|
|
16
|
+
return : Boolean[1] = x == y;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
abstract function '+' { in x: DataValue[1]; in y: DataValue[0..1]; return : DataValue[1]; }
|
|
20
|
+
abstract function '-' { in x: DataValue[1]; in y: DataValue[0..1]; return : DataValue[1]; }
|
|
21
|
+
abstract function '*' { in x: DataValue[1]; in y: DataValue[1]; return : DataValue[1]; }
|
|
22
|
+
abstract function '/' { in x: DataValue[1]; in y: DataValue[1]; return : DataValue[1]; }
|
|
23
|
+
abstract function '**' { in x: DataValue[1]; in y: DataValue[1]; return : DataValue[1]; }
|
|
24
|
+
abstract function '^' { in x: DataValue[1]; in y: DataValue[1]; return : DataValue[1]; }
|
|
25
|
+
abstract function '%' { in x: DataValue[1]; in y: DataValue[1]; return : DataValue[1]; }
|
|
26
|
+
|
|
27
|
+
abstract function 'not' { in x: DataValue[1]; return : DataValue[1]; }
|
|
28
|
+
abstract function 'xor' { in x: DataValue[1]; in y: DataValue[1]; return : DataValue[1]; }
|
|
29
|
+
|
|
30
|
+
abstract function '~' { in x: DataValue[1]; return : DataValue[1]; }
|
|
31
|
+
abstract function '|' { in x: DataValue[1]; in y: DataValue[1]; return : DataValue[1]; }
|
|
32
|
+
abstract function '&' { in x: DataValue[1]; in y: DataValue[1]; return : DataValue[1]; }
|
|
33
|
+
|
|
34
|
+
abstract function '<' { in x: DataValue[1]; in y: DataValue[1]; return : Boolean[1]; }
|
|
35
|
+
abstract function '>' { in x: DataValue[1]; in y: DataValue[1]; return : Boolean[1]; }
|
|
36
|
+
abstract function '<=' { in x: DataValue[1]; in y: DataValue[1]; return : Boolean[1]; }
|
|
37
|
+
abstract function '>=' { in x: DataValue[1]; in y: DataValue[1]; return : Boolean[1]; }
|
|
38
|
+
|
|
39
|
+
abstract function max { in x: DataValue[1]; in y: DataValue[1]; return : DataValue[1]; }
|
|
40
|
+
abstract function min { in x: DataValue[1]; in y: DataValue[1]; return : DataValue[1]; }
|
|
41
|
+
|
|
42
|
+
abstract function '..' { in lower: DataValue[1]; in upper: DataValue[1]; return : DataValue[0..*] ordered; }
|
|
43
|
+
}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
standard library package FeatureReferencingPerformances {
|
|
2
|
+
doc
|
|
3
|
+
/*
|
|
4
|
+
* This package defines Behaviors used to read, write and monitor values of a referenced Feature of an
|
|
5
|
+
* Occurrence.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
private import Base::Anything;
|
|
9
|
+
private import Base::things;
|
|
10
|
+
private import Occurrences::Occurrence;
|
|
11
|
+
private import Occurrences::HappensWhile;
|
|
12
|
+
private import Occurrences::HappensBefore;
|
|
13
|
+
private import Occurrences::HappensJustBefore;
|
|
14
|
+
private import Occurrences::SelfSameLifeLink;
|
|
15
|
+
private import Performances::Performance;
|
|
16
|
+
private import Performances::Evaluation;
|
|
17
|
+
private import ScalarValues::Boolean;
|
|
18
|
+
private import SequenceFunctions::isEmpty;
|
|
19
|
+
private import SequenceFunctions::equals;
|
|
20
|
+
|
|
21
|
+
abstract behavior FeatureReferencingPerformance specializes Performance {
|
|
22
|
+
doc
|
|
23
|
+
/*
|
|
24
|
+
* A FeatureReferencingPerformance is the base Performance for specialized behaviors related
|
|
25
|
+
* to values of a referenced Feature of a given Occurrence, as identified in specializations
|
|
26
|
+
* of this Behavior.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
in abstract feature onOccurrence : Occurrence [1] {
|
|
30
|
+
doc
|
|
31
|
+
/*
|
|
32
|
+
* Occurrence with values for the referenced feature in specializations of this behavior.
|
|
33
|
+
*/
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
inout feature values : Anything [*] nonunique {
|
|
37
|
+
doc
|
|
38
|
+
/*
|
|
39
|
+
* Values of the referenced feature, as specified in specializations of this behavior.
|
|
40
|
+
*/
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
abstract behavior FeatureAccessPerformance specializes FeatureReferencingPerformance {
|
|
45
|
+
doc
|
|
46
|
+
/*
|
|
47
|
+
* A FeatureAccessPerformance is a FeatureReferencingPerformance where the result values
|
|
48
|
+
* are all the values of a feature of onOccurrence at the time the Performance ends. The
|
|
49
|
+
* feature is specified by restricting accessedFeature in specializations or usages.
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
in abstract feature onOccurrence : Occurrence {
|
|
53
|
+
abstract feature startingAt : Occurrence [1] subsets timeSlices {
|
|
54
|
+
abstract feature accessedFeature : Anything [*] nonunique;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
connector :HappensWhile from onOccurrence.startingAt.startShot to endShot {
|
|
59
|
+
doc
|
|
60
|
+
/*
|
|
61
|
+
* Requires some time slice of onOccurrence to start when this performance
|
|
62
|
+
* ends (this connector), with particular feature values (following connector).
|
|
63
|
+
* The feature is specified by restricting the onOccurrence::accessedFeature
|
|
64
|
+
* on usages of this behavior.
|
|
65
|
+
*/
|
|
66
|
+
}
|
|
67
|
+
connector :SelfSameLifeLink from onOccurrence.startingAt.accessedFeature to values;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
abstract function FeatureReadEvaluation specializes FeatureAccessPerformance, Evaluation {
|
|
71
|
+
doc
|
|
72
|
+
/*
|
|
73
|
+
* A FeatureReadEvaluation is a FeatureAccessPerformance that is a function providing as
|
|
74
|
+
* its result the values of a feature on an occurrence at the time its evaluation ends.
|
|
75
|
+
*/
|
|
76
|
+
|
|
77
|
+
in onOccurrence: Occurrence [1];
|
|
78
|
+
return resultValues : Anything [*] nonunique redefines result redefines values;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
abstract behavior FeatureWritePerformance specializes FeatureAccessPerformance {
|
|
82
|
+
doc
|
|
83
|
+
/*
|
|
84
|
+
* A FeatureWritePerformance is a FeatureAccessPerformance that assigns the values of a
|
|
85
|
+
* feature on an occurrence to the given replacementValues at time its performance ends.
|
|
86
|
+
*/
|
|
87
|
+
|
|
88
|
+
in feature onOccurrence : Occurrence[1] redefines onOccurrence;
|
|
89
|
+
inout feature replacementValues : Anything redefines values [*] nonunique;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
abstract behavior FeatureMonitorPerformance specializes FeatureReferencingPerformance {
|
|
93
|
+
doc
|
|
94
|
+
/*
|
|
95
|
+
* A FeatureMonitorPerformance is a FeatureReferencingPerformance that waits for values
|
|
96
|
+
* of monitoredFeature to change on onOccurrence from what they were when the performance
|
|
97
|
+
* started. The values before and after the change are given by beforeValues and afterValues.
|
|
98
|
+
*/
|
|
99
|
+
|
|
100
|
+
in feature redefines onOccurrence {
|
|
101
|
+
feature monitoredOccurrence : Occurrence [1] subsets timeSlices {
|
|
102
|
+
abstract feature monitoredFeature : Anything[*] nonunique;
|
|
103
|
+
feature beforeTimeSlice : Occurrence [1] subsets timeSlices {
|
|
104
|
+
feature redefines monitoredFeature;
|
|
105
|
+
}
|
|
106
|
+
feature afterSnapshot : Occurrence [1] subsets snapshots {
|
|
107
|
+
feature redefines monitoredFeature;
|
|
108
|
+
}
|
|
109
|
+
connector :HappensJustBefore from beforeTimeSlice to afterSnapshot;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
out feature afterValues redefines values;
|
|
113
|
+
out feature beforeValues : Anything[*] nonunique;
|
|
114
|
+
inv { not beforeValues->equals(afterValues) }
|
|
115
|
+
|
|
116
|
+
private connector : HappensWhile
|
|
117
|
+
from [1] onOccurrence.monitoredOccurrence.beforeTimeSlice.startShot to [1] startShot;
|
|
118
|
+
private connector : SelfSameLifeLink
|
|
119
|
+
from [1] onOccurrence.monitoredOccurrence.beforeTimeSlice.monitoredFeature to [1] beforeValues;
|
|
120
|
+
private connector : SelfSameLifeLink
|
|
121
|
+
from [1] onOccurrence.monitoredOccurrence.afterSnapshot.monitoredFeature to [1] afterValues;
|
|
122
|
+
protected connector endWhen : HappensBefore
|
|
123
|
+
from [1] onOccurrence.monitoredOccurrence.afterSnapshot to [1] endShot;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
behavior EvaluationResultMonitorPerformance specializes FeatureMonitorPerformance {
|
|
127
|
+
doc
|
|
128
|
+
/*
|
|
129
|
+
* An EvaluationResultMonitorPerformance is a FeatureMonitorPerformance that waits for changes
|
|
130
|
+
* in the result of an Evaluation identified by onOccurrence. The Predicate being evaluated must
|
|
131
|
+
* be able to produce multiple results over time, for example by only using BindingConnectors
|
|
132
|
+
* between Steps, rather than Successions or Flows, including in its Step behaviors.
|
|
133
|
+
*/
|
|
134
|
+
|
|
135
|
+
in feature onOccurrence : Evaluation redefines onOccurrence {
|
|
136
|
+
protected expr monitoredOccurrence : Evaluation [1] redefines monitoredOccurrence {
|
|
137
|
+
return result : Anything[*] redefines result, monitoredFeature;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
behavior BooleanEvaluationResultMonitorPerformance specializes EvaluationResultMonitorPerformance {
|
|
143
|
+
doc
|
|
144
|
+
/*
|
|
145
|
+
* A BooleanEvaluationResultMonitorPerformance is a EvaluationResultMonitorPerformance
|
|
146
|
+
* that waits for changes in the result of a BooleanEvaluation identified by onOccurrence.
|
|
147
|
+
*/
|
|
148
|
+
|
|
149
|
+
in bool redefines onOccurrence {
|
|
150
|
+
protected bool redefines monitoredOccurrence[1] {
|
|
151
|
+
return result : Boolean [1];
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
out redefines afterValues : Boolean [1];
|
|
155
|
+
out redefines beforeValues : Boolean [1];
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
behavior BooleanEvaluationResultToMonitorPerformance specializes FeatureReferencingPerformance {
|
|
159
|
+
doc
|
|
160
|
+
/*
|
|
161
|
+
* A BooleanEvaluationResultToMonitorPerformance is a FeatureReferencingPerformance that waits
|
|
162
|
+
* for the result of a BooleanEvaluation (identified by onOccurrence) to change to either true
|
|
163
|
+
* or false, as indicated by isToTrue (defaulting to true). If the result is already true (or false),
|
|
164
|
+
* the performance waits for the result to become false (or true) before waiting again for it to
|
|
165
|
+
* change back.
|
|
166
|
+
*/
|
|
167
|
+
|
|
168
|
+
in bool redefines onOccurrence;
|
|
169
|
+
feature isToTrue : Boolean [1] default true;
|
|
170
|
+
out afterValues: Boolean[1] redefines values = isToTrue;
|
|
171
|
+
private feature monitor1 : BooleanEvaluationResultMonitorPerformance [1] {
|
|
172
|
+
feature redefines endWhen : HappensJustBefore {
|
|
173
|
+
end feature earlierOccurrence;
|
|
174
|
+
end feature laterOccurrence;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
private feature monitor2 : BooleanEvaluationResultMonitorPerformance [1] {
|
|
178
|
+
feature redefines endWhen : HappensJustBefore {
|
|
179
|
+
end feature earlierOccurrence;
|
|
180
|
+
end feature laterOccurrence;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
private connector : HappensJustBefore from [1] monitor1 to [0..1] monitor2;
|
|
185
|
+
inv { isEmpty(monitor2) == (monitor1.afterValues == isToTrue) }
|
|
186
|
+
|
|
187
|
+
private binding [1] monitor1.onOccurrence = [1] onOccurrence;
|
|
188
|
+
private binding [1] monitor2.onOccurrence = [1] onOccurrence;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
standard library package IntegerFunctions {
|
|
2
|
+
doc
|
|
3
|
+
/*
|
|
4
|
+
* This package defines functions on Integer values, including concrete specializations of the
|
|
5
|
+
* general arithmetic and comparison operations.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
public import ScalarValues::*;
|
|
9
|
+
|
|
10
|
+
function abs specializes RationalFunctions::abs { in x: Integer[1]; return : Natural[1]; }
|
|
11
|
+
|
|
12
|
+
function '+' specializes RationalFunctions::'+' { in x: Integer[1]; in y: Integer[0..1]; return : Integer[1]; }
|
|
13
|
+
function '-' specializes RationalFunctions::'-' { in x: Integer[1]; in y: Integer[0..1]; return : Integer[1]; }
|
|
14
|
+
function '*' specializes RationalFunctions::'*' { in x: Integer[1]; in y: Integer[1]; return : Integer[1]; }
|
|
15
|
+
function '/' specializes RationalFunctions::'/' { in x: Integer[1]; in y: Integer[1]; return : Rational[1]; }
|
|
16
|
+
function '**' specializes RationalFunctions::'**' { in x: Integer[1]; in y: Natural[1]; return : Integer[1]; }
|
|
17
|
+
function '^' specializes RationalFunctions::'^' { in x: Integer[1]; in y: Natural[1]; return : Integer[1]; }
|
|
18
|
+
function '%' specializes NumericalFunctions::'%' { in x: Integer[1]; in y: Integer[1]; return : Integer[1]; }
|
|
19
|
+
|
|
20
|
+
function '<' specializes RationalFunctions::'<' { in x: Integer[1]; in y: Integer[1]; return : Boolean[1]; }
|
|
21
|
+
function '>' specializes RationalFunctions::'>' { in x: Integer[1]; in y: Integer[1]; return : Boolean[1]; }
|
|
22
|
+
function '<=' specializes RationalFunctions::'<=' { in x: Integer[1]; in y: Integer[1]; return : Boolean[1]; }
|
|
23
|
+
function '>=' specializes RationalFunctions::'>=' { in x: Integer[1]; in y: Integer[1]; return : Boolean[1]; }
|
|
24
|
+
|
|
25
|
+
function max specializes RationalFunctions::max { in x: Integer[1]; in y: Integer[1]; return : Integer[1]; }
|
|
26
|
+
function min specializes RationalFunctions::min { in x: Integer[1]; in y: Integer[1]; return : Integer[1]; }
|
|
27
|
+
|
|
28
|
+
function '==' specializes DataFunctions::'==' { in x: Integer[0..1]; in y: Integer[0..1]; return : Boolean[1]; }
|
|
29
|
+
|
|
30
|
+
function '..' specializes ScalarFunctions::'..' { in lower: Integer[1]; in upper: Integer[1]; return : Integer[0..*]; }
|
|
31
|
+
|
|
32
|
+
function ToString specializes RationalFunctions::ToString { in x: Integer[1]; return : String[1]; }
|
|
33
|
+
function ToNatural { in x: Integer[1]; return : Natural[1]; }
|
|
34
|
+
function ToInteger { in x: String[1]; return : Integer[1]; }
|
|
35
|
+
|
|
36
|
+
function sum specializes RationalFunctions::sum { in collection: Integer[0..*];
|
|
37
|
+
return : Integer[1] default NumericalFunctions::sum0(collection, 0);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function product specializes RationalFunctions::product { in collection: Integer[0..*];
|
|
41
|
+
return : Integer[1] default NumericalFunctions::product1(collection, 1);
|
|
42
|
+
}
|
|
43
|
+
}
|