derive_dimensional_exponents

EXPRESS specification:

FUNCTION derive_dimensional_exponents
(x : unit) : dimensional_exponents; LOCAL i : INTEGER; result : dimensional_exponents := dimensional_exponents(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0); END_LOCAL; IF 'STRUCTURAL_FRAME_SCHEMA.DERIVED_UNIT' IN TYPEOF(x) THEN (* x is a derived unit *) REPEAT i := LOINDEX(x.elements) TO HIINDEX(x.elements); result.length_exponent := result.length_exponent + (x.elements[i].exponent * x.elements[i].unit.dimensions.length_exponent); result.mass_exponent := result.mass_exponent + (x.elements[i].exponent * x.elements[i].unit.dimensions.mass_exponent); result.time_exponent := result.time_exponent + (x.elements[i].exponent * x.elements[i].unit.dimensions.time_exponent); result.electric_current_exponent := result.electric_current_exponent + (x.elements[i].exponent * x.elements[i].unit.dimensions.electric_current_exponent); result.thermodynamic_temperature_exponent := result.thermodynamic_temperature_exponent + (x.elements[i].exponent * x.elements[i].unit.dimensions.thermodynamic_temperature_exponent); result.amount_of_substance_exponent := result.amount_of_substance_exponent + (x.elements[i].exponent * x.elements[i].unit.dimensions.amount_of_substance_exponent); result.luminous_intensity_exponent := result.luminous_intensity_exponent + (x.elements[i].exponent * x.elements[i].unit.dimensions.luminous_intensity_exponent); END_REPEAT; ELSE (* x is a unitless or a named unit *) result := x.dimensions; END_IF; RETURN (result);
END_FUNCTION;