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





704
705
706
707
708
709
710
711
712
713
# File 'lib/critbit.rb', line 704

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.



697
698
699
# File 'lib/critbit.rb', line 697

def list
  @list
end

#typeObject (readonly)

Returns the value of attribute type.



698
699
700
# File 'lib/critbit.rb', line 698

def type
  @type
end

Instance Method Details

#select(entry) ⇒ Object





719
720
721
722
# File 'lib/critbit.rb', line 719

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