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.
432 433 434 |
# File 'lib/drip.rb', line 432 def initialize @tree = Hash.new {|h, k| h[k] = Array.new} end |
Instance Method Details
#lower_bound(pair) ⇒ Object
444 445 |
# File 'lib/drip.rb', line 444 def lower_bound(pair) end |
#upper_bound(pair) ⇒ Object
436 437 438 439 440 441 442 |
# File 'lib/drip.rb', line 436 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 |