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

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

refs #48, #52, #39

File size: 2.0 KB
Line 
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
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)
17 self.value = value
18 end
19 def value=(value)
20 raise ArgumentError, "value must not be nil" if value.nil?
21 if value == "TRUE" or value == true
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
33 attr_reader :value
34
35 def initialize(value, is_terminal)
36 self.value=value
37 self.is_terminal=is_terminal
38 end
39 def value=(v)
40 raise ArgumentError, "value should not be nil" if v.nil?
41 @value = v
42 end
43 def is_terminal?
44 @is_terminal
45 end
46 def is_terminal=(s)
47 raise ArgumentError, "terminal should not be nil" if s.nil?
48 @is_terminal = s
49 end
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)
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?
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.