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





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

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.



695
696
697
# File 'lib/critbit.rb', line 695

def list
  @list
end

#typeObject (readonly)

Returns the value of attribute type.



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

def type
  @type
end

Instance Method Details

#select(entry) ⇒ Object





717
718
719
720
# File 'lib/critbit.rb', line 717

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