Changeset 207 for ruby/branches/0.5/lib


Ignore:
Timestamp:
Aug 16, 2009, 7:14:16 PM (15 years ago)
Author:
KOBAYASHI, Shinji
Message:

refs #54

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ruby/branches/0.5/lib/open_ehr/rm/data_structures/item_structure.rb

    r203 r207  
    5757
    5858          def ith_item(i)
    59             return @items[i]
     59            raise ArgumentError, 'index invalid' if i <= 0
     60            return @items[i - 1]
    6061          end
    6162
     
    8283            end
    8384          end
     85
     86          def column_count
     87            if @rows.nil?
     88              return 0
     89            else
     90              return @rows[0].items.count
     91            end
     92          end
     93
     94          def row_names
     95            if @rows.nil?
     96              return []
     97            else
     98              return @rows.collect{|r| r.name}
     99            end
     100          end
     101
     102          def column_names
     103            if @rows.nil?
     104              return []
     105            else
     106              return @rows[0].items.collect{|i| i.name}
     107            end
     108          end
     109
     110          def ith_row(i)
     111            raise ArgumentError, 'invalid index' if i<=0 or i>@rows.size
     112            if @rows.nil?
     113              return []
     114            else
     115              return @rows[i - 1]
     116            end
     117          end
    84118        end
    85119      end # of ItemStructure
Note: See TracChangeset for help on using the changeset viewer.