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

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

update archetype_constraint

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