Class: Critbit::ListCursor

Inherits:
Cursor
  • Object
show all
Defined in:
lib/critbit.rb

Instance Attribute Summary collapse

Attributes inherited from Cursor

#key, #value

Instance Method Summary collapse

Constructor Details

#initialize(type) ⇒ ListCursor





712
713
714
715
716
717
718
719
720
721
# File 'lib/critbit.rb', line 712

def initialize(type)
  
  if (type != :key && type != :value)
    raise "Illegal type #{type}"
  end
  
  @type = type
  @list = Array.new
  
end

Instance Attribute Details

#listObject (readonly)

Returns the value of attribute list.



705
706
707
# File 'lib/critbit.rb', line 705

def list
  @list
end

#typeObject (readonly)

Returns the value of attribute type.



706
707
708
# File 'lib/critbit.rb', line 706

def type
  @type
end

Instance Method Details

#select(entry) ⇒ Object





727
728
729
730
# File 'lib/critbit.rb', line 727

def select(entry)
  @list << ((@type == :key)? entry.getKey() : entry.getValue())
  Decision::CONTINUE
end