Class: OpenEHR::RM::DataTypes::Quantity::DvAbsoluteQuantity

Inherits:
DvQuantified show all
Defined in:
lib/open_ehr/rm/data_types/quantity.rb

Constant Summary

Constants included from Support::Definition::BasicDefinition

Support::Definition::BasicDefinition::CR, Support::Definition::BasicDefinition::LF

Instance Attribute Summary collapse

Attributes inherited from DvQuantified

#magnitude, #magnitude_status

Attributes inherited from DvOrdered

#normal_range, #normal_status, #other_refference_ranges

Attributes inherited from Basic::DataValue

#value

Instance Method Summary collapse

Methods inherited from DvQuantified

#<=>, #accuracy_unknown?, valid_magnitude_status?

Methods inherited from DvOrdered

#<=>, #is_normal?, #is_simple?, #is_strictly_comparable_to?, #other_reference_ranges=

Methods inherited from Basic::DataValue

#==

Constructor Details

#initialize(args = {}) ⇒ DvAbsoluteQuantity

Returns a new instance of DvAbsoluteQuantity.



151
152
153
154
# File 'lib/open_ehr/rm/data_types/quantity.rb', line 151

def initialize(args = {})
  super(args)
  self.accuracy = args[:accuracy]
end

Instance Attribute Details

#accuracyObject

Returns the value of attribute accuracy.



149
150
151
# File 'lib/open_ehr/rm/data_types/quantity.rb', line 149

def accuracy
  @accuracy
end

Instance Method Details

#add(a_diff) ⇒ Object



156
157
158
159
160
# File 'lib/open_ehr/rm/data_types/quantity.rb', line 156

def add(a_diff)
  type_check(a_diff)
  return result_builder(self.class,
                        @magnitude+a_diff.magnitude)
end

#diff(other) ⇒ Object



162
163
164
165
166
# File 'lib/open_ehr/rm/data_types/quantity.rb', line 162

def diff(other)
  type_check(other)
  return result_builder(self.class,
                        (@magnitude-other.magnitude).abs)
end

#subtract(a_diff) ⇒ Object



168
169
170
171
172
# File 'lib/open_ehr/rm/data_types/quantity.rb', line 168

def subtract(a_diff)
  type_check(a_diff)
  return result_builder(self.class,
                        @magnitude-a_diff.magnitude)
end