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

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

restructuring repository tree

File size: 1.8 KB
Line 
1module OpenEHR
2 module RM
3 module Data_Types
4 module Basic
5 module Canonical_Fragment
6 end
7
8 class Data_Value
9 include OpenEHR::RM::Support::Definition::Basic_Definition
10 end
11
12 class DV_Boolean < Data_Value
13 def initialize(value)
14 check_not_nil(value)
15 if value == "TRUE" or value == true
16 @value = true
17 else
18 @value = false
19 end
20 end
21 def value=(value)
22 check_not_nil(value)
23 @value = value
24 end
25 def value?
26 @value == true
27 end
28 private
29 def check_not_nil(value)
30 if value == nil
31 raise ArgumentError, "value must not be empty"
32 end
33 end
34 end # end of DV_Boolean
35
36 class DV_State < Data_Value
37 attr_accessor :value
38 attr_writer :terminal
39 def initialize(value, terminal)
40 if value == nil or terminal == nil
41 raise ArgumentError, "argument mandatory"
42 end
43 @value = value
44 @terminal = terminal
45 end
46 def is_terminal?
47 @terminal == true
48 end
49 end # end of DV_State
50
51 class DV_Identifier
52 attr_accessor :issuer, :assigner, :id, :type
53 def initialize(assigner, id, issuer, type)
54 if assigner == nil or id == nil or issuer == nil or type == nil
55 raise ArgumentError, "invalid argument"
56 end
57 @issuer = issuer
58 @assigner = assigner
59 @id = id
60 @type = type
61 end
62 end #end of DV_Identifier
63 end # end of Basic
64 end # end of Data_types
65 end # end of RM
66end # end of OpenEHR
Note: See TracBrowser for help on using the repository browser.