# rm::data_structures::item_structure # ItemStructure module # http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109346709572_859750_3810Report.html # refs #54 include OpenEhr::RM::DataStructures module OpenEhr module RM module DataStructures module ItemStructure class ItemStructure < DataStructure end class ItemSingle < ItemStructure attr_reader :item def initialize(args = {}) super(args) self.item = args[:item] end def as_hierarchy return @item end def item=(item) raise ArgumentError, 'item is mandatory' if item.nil? @item = item end end class ItemList < ItemStructure attr_accessor :items def initialize(args = {}) super(args) self.items = args[:items] end def item_count unless @items.nil? return @items.size else return 0 end end def names return @items.collect{|item| item.name} end def named_item(a_name) @items.each do |item| return item if item.name.value == a_name end retrun nil end def ith_item(i) return @items[i] end def as_hierarchy return Cluster.new(:name => @name, :archetype_node_id => @archetype_node_id, :items => @items) end end class ItemTable < ItemStructure attr_accessor :rows def initialize(args = {}) super(args) self.rows = args[:rows] end def row_count if @rows.nil? return 0 else return @rows.size end end end end # of ItemStructure end # of DataStructures end # of RM end # of OpenEhr