| standard library package QuantityCalculations { | |
| doc | |
| /* | |
| * This package package defines calculations for the construction of and computations on ScalarQuantityValues. | |
| */ | |
| private import ScalarValues::*; | |
| private import Quantities::ScalarQuantityValue; | |
| private import MeasurementReferences::ScalarMeasurementReference; | |
| private import MeasurementReferences::DimensionOneValue; | |
| calc def '[' specializes BaseFunctions::'[' { | |
| in num: Number[1]; | |
| in mRef: ScalarMeasurementReference[1]; | |
| return quantity : ScalarQuantityValue[1]; | |
| } | |
| calc def isZero specializes NumericalFunctions::isZero { | |
| in x: ScalarQuantityValue[1]; | |
| return : Boolean[1] = NumericalFunctions::isZero(x.num); | |
| } | |
| calc def isUnit specializes NumericalFunctions::isUnit { | |
| in x: ScalarQuantityValue[1]; | |
| return : Boolean[1] = NumericalFunctions::isUnit(x.num); | |
| } | |
| calc def abs specializes NumericalFunctions::abs { in x: ScalarQuantityValue[1]; return : ScalarQuantityValue[1]; } | |
| calc def '+' specializes NumericalFunctions::'+' { in x: ScalarQuantityValue[1]; in y: ScalarQuantityValue[0..1]; return : ScalarQuantityValue; } | |
| calc def '-' specializes NumericalFunctions::'-' { in x: ScalarQuantityValue; in y: ScalarQuantityValue[0..1]; return : ScalarQuantityValue[1]; } | |
| calc def '*' specializes NumericalFunctions::'*' { in x: ScalarQuantityValue[1]; in y: ScalarQuantityValue[1]; return : ScalarQuantityValue[1]; } | |
| calc def '/' specializes NumericalFunctions::'/' { in x: ScalarQuantityValue[1]; in y: ScalarQuantityValue[1]; return : ScalarQuantityValue[1]; } | |
| calc def '**' specializes NumericalFunctions::'**' { in x: ScalarQuantityValue[1]; in y: Real[1]; return : ScalarQuantityValue[1]; } | |
| calc def '^' specializes NumericalFunctions::'^' { in x: ScalarQuantityValue[1]; in y: Real[1]; return : ScalarQuantityValue[1]; } | |
| calc def '<' specializes NumericalFunctions::'<' { in x: ScalarQuantityValue[1]; in y: ScalarQuantityValue[1]; return : Boolean[1]; } | |
| calc def '>' specializes NumericalFunctions::'>' { in x: ScalarQuantityValue[1]; in y: ScalarQuantityValue[1]; return : Boolean[1]; } | |
| calc def '<=' specializes NumericalFunctions::'<=' { in x: ScalarQuantityValue[1]; in y: ScalarQuantityValue[1]; return : Boolean[1]; } | |
| calc def '>=' specializes NumericalFunctions::'>=' { in x: ScalarQuantityValue[1]; in y: ScalarQuantityValue[1]; return : Boolean[1]; } | |
| calc def max specializes NumericalFunctions::max { in x: ScalarQuantityValue[1]; in y: ScalarQuantityValue[1]; return : ScalarQuantityValue[1]; } | |
| calc def min specializes NumericalFunctions::min { in x: ScalarQuantityValue[1]; in y: ScalarQuantityValue[1]; return : ScalarQuantityValue[1]; } | |
| calc def '==' specializes DataFunctions::'==' { in x: ScalarQuantityValue[1]; in y: ScalarQuantityValue[1]; return : Boolean[1]; } | |
| calc def sqrt{ in x: ScalarQuantityValue[1]; return : ScalarQuantityValue[1]; } | |
| calc def floor { in x: ScalarQuantityValue[1]; return : ScalarQuantityValue[1]; } | |
| calc def round { in x: ScalarQuantityValue[1]; return : ScalarQuantityValue[1]; } | |
| calc def ToString specializes BaseFunctions::ToString { in x: ScalarQuantityValue[1]; return : String; } | |
| calc def ToInteger { in x: ScalarQuantityValue[1]; return : Integer[1]; } | |
| calc def ToRational { in x: ScalarQuantityValue[1]; return : Rational[1]; } | |
| calc def ToReal { in x: ScalarQuantityValue[1]; return : Real[1]; } | |
| calc def ToDimensionOneValue { in x: Real[1]; return : DimensionOneValue[1]; } | |
| calc def sum specializes NumericalFunctions::sum { in collection: ScalarQuantityValue[0..*]; | |
| private attribute zero : ScalarQuantityValue[1]; | |
| assert constraint { isZero(zero) } | |
| return : ScalarQuantityValue = NumericalFunctions::sum0(collection, zero); | |
| } | |
| calc def product specializes NumericalFunctions::product { in collection: ScalarQuantityValue[0..*]; | |
| private attribute one : ScalarQuantityValue[1]; | |
| assert constraint { isUnit(one) } | |
| return : ScalarQuantityValue = NumericalFunctions::product1(collection, one); | |
| } | |
| calc def ConvertQuantity{ in x: ScalarQuantityValue[1]; in targetMRef: ScalarMeasurementReference[1]; return : ScalarQuantityValue[1]; } | |
| } | |