source: ruby/trunk/models/am/archetype/constraint_model/archetype_constraint.rb@ 32

Last change on this file since 32 was 32, checked in by Tatsukawa, Akimichi, 16 years ago

fixed Archetype::Constraint_Model and Primitive classes

File size: 3.6 KB
Line 
1
2module OpenEHR
3 module AM
4 module Archetype
5 module Constraint_Model
6 class ARCHETYPE_CONSTRAINT
7
8 end
9
10 class CARDINALITY
11
12 end
13
14 class C_OBJECT < ARCHETYPE_CONSTRAINT
15 attr_accessor :node_id, :occurrences, :rm_type_name
16
17 def initialize(args = { })
18 @node_id = args[:node_id] if args[:node_id]
19 @occurrences = args[:occurrences] if args[:occurrences]
20 @rm_type_name = args[:rm_type_name] if args[:rm_type_name]
21 end
22
23 def self.create(args = { }, &block)
24 c_object = new(args)
25 if block_given?
26 yield c_object
27 end
28 return c_object
29 end
30 end
31
32 class C_ATTRIBUTE < ARCHETYPE_CONSTRAINT
33 attr_accessor :rm_attribute_name, :existence, :children
34
35 def initialize(args = { })
36 @rm_attribute_name = args[:rm_attribute_name] if args[:rm_attribute_name]
37 @existence = args[:existence] if args[:existence]
38 @children = args[:children] ? args[:children] : []
39
40 end
41 end
42
43 class C_DEFINED_OBJECT < C_OBJECT
44 attr_accessor :assumed_value
45
46 def initialize(args = { })
47 @assumed_value = args[:assumed_value] if args[:assumed_value]
48 super
49 end
50 end
51
52 class C_PRIMITIVE_OBJECT < C_DEFINED_OBJECT
53 attr_accessor :item
54
55 def initialize(args = { })
56 @attributes = args[:item] if args[:item]
57 super
58 end
59 end
60
61 class C_COMPLEX_OBJECT < C_DEFINED_OBJECT
62 attr_accessor :attributes, :attributes_valid
63
64 def initialize(args = { })
65 @attributes = args[:attributes] ? args[:attributes] : []
66 super
67 end
68
69 def self.create(args = { }, &block)
70 c_complex_object = new(args)
71 if block_given?
72 yield c_complex_object
73 end
74 return c_complex_object
75 end
76 end
77
78 class C_DOMAIN_TYPE < C_DEFINED_OBJECT
79
80 end
81
82 class C_REFERENCE_OBJECT < C_OBJECT
83 end
84
85 class ARCHETYPE_INTERNAL_REF < C_REFERENCE_OBJECT
86 attr_accessor :target_path
87 end
88
89 class ARCHETYPE_SLOT < C_REFERENCE_OBJECT
90 attr_accessor :includes, :excludes
91
92 def self.create(args = { }, &block)
93 archetype_slot = new(args)
94 archetype_slot.includes = args[:includes]
95 archetype_slot.excludes = args[:excludes]
96 if block_given?
97 yield archetype_slot
98 end
99 return archetype_slot
100 end
101 end
102
103 class CONSTRAINT_REF < C_REFERENCE_OBJECT
104 attr_accessor :reference
105
106 def self.create(args = { }, &block)
107 constraint_ref = new(args)
108 constraint_ref.reference = args[:reference]
109 if block_given?
110 yield constraint_ref
111 end
112 return constraint_ref
113 end
114 end
115
116 class C_SINGLE_ATTRIBUTE < C_ATTRIBUTE
117 attr_accessor :alternatives
118
119 def initialize(args = { })
120 @alternatives = args[:alternatives] ? args[:alternatives] : []
121 super
122 end
123 end
124
125 class C_MULTIPLE_ATTRIBUTE < C_ATTRIBUTE
126 attr_accessor :members, :cardinality
127
128 def initialize(args = { })
129 @members = args[:members] ? args[:members] : []
130 @cardinality = args[:cardinality] if args[:cardinality]
131 super
132 end
133 end
134 end
135 end
136 end
137end
138
Note: See TracBrowser for help on using the repository browser.