Ignore:
Timestamp:
Jun 22, 2009, 3:52:37 PM (15 years ago)
Author:
KOBAYASHI, Shinji
Message:

ref #50

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ruby/trunk/lib/models/rm/data_types/quantity.rb

    r141 r142  
    4646          end
    4747
    48           def is_strictry_comparable_to?(other)
     48          def is_strictly_comparable_to?(other)
    4949            raise NotImplementedError, 'this method should be implemented'
    5050          end
     
    5454
    5555        end
    56        
     56
    5757        class DV_Quantified < DV_Ordered
    5858
     
    7676
    7777        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)
    8186          end
    8287
    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
    8492
     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
    85107          end
    86108
    87109          def <=>(other)
    88               @value <=> other.value
     110            @value <=> other.value
    89111          end
    90112
    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
    93119          end
    94120        end
Note: See TracChangeset for help on using the changeset viewer.