View: Hide Browser | Browser on the left | Browser on the right | Dictionary
Report:General Info | Attributes | Operations | Constraints

Parent Package: quantity
Class DV_PROPORTION


DV_AMOUNT, PROPORTION_KIND
   |
   +--DV_PROPORTION

Models a ratio of values, i.e. where the numerator and denominator are both pure numbers.

Attributes
SignatureOptionalityMultiplicityConstantDocumentation
 denominator : Real  --  denominator of ratio 
 numerator : Real  --  numerator of ratio 
 precision : Integer 0..1  --  Precision to which the numerator and denominator values of the proportion are expressed, in terms of number of decimal places. The value 0 implies an integral quantity. The value -1 implies no limit, i.e. any number of decimal places. 
 type : Integer  --  Indicates semantic type of proportion, including percent, unitary. Codes are given in PROPORTION_KIND class. 


Operations
SignatureConstraintsDocumentation
 is_strictly_comparable_to(other : DV_PROPORTION) : Boolean 
post: other.type implies result  
True if type is the same. 
 magnitude() : Real 
post: Result = numerator/denominator  
Effective magnitude represented by ratio. 

Constraints
NameExpression
Is_integral_validityinv: is_integral implies (numerator.floor = numerator and denominator.floor = denominator) 
Type_validityinv: valid_proportion_kind(type) 
Fraction_validityinv: (type = pk_fraction or type = pk_integer_fraction) implies is_integral 
Unitary_validityinv: type = pk_unitary implies denominator = 1 
Percent_validityinv: type = pk_percent implies denominator = 100 
Precision_validityinv: precision = 0 implies is_integral