Changeset 142 for ruby/trunk/lib/models/rm/data_types/quantity.rb
- Timestamp:
- Jun 22, 2009, 3:52:37 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ruby/trunk/lib/models/rm/data_types/quantity.rb
r141 r142 46 46 end 47 47 48 def is_strict ry_comparable_to?(other)48 def is_strictly_comparable_to?(other) 49 49 raise NotImplementedError, 'this method should be implemented' 50 50 end … … 54 54 55 55 end 56 56 57 57 class DV_Quantified < DV_Ordered 58 58 … … 76 76 77 77 class DV_Ordinal < DV_Ordered 78 attr_reader :value, :symbol 79 def initialize(value, symbol, normal_range=nil, normal_status = nil, 80 other_reference_ranges=nil) 78 attr_reader :value, :symbol, :limits 79 80 def initialize(value, symbol, limits=nil, normal_range=nil, 81 normal_status = nil, other_reference_ranges=nil) 82 self.value = value 83 self.symbol = symbol 84 self.limits = limits 85 super(normal_range, normal_status, other_reference_ranges) 81 86 end 82 87 83 def is_strictly_comparable_to? 88 def value=(value) 89 raise ArgumentError, 'value should not be nil' if value.nil? 90 @value = value 91 end 84 92 93 def symbol=(symbol) 94 raise ArgumentError,'symbol should not be nil' if symbol.nil? 95 @symbol = symbol 96 end 97 98 def is_strictly_comparable_to?(others) 99 unless others.instance_of? OpenEHR::RM::Data_Types::Quantity::DV_Ordinal 100 return false 101 end 102 unless others.symbol.defining_code.terminology_id.value == 103 @symbol.defining_code.terminology_id.value 104 return false 105 end 106 return true 85 107 end 86 108 87 109 def <=>(other) 88 110 @value <=> other.value 89 111 end 90 112 91 def limits 92 113 def limits=(limits) 114 unless limits.nil? or limits.meaning.value == 'limits' 115 raise ArgumentError, 'invalid limits' 116 else 117 @limits = limits 118 end 93 119 end 94 120 end
Note:
See TracChangeset
for help on using the changeset viewer.