sysml-validate 0.11.0 → 0.14.3
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.
- package/LICENSE +27 -27
- package/README.md +200 -200
- package/out/main.js +598 -142
- package/out/main.js.map +4 -4
- package/package.json +57 -57
- package/resources/sysml.dimension-table.json +1 -1
- package/resources/sysml.library/Domain Libraries/Analysis/.meta.json +9 -9
- package/resources/sysml.library/Domain Libraries/Analysis/.project.json +26 -26
- package/resources/sysml.library/Domain Libraries/Analysis/AnalysisTooling.sysml +33 -33
- package/resources/sysml.library/Domain Libraries/Analysis/SampledFunctions.sysml +118 -118
- package/resources/sysml.library/Domain Libraries/Analysis/StateSpaceRepresentation.sysml +143 -143
- package/resources/sysml.library/Domain Libraries/Analysis/TradeStudies.sysml +170 -170
- package/resources/sysml.library/Domain Libraries/Cause and Effect/.meta.json +7 -7
- package/resources/sysml.library/Domain Libraries/Cause and Effect/.project.json +22 -22
- package/resources/sysml.library/Domain Libraries/Cause and Effect/CausationConnections.sysml +82 -82
- package/resources/sysml.library/Domain Libraries/Cause and Effect/CauseAndEffect.sysml +81 -81
- package/resources/sysml.library/Domain Libraries/Geometry/.meta.json +7 -7
- package/resources/sysml.library/Domain Libraries/Geometry/.project.json +26 -26
- package/resources/sysml.library/Domain Libraries/Geometry/ShapeItems.sysml +898 -898
- package/resources/sysml.library/Domain Libraries/Geometry/SpatialItems.sysml +167 -167
- package/resources/sysml.library/Domain Libraries/Metadata/.meta.json +9 -9
- package/resources/sysml.library/Domain Libraries/Metadata/.project.json +18 -18
- package/resources/sysml.library/Domain Libraries/Metadata/ImageMetadata.sysml +77 -77
- package/resources/sysml.library/Domain Libraries/Metadata/ModelingMetadata.sysml +142 -142
- package/resources/sysml.library/Domain Libraries/Metadata/ParametersOfInterestMetadata.sysml +38 -38
- package/resources/sysml.library/Domain Libraries/Metadata/RiskMetadata.sysml +99 -99
- package/resources/sysml.library/Domain Libraries/Quantities and Units/.meta.json +28 -28
- package/resources/sysml.library/Domain Libraries/Quantities and Units/.project.json +22 -22
- package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQ.sysml +42 -42
- package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQAcoustics.sysml +439 -439
- package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQAtomicNuclear.sysml +2726 -2726
- package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQBase.sysml +206 -206
- package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQCharacteristicNumbers.sysml +1991 -1991
- package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQChemistryMolecular.sysml +1353 -1353
- package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQCondensedMatter.sysml +1223 -1223
- package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQElectromagnetism.sysml +2333 -2333
- package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQInformation.sysml +958 -958
- package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQLight.sysml +1537 -1537
- package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQMechanics.sysml +1564 -1564
- package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQSpaceTime.sysml +1169 -1169
- package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQThermodynamics.sysml +1256 -1256
- package/resources/sysml.library/Domain Libraries/Quantities and Units/MeasurementRefCalculations.sysml +30 -30
- package/resources/sysml.library/Domain Libraries/Quantities and Units/MeasurementReferences.sysml +526 -526
- package/resources/sysml.library/Domain Libraries/Quantities and Units/Quantities.sysml +107 -107
- package/resources/sysml.library/Domain Libraries/Quantities and Units/QuantityCalculations.sysml +70 -70
- package/resources/sysml.library/Domain Libraries/Quantities and Units/SI.sysml +378 -378
- package/resources/sysml.library/Domain Libraries/Quantities and Units/SIPrefixes.sysml +48 -48
- package/resources/sysml.library/Domain Libraries/Quantities and Units/TensorCalculations.sysml +49 -49
- package/resources/sysml.library/Domain Libraries/Quantities and Units/Time.sysml +274 -274
- package/resources/sysml.library/Domain Libraries/Quantities and Units/USCustomaryUnits.sysml +260 -260
- package/resources/sysml.library/Domain Libraries/Quantities and Units/VectorCalculations.sysml +62 -62
- package/resources/sysml.library/Domain Libraries/Requirement Derivation/.meta.json +7 -7
- package/resources/sysml.library/Domain Libraries/Requirement Derivation/.project.json +18 -18
- package/resources/sysml.library/Domain Libraries/Requirement Derivation/DerivationConnections.sysml +62 -62
- package/resources/sysml.library/Domain Libraries/Requirement Derivation/RequirementDerivation.sysml +38 -38
- package/resources/sysml.library/Kernel Libraries/Kernel Data Type Library/.meta.json +8 -8
- package/resources/sysml.library/Kernel Libraries/Kernel Data Type Library/.project.json +10 -10
- package/resources/sysml.library/Kernel Libraries/Kernel Data Type Library/Collections.kerml +176 -176
- package/resources/sysml.library/Kernel Libraries/Kernel Data Type Library/ScalarValues.kerml +23 -23
- package/resources/sysml.library/Kernel Libraries/Kernel Data Type Library/VectorValues.kerml +63 -63
- package/resources/sysml.library/Kernel Libraries/Kernel Function Library/.meta.json +22 -22
- package/resources/sysml.library/Kernel Libraries/Kernel Function Library/.project.json +14 -14
- package/resources/sysml.library/Kernel Libraries/Kernel Function Library/BaseFunctions.kerml +79 -79
- package/resources/sysml.library/Kernel Libraries/Kernel Function Library/BooleanFunctions.kerml +22 -22
- package/resources/sysml.library/Kernel Libraries/Kernel Function Library/CollectionFunctions.kerml +68 -68
- package/resources/sysml.library/Kernel Libraries/Kernel Function Library/ComplexFunctions.kerml +47 -47
- package/resources/sysml.library/Kernel Libraries/Kernel Function Library/ControlFunctions.kerml +116 -116
- package/resources/sysml.library/Kernel Libraries/Kernel Function Library/DataFunctions.kerml +42 -42
- package/resources/sysml.library/Kernel Libraries/Kernel Function Library/IntegerFunctions.kerml +43 -43
- package/resources/sysml.library/Kernel Libraries/Kernel Function Library/NaturalFunctions.kerml +27 -27
- package/resources/sysml.library/Kernel Libraries/Kernel Function Library/NumericalFunctions.kerml +42 -42
- package/resources/sysml.library/Kernel Libraries/Kernel Function Library/OccurrenceFunctions.kerml +153 -153
- package/resources/sysml.library/Kernel Libraries/Kernel Function Library/RationalFunctions.kerml +49 -49
- package/resources/sysml.library/Kernel Libraries/Kernel Function Library/RealFunctions.kerml +56 -56
- package/resources/sysml.library/Kernel Libraries/Kernel Function Library/ScalarFunctions.kerml +32 -32
- package/resources/sysml.library/Kernel Libraries/Kernel Function Library/SequenceFunctions.kerml +110 -110
- package/resources/sysml.library/Kernel Libraries/Kernel Function Library/StringFunctions.kerml +25 -25
- package/resources/sysml.library/Kernel Libraries/Kernel Function Library/TrigFunctions.kerml +34 -34
- package/resources/sysml.library/Kernel Libraries/Kernel Function Library/VectorFunctions.kerml +272 -272
- package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/.meta.json +21 -21
- package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/.project.json +14 -14
- package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/Base.kerml +94 -94
- package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/Clocks.kerml +155 -155
- package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/ControlPerformances.kerml +134 -134
- package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/FeatureReferencingPerformances.kerml +189 -189
- package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/KerML.kerml +483 -483
- package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/Links.kerml +66 -66
- package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/Metaobjects.kerml +57 -57
- package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/Objects.kerml +212 -212
- package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/Observation.kerml +160 -160
- package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/Occurrences.kerml +992 -992
- package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/Performances.kerml +292 -292
- package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/SpatialFrames.kerml +196 -196
- package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/StatePerformances.kerml +144 -144
- package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/Transfers.kerml +280 -280
- package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/TransitionPerformances.kerml +65 -65
- package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/Triggers.kerml +187 -187
- package/resources/sysml.library/LICENSE +276 -276
- package/resources/sysml.library/NOTICE.md +20 -20
- package/resources/sysml.library/Systems Library/Actions.sysml +556 -556
- package/resources/sysml.library/Systems Library/Allocations.sysml +28 -28
- package/resources/sysml.library/Systems Library/AnalysisCases.sysml +37 -37
- package/resources/sysml.library/Systems Library/Attributes.sysml +24 -24
- package/resources/sysml.library/Systems Library/Calculations.sysml +36 -36
- package/resources/sysml.library/Systems Library/Cases.sysml +70 -70
- package/resources/sysml.library/Systems Library/Connections.sysml +59 -59
- package/resources/sysml.library/Systems Library/Constraints.sysml +43 -43
- package/resources/sysml.library/Systems Library/Flows.sysml +125 -125
- package/resources/sysml.library/Systems Library/Interfaces.sysml +88 -88
- package/resources/sysml.library/Systems Library/Items.sysml +152 -152
- package/resources/sysml.library/Systems Library/Metadata.sysml +31 -31
- package/resources/sysml.library/Systems Library/Parts.sysml +80 -80
- package/resources/sysml.library/Systems Library/Ports.sysml +53 -53
- package/resources/sysml.library/Systems Library/Requirements.sysml +193 -193
- package/resources/sysml.library/Systems Library/StandardViewDefinitions.sysml +123 -123
- package/resources/sysml.library/Systems Library/States.sysml +102 -102
- package/resources/sysml.library/Systems Library/SysML.sysml +539 -539
- package/resources/sysml.library/Systems Library/UseCases.sysml +56 -56
- package/resources/sysml.library/Systems Library/VerificationCases.sysml +102 -102
- package/resources/sysml.library/Systems Library/Views.sysml +163 -163
- package/resources/sysml.library.index.json +1 -1
package/resources/sysml.library/Kernel Libraries/Kernel Function Library/BaseFunctions.kerml
CHANGED
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
standard library package BaseFunctions {
|
|
2
|
-
doc
|
|
3
|
-
/*
|
|
4
|
-
* This package defines a basic set of functions defined on all kinds of values.
|
|
5
|
-
* Most correspond to similarly named operators in the KerML expression syntax.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
private import Base::Anything;
|
|
9
|
-
private import Objects::Object;
|
|
10
|
-
private import Metaobjects::Metaobject;
|
|
11
|
-
private import KerML::Metaclass;
|
|
12
|
-
private import ScalarValues::*;
|
|
13
|
-
|
|
14
|
-
abstract function '=='{ in x: Anything[0..1]; in y: Anything[0..1];
|
|
15
|
-
return : Boolean[1];
|
|
16
|
-
}
|
|
17
|
-
function '!='{ in x: Anything[0..1]; in y: Anything[0..1];
|
|
18
|
-
return : Boolean[1] = not (x == y);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
abstract function '==='{ in x: Anything[0..1]; in y: Anything[0..1];
|
|
22
|
-
return : Boolean[1];
|
|
23
|
-
}
|
|
24
|
-
function '!=='{ in x: Anything[0..1]; in y: Anything[0..1];
|
|
25
|
-
return : Boolean[1] = not (x === y);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
abstract function ToString{ in x: Anything[0..1];
|
|
29
|
-
return : String;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
abstract function '['{ in x: Anything[0..*] nonunique; in y: Anything[0..*] nonunique;
|
|
33
|
-
return : Anything[0..*] nonunique;
|
|
34
|
-
}
|
|
35
|
-
abstract function '#'{ in seq: Anything[0..*] ordered nonunique; in index: Positive[1..*] ordered nonunique;
|
|
36
|
-
return : Anything[0..1];
|
|
37
|
-
}
|
|
38
|
-
abstract function ','{ in seq1: Anything[0..*] ordered nonunique; in seq2: Anything[0..*] ordered nonunique;
|
|
39
|
-
return : Anything[0..*] ordered nonunique;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
abstract function 'all'{
|
|
43
|
-
return : Object[0..*];
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
abstract function 'istype'{
|
|
47
|
-
in seq: Anything[0..*];
|
|
48
|
-
in 'type': Anything;
|
|
49
|
-
return : Boolean[1];
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
abstract function 'hastype'{
|
|
53
|
-
in seq: Anything[0..*];
|
|
54
|
-
in 'type': Anything;
|
|
55
|
-
return : Boolean;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
abstract function '@'{
|
|
59
|
-
in seq: Anything[0..*];
|
|
60
|
-
in 'type': Anything;
|
|
61
|
-
return : Boolean[1];
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
abstract function '@@'{
|
|
65
|
-
in seq: Metaobject[0..*];
|
|
66
|
-
in 'type': Metaobject;
|
|
67
|
-
return : Boolean[1];
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
abstract function 'as'{
|
|
71
|
-
in seq: Anything[0..*] ordered nonunique;
|
|
72
|
-
return : Anything[0..*] ordered nonunique;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
abstract function 'meta'{
|
|
76
|
-
in seq: Metaobject[0..*] ordered nonunique;
|
|
77
|
-
return : Metaobject[0..*] ordered nonunique;
|
|
78
|
-
}
|
|
79
|
-
|
|
1
|
+
standard library package BaseFunctions {
|
|
2
|
+
doc
|
|
3
|
+
/*
|
|
4
|
+
* This package defines a basic set of functions defined on all kinds of values.
|
|
5
|
+
* Most correspond to similarly named operators in the KerML expression syntax.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
private import Base::Anything;
|
|
9
|
+
private import Objects::Object;
|
|
10
|
+
private import Metaobjects::Metaobject;
|
|
11
|
+
private import KerML::Metaclass;
|
|
12
|
+
private import ScalarValues::*;
|
|
13
|
+
|
|
14
|
+
abstract function '=='{ in x: Anything[0..1]; in y: Anything[0..1];
|
|
15
|
+
return : Boolean[1];
|
|
16
|
+
}
|
|
17
|
+
function '!='{ in x: Anything[0..1]; in y: Anything[0..1];
|
|
18
|
+
return : Boolean[1] = not (x == y);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
abstract function '==='{ in x: Anything[0..1]; in y: Anything[0..1];
|
|
22
|
+
return : Boolean[1];
|
|
23
|
+
}
|
|
24
|
+
function '!=='{ in x: Anything[0..1]; in y: Anything[0..1];
|
|
25
|
+
return : Boolean[1] = not (x === y);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
abstract function ToString{ in x: Anything[0..1];
|
|
29
|
+
return : String;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
abstract function '['{ in x: Anything[0..*] nonunique; in y: Anything[0..*] nonunique;
|
|
33
|
+
return : Anything[0..*] nonunique;
|
|
34
|
+
}
|
|
35
|
+
abstract function '#'{ in seq: Anything[0..*] ordered nonunique; in index: Positive[1..*] ordered nonunique;
|
|
36
|
+
return : Anything[0..1];
|
|
37
|
+
}
|
|
38
|
+
abstract function ','{ in seq1: Anything[0..*] ordered nonunique; in seq2: Anything[0..*] ordered nonunique;
|
|
39
|
+
return : Anything[0..*] ordered nonunique;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
abstract function 'all'{
|
|
43
|
+
return : Object[0..*];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
abstract function 'istype'{
|
|
47
|
+
in seq: Anything[0..*];
|
|
48
|
+
in 'type': Anything;
|
|
49
|
+
return : Boolean[1];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
abstract function 'hastype'{
|
|
53
|
+
in seq: Anything[0..*];
|
|
54
|
+
in 'type': Anything;
|
|
55
|
+
return : Boolean;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
abstract function '@'{
|
|
59
|
+
in seq: Anything[0..*];
|
|
60
|
+
in 'type': Anything;
|
|
61
|
+
return : Boolean[1];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
abstract function '@@'{
|
|
65
|
+
in seq: Metaobject[0..*];
|
|
66
|
+
in 'type': Metaobject;
|
|
67
|
+
return : Boolean[1];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
abstract function 'as'{
|
|
71
|
+
in seq: Anything[0..*] ordered nonunique;
|
|
72
|
+
return : Anything[0..*] ordered nonunique;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
abstract function 'meta'{
|
|
76
|
+
in seq: Metaobject[0..*] ordered nonunique;
|
|
77
|
+
return : Metaobject[0..*] ordered nonunique;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
80
|
}
|
package/resources/sysml.library/Kernel Libraries/Kernel Function Library/BooleanFunctions.kerml
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
standard library package BooleanFunctions {
|
|
2
|
-
doc
|
|
3
|
-
/*
|
|
4
|
-
* This package defines functions on Boolean values, including those corresponding to
|
|
5
|
-
* (non-conditional) logical operators in the KerML expression notation.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
public import ScalarValues::*;
|
|
9
|
-
|
|
10
|
-
function 'not' specializes ScalarFunctions::'not' { in x: Boolean[1]; return : Boolean[1]; }
|
|
11
|
-
function 'xor' specializes ScalarFunctions::'xor' { in x: Boolean[1]; in y: Boolean[1]; return : Boolean[1]; }
|
|
12
|
-
|
|
13
|
-
function '|' specializes ScalarFunctions::'|' { in x: Boolean[1]; in y: Boolean[1]; return : Boolean[1]; }
|
|
14
|
-
function '&' specializes ScalarFunctions::'&' { in x: Boolean[1]; in y: Boolean[1]; return : Boolean[1]; }
|
|
15
|
-
|
|
16
|
-
function '==' specializes DataFunctions::'==' { in x: Boolean[0..1]; in y: Boolean[0..1]; return : Boolean[1]; }
|
|
17
|
-
|
|
18
|
-
function ToString specializes BaseFunctions::ToString { in x: Boolean[1]; return : String[1]; }
|
|
19
|
-
function ToBoolean { in x: String[1]; return : Boolean[1]; }
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
1
|
+
standard library package BooleanFunctions {
|
|
2
|
+
doc
|
|
3
|
+
/*
|
|
4
|
+
* This package defines functions on Boolean values, including those corresponding to
|
|
5
|
+
* (non-conditional) logical operators in the KerML expression notation.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
public import ScalarValues::*;
|
|
9
|
+
|
|
10
|
+
function 'not' specializes ScalarFunctions::'not' { in x: Boolean[1]; return : Boolean[1]; }
|
|
11
|
+
function 'xor' specializes ScalarFunctions::'xor' { in x: Boolean[1]; in y: Boolean[1]; return : Boolean[1]; }
|
|
12
|
+
|
|
13
|
+
function '|' specializes ScalarFunctions::'|' { in x: Boolean[1]; in y: Boolean[1]; return : Boolean[1]; }
|
|
14
|
+
function '&' specializes ScalarFunctions::'&' { in x: Boolean[1]; in y: Boolean[1]; return : Boolean[1]; }
|
|
15
|
+
|
|
16
|
+
function '==' specializes DataFunctions::'==' { in x: Boolean[0..1]; in y: Boolean[0..1]; return : Boolean[1]; }
|
|
17
|
+
|
|
18
|
+
function ToString specializes BaseFunctions::ToString { in x: Boolean[1]; return : String[1]; }
|
|
19
|
+
function ToBoolean { in x: String[1]; return : Boolean[1]; }
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
|
package/resources/sysml.library/Kernel Libraries/Kernel Function Library/CollectionFunctions.kerml
CHANGED
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
standard library package CollectionFunctions {
|
|
2
|
-
doc
|
|
3
|
-
/*
|
|
4
|
-
* This package defines functions on Collections (as defined in the Collections package).
|
|
5
|
-
* For functions on general sequences of values, see the SequenceFunctions package.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
private import Base::Anything;
|
|
9
|
-
private import ScalarValues::*;
|
|
10
|
-
private import SequenceFunctions::equals;
|
|
11
|
-
private import SequenceFunctions::includes;
|
|
12
|
-
private import ControlFunctions::exists;
|
|
13
|
-
public import Collections::*;
|
|
14
|
-
|
|
15
|
-
function '==' specializes BaseFunctions::'==' { in col1: Collection[0..1]; in col2: Collection[0..1];
|
|
16
|
-
return : Boolean[1] = col1.elements->equals(col2.elements);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function size { in col: Collection[1];
|
|
20
|
-
return : Natural[1] = SequenceFunctions::size(col.elements);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function isEmpty { in col: Collection[1];
|
|
24
|
-
return : Boolean[1] = SequenceFunctions::isEmpty(col.elements);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function notEmpty { in col: Collection[1];
|
|
28
|
-
return : Boolean[1] = SequenceFunctions::notEmpty(col.elements);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function contains { in col: Collection[1]; in values: Anything[*];
|
|
32
|
-
return : Boolean[1] = col.elements->includes(values);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function containsAll { in col1: Collection[1]; in col2: Collection[2];
|
|
36
|
-
return : Boolean[1] = contains(col1, col2.elements);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function head { in col: OrderedCollection[1];
|
|
40
|
-
return : Anything[0..1] = SequenceFunctions::head(col.elements);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function tail { in col: OrderedCollection[1];
|
|
44
|
-
return : Anything[0..*] ordered nonunique = SequenceFunctions::tail(col.elements);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function last { in col: OrderedCollection[1];
|
|
48
|
-
return : Anything[0..1] = SequenceFunctions::last(col.elements);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function '#' specializes BaseFunctions::'#' { in col: OrderedCollection[1]; in index: Positive[1];
|
|
52
|
-
// Cast ensures this function is not called recursively if the elements of col are OrderedCollections.
|
|
53
|
-
return : Anything[0..1] = (col.elements as Anything)#(index);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function 'array#' specializes BaseFunctions::'#' { in arr: Array[1]; in indexes: Positive[n] ordered nonunique;
|
|
57
|
-
private feature n : Natural[1] = arr.rank;
|
|
58
|
-
|
|
59
|
-
// Assumes row-major ordering for elements.
|
|
60
|
-
private function index { in arr: Array[1]; in i : Natural; in indexes : Positive[1..*];
|
|
61
|
-
if i <= 1? indexes#(1) else arr.dimensions#(i) * (index(arr, i-1, indexes) - 1) + indexes#(i)
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return : Anything[0..1] =
|
|
65
|
-
if n == 0 or (1..n)->exists {in i; indexes#(i) > arr.dimensions#(i)}? null
|
|
66
|
-
else arr.elements#(index(arr, n, indexes));
|
|
67
|
-
}
|
|
68
|
-
}
|
|
1
|
+
standard library package CollectionFunctions {
|
|
2
|
+
doc
|
|
3
|
+
/*
|
|
4
|
+
* This package defines functions on Collections (as defined in the Collections package).
|
|
5
|
+
* For functions on general sequences of values, see the SequenceFunctions package.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
private import Base::Anything;
|
|
9
|
+
private import ScalarValues::*;
|
|
10
|
+
private import SequenceFunctions::equals;
|
|
11
|
+
private import SequenceFunctions::includes;
|
|
12
|
+
private import ControlFunctions::exists;
|
|
13
|
+
public import Collections::*;
|
|
14
|
+
|
|
15
|
+
function '==' specializes BaseFunctions::'==' { in col1: Collection[0..1]; in col2: Collection[0..1];
|
|
16
|
+
return : Boolean[1] = col1.elements->equals(col2.elements);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function size { in col: Collection[1];
|
|
20
|
+
return : Natural[1] = SequenceFunctions::size(col.elements);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function isEmpty { in col: Collection[1];
|
|
24
|
+
return : Boolean[1] = SequenceFunctions::isEmpty(col.elements);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function notEmpty { in col: Collection[1];
|
|
28
|
+
return : Boolean[1] = SequenceFunctions::notEmpty(col.elements);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function contains { in col: Collection[1]; in values: Anything[*];
|
|
32
|
+
return : Boolean[1] = col.elements->includes(values);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function containsAll { in col1: Collection[1]; in col2: Collection[2];
|
|
36
|
+
return : Boolean[1] = contains(col1, col2.elements);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function head { in col: OrderedCollection[1];
|
|
40
|
+
return : Anything[0..1] = SequenceFunctions::head(col.elements);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function tail { in col: OrderedCollection[1];
|
|
44
|
+
return : Anything[0..*] ordered nonunique = SequenceFunctions::tail(col.elements);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function last { in col: OrderedCollection[1];
|
|
48
|
+
return : Anything[0..1] = SequenceFunctions::last(col.elements);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function '#' specializes BaseFunctions::'#' { in col: OrderedCollection[1]; in index: Positive[1];
|
|
52
|
+
// Cast ensures this function is not called recursively if the elements of col are OrderedCollections.
|
|
53
|
+
return : Anything[0..1] = (col.elements as Anything)#(index);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function 'array#' specializes BaseFunctions::'#' { in arr: Array[1]; in indexes: Positive[n] ordered nonunique;
|
|
57
|
+
private feature n : Natural[1] = arr.rank;
|
|
58
|
+
|
|
59
|
+
// Assumes row-major ordering for elements.
|
|
60
|
+
private function index { in arr: Array[1]; in i : Natural; in indexes : Positive[1..*];
|
|
61
|
+
if i <= 1? indexes#(1) else arr.dimensions#(i) * (index(arr, i-1, indexes) - 1) + indexes#(i)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return : Anything[0..1] =
|
|
65
|
+
if n == 0 or (1..n)->exists {in i; indexes#(i) > arr.dimensions#(i)}? null
|
|
66
|
+
else arr.elements#(index(arr, n, indexes));
|
|
67
|
+
}
|
|
68
|
+
}
|
package/resources/sysml.library/Kernel Libraries/Kernel Function Library/ComplexFunctions.kerml
CHANGED
|
@@ -1,47 +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
|
-
}
|
|
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
|
+
}
|
package/resources/sysml.library/Kernel Libraries/Kernel Function Library/ControlFunctions.kerml
CHANGED
|
@@ -1,117 +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
|
-
|
|
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
117
|
}
|