# File app/models/smerf_item.rb, line 46
  def initialize(raw_data, sort_order_field, class_code_array, owner_ident)
    # Store the raw data as extracted from the form definition file
    @raw_data = raw_data
    # Stores the sort order used to sort items of this class. We then use
    # this field to make sure that the field is actually present in the items
    # definition. For example groups can be sorted by code, the smerf object will
    # pass the sort order field (code) to new group classes it creates, this value
    # is then used to confirm that each group has a code field defined. Form
    # does not have a sort field so it passes an empty string.
    @sort_order_field = sort_order_field
    # When defining a new section/level in a YAML file you do so by specifying a 
    # section/level header, e.g. groups:, but there is no value associated with it,
    # sub items are then defined, i.e. code: xyz. When the YAML file is loaded the 
    # header is loaded into an element array with 0 as the index and the items for
    # the level is loaded into another element with 1 as the index. The two data items
    # below are used to store the two bits of data (see decodedata method)
    @item_tag = nil
    @item_data = nil
    
    # By default make codes be unique for a complete form
    @code_unique_for_smerf = true
  
    # We may only want to have the items unique within a groups of sub items, for
    # example we want code to be unique for all answers to a question, we may not
    # want to them to unique within a complete form, here we use an instance 
    # variable so it only unique for this object
    @code_array = Array.new
    
    # I was going to use a single class array in this class @@class_code_array 
    # but it turns out Ruby at the moment will use the same class variable for 
    # ALL classes that derive from this class. This is not what I want as I want 
    # to keep a separate list of codes for groups, question. Using the class
    # var in this class means all of them would be mixed in together, not what 
    # I want. I believe in Ruby V2 this will ber fixed where the class var would
    # be for the resultant class SmerfGroup. In the mean time I have to create
    # a class var in each child class and pass it in to the base.
    @class_code_array = class_code_array
    
    @owner_ident = owner_ident
    @object_ident = nil
  end