source: ruby/trunk/lib/models/rm/data_types/basic.rb@ 109

Last change on this file since 109 was 109, checked in by KOBAYASHI, Shinji, 16 years ago

refs #52

File size: 2.0 KB
RevLine 
[89]1# This module is implemented from this UML:
2# http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109067591791_562382_3151Report.html
3# Ticket refs #52
[4]4module OpenEHR
5 module RM
6 module Data_Types
7 module Basic
8 module Canonical_Fragment
9 end
10
11 class Data_Value
12 include OpenEHR::RM::Support::Definition::Basic_Definition
13 end
14
15 class DV_Boolean < Data_Value
16 def initialize(value)
[106]17 self.value = value
18 end
19 def value=(value)
20 raise ArgumentError, "value must not be nil" if value.nil?
[109]21 if value == true or value =~ /TRUE/i
[4]22 @value = true
23 else
24 @value = false
25 end
26 end
27 def value?
28 @value == true
29 end
30 end # end of DV_Boolean
31
32 class DV_State < Data_Value
[89]33 attr_reader :value
34
35 def initialize(value, is_terminal)
36 self.value=value
37 self.is_terminal=is_terminal
[4]38 end
[89]39 def value=(v)
40 raise ArgumentError, "value should not be nil" if v.nil?
41 @value = v
42 end
[4]43 def is_terminal?
[89]44 @is_terminal
[4]45 end
[89]46 def is_terminal=(s)
47 raise ArgumentError, "terminal should not be nil" if s.nil?
48 @is_terminal = s
49 end
[4]50 end # end of DV_State
51
52 class DV_Identifier
53 attr_accessor :issuer, :assigner, :id, :type
54 def initialize(assigner, id, issuer, type)
[106]55 if assigner.nil? or assigner.empty?\
56 or id.nil? or id.empty? or issuer.nil? or issuer.empty?\
57 or type.nil? or type.empty?
[4]58 raise ArgumentError, "invalid argument"
59 end
60 @issuer = issuer
61 @assigner = assigner
62 @id = id
63 @type = type
64 end
65 end #end of DV_Identifier
66 end # end of Basic
67 end # end of Data_types
68 end # end of RM
69end # end of OpenEHR
Note: See TracBrowser for help on using the repository browser.