- Timestamp:
- May 1, 2008, 8:21:09 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ruby/trunk/models/am/archetype/constraint_model/archetype_constraint.rb
r21 r23 8 8 end 9 9 10 class C _OBJECT < ARCHETYPE_CONSTRAINT10 class CARDINALITY 11 11 12 12 end 13 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 end 23 14 24 class C_ATTRIBUTE < ARCHETYPE_CONSTRAINT 15 25 attr_accessor :rm_attribute_name, :existence, :children 26 27 def initialize(args = { }) 28 @rm_attribute_name = args[:rm_attribute_name] if args[:rm_attribute_name] 29 @existence = args[:existence] if args[:existence] 30 @children = args[:children] ? args[:children] : [] 31 32 end 16 33 end 17 34 18 35 class C_DEFINED_OBJECT < C_OBJECT 36 attr_accessor :assumed_value 19 37 38 def initialize(args = { }) 39 @assumed_value = args[:assumed_value] if args[:assumed_value] 40 super 41 end 20 42 end 21 43 22 44 class C_PRIMITIVE_OBJECT < C_DEFINED_OBJECT 45 attr_accessor :item 23 46 47 def initialize(args = { }) 48 @attributes = args[:item] if args[:item] 49 super 50 end 24 51 end 25 52 … … 27 54 attr_accessor :attributes, :attributes_valid 28 55 56 def initialize(args = { }) 57 @attributes = args[:attributes] ? args[:attributes] : [] 58 super 59 end 60 61 def self.create(args = { }, &block) 62 c_complex_object = new(args) 63 if block_given? 64 yield c_complex_object 65 end 66 return c_complex_object 67 end 29 68 end 30 69 … … 49 88 end 50 89 90 class C_SINGLE_ATTRIBUTE < C_ATTRIBUTE 91 attr_accessor :alternatives 92 93 def initialize(args = { }) 94 @alternatives = args[:alternatives] ? args[:alternatives] : [] 95 super 96 end 97 end 98 99 class C_MULTIPLE_ATTRIBUTE < C_ATTRIBUTE 100 attr_accessor :members, :cardinality 101 102 def initialize(args = { }) 103 @members = args[:members] ? args[:members] : [] 104 @cardinality = args[:cardinality] if args[:cardinality] 105 super 106 end 107 end 51 108 end 52 109 end
Note:
See TracChangeset
for help on using the changeset viewer.