Class: Drip::FakeRBTree
Instance Method Summary collapse
-
#initialize ⇒ FakeRBTree
constructor
A new instance of FakeRBTree.
- #lower_bound(pair) ⇒ Object
- #upper_bound(pair) ⇒ Object
Methods included from ArrayBsearch
lower_boundary, upper_boundary
Constructor Details
#initialize ⇒ FakeRBTree
Returns a new instance of FakeRBTree.
410 411 412 |
# File 'lib/drip.rb', line 410 def initialize @tree = Hash.new {|h, k| h[k] = Array.new} end |
Instance Method Details
#lower_bound(pair) ⇒ Object
422 423 |
# File 'lib/drip.rb', line 422 def lower_bound(pair) end |
#upper_bound(pair) ⇒ Object
414 415 416 417 418 419 420 |
# File 'lib/drip.rb', line 414 def upper_bound(pair) tag, now = pair return nil unless @tree.include?(tag) ary = @tree[tag] idx = upper_boundary(ary, now) [tag, ary[tag][idx]] end |