Changeset 128


Ignore:
Timestamp:
May 26, 2009, 7:18:08 PM (15 years ago)
Author:
KOBAYASHI, Shinji
Message:

fixed #59

Location:
ruby/trunk/lib/models
Files:
4 edited
1 moved

Legend:

Unmodified
Added
Removed
  • ruby/trunk/lib/models/assumed_library_types.rb

    r126 r128  
    446446
    447447      def years=(years)
    448         unless years.nil? || years > 0
     448        unless years.nil? || years >= 0
    449449          raise ArgumentError, 'years must be above zero'
    450450        end
     
    453453
    454454      def months=(months)
    455         unless months.nil? || months > 0
     455        unless months.nil? || months >= 0
    456456          raise ArgumentError, 'months must be above zero'
    457457        end
     
    460460
    461461      def weeks=(weeks)
    462         unless weeks.nil? || weeks > 0
     462        unless weeks.nil? || weeks >= 0
    463463          raise ArgumentError, 'weeks must be above zero'
    464464        end
     
    467467
    468468      def days=(days)
    469         unless days.nil? || days > 0
     469        unless days.nil? || days >= 0
    470470          raise ArgumentError, 'days must be above zero'
    471471        end
     
    474474
    475475      def hours=(hours)
    476         unless hours.nil? || hours > 0
     476        unless hours.nil? || hours >= 0
    477477          raise ArgumentError, 'hours must be above zero'
    478478        end
     
    481481
    482482      def minutes=(minutes)
    483         unless minutes.nil? || minutes > 0
     483        unless minutes.nil? || minutes >= 0
    484484          raise ArgumentError, 'minutes must be above zero'
    485485        end
     
    488488
    489489      def seconds=(seconds)
    490         unless seconds.nil? || seconds > 0
     490        unless seconds.nil? || seconds >= 0
    491491          raise ArgumentError, 'seconds must be above zero'
    492492        end
     
    495495
    496496      def fractional_second=(fractional_second)
    497         unless fractional_second.nil? || (fractional_second > 0 && fractional_second < 1.0)
     497        unless fractional_second.nil? || (fractional_second >= 0 && fractional_second < 1.0)
    498498          raise ArgumentError, 'fractional_second must be between 0.0 and 1.0'
    499499        end
  • ruby/trunk/lib/models/rm.rb

    r123 r128  
    3636      autoload :Quantity, "rm/data_types/quantity.rb"
    3737    end
     38
     39    module Data_Structures
     40      autoload :Data_Structure, "rm/data_structure.rb"
     41    end
    3842  end
    3943
  • ruby/trunk/lib/models/rm/common/archetyped.rb

    r112 r128  
    1616        class Pathable
    1717          attr_accessor :parent
     18
    1819          def initialize(parent = nil)
    1920            @parent = parent
    2021          end
     22
    2123          def item_at_path(path)
    2224            raise NotImplementError, "item_at_path must be implemented"
    2325          end
     26
    2427          def items_at_path(path)
    2528            raise NotImplementError, "items_at_path must be implemented"
    2629          end
     30
    2731          def path_exists?(path)
    2832            raise NotImplementError, "path_exists? must be implemented"
    2933          end
     34
    3035          def path_of_item(item)
    3136            raise NotImplementError, "path_of_item must be implemented"
    3237          end
     38
    3339          def path_unique(path)
    3440            raise NotImplementError, "path_unique must be implemented"
     
    4046          attr_reader :archetype_node_id, :name, :links
    4147          attr_accessor :uid, :archetype_details, :feeder_audit
     48
    4249          def initialize(archetype_node_id, name, links, parent=nil, uid=nil, archetype_details=nil, feeder_audit=nil)
    4350            super(parent)
  • ruby/trunk/lib/models/rm/data_structure.rb

    r123 r128  
    33# http://www.openehr.org/uml/release-1.0.1/Browsable/_9_5_1_76d0249_1140447518205_872539_864Report.html
    44# refs #59
    5 module Data_Structures
    6   class Data_Structure
    7     def as_hierarchy
    8       raise NotImplementError, "as_hirarchy must be implemented"
    9     end
    10   end
    11 end
     5
     6module OpenEHR
     7  module RM
     8    module Data_Structures
     9      class Data_Structure < OpenEHR::RM::Common::Archetyped::Locatable
     10        def as_hierarchy
     11          raise NotImplementedError, "as_hirarchy must be implemented"
     12        end
     13      end
     14    end # of Data_Structures
     15  end # of RM
     16end # of OpenEHR
  • ruby/trunk/lib/models/tests/rm/test_common.rb

    r119 r128  
    2525    assert_nothing_raised(Exception){@archetyped = OpenEHR::RM::Common::Archetyped::Archetyped.new(@archetype_id, '1.0.1')}
    2626    assert_nothing_raised(Exception){@link = OpenEHR::RM::Common::Archetyped::Link.new(OpenEHR::RM::Data_Types::Text::DV_Text.new("generic"), OpenEHR::RM::Data_Types::URI::DV_EHR_URI.new("ehr://test/"),OpenEHR::RM::Data_Types::Text::DV_Text.new("problem"))}
     27    assert_nothing_raised(Exception){
     28      @pathable = OpenEHR::RM::Common::Archetyped::Pathable.new }
     29    name = OpenEHR::RM::Data_Types::Text::DV_Text.new('blood')
     30    links = Set.new([@uid_based_id])
     31    assert_nothing_raised(Exception){
     32      @locatable = OpenEHR::RM::Common::Archetyped::Locatable.new('at0001',name,links)}
    2733  end
    2834
     
    3036    assert_instance_of OpenEHR::RM::Common::Archetyped::Archetyped, @archetyped
    3137    assert_instance_of OpenEHR::RM::Common::Archetyped::Link, @link
     38    assert_instance_of OpenEHR::RM::Common::Archetyped::Pathable, @pathable
     39    assert_instance_of OpenEHR::RM::Common::Archetyped::Locatable, @locatable
    3240  end
    3341
Note: See TracChangeset for help on using the changeset viewer.