class Stream

Attributes

current_pointer[R]
index[R]
times[R]

Public Class Methods

new(index, sample_count) click to toggle source
# File benchmarks/sorted_set.rb, line 23
def initialize(index, sample_count)
    @index = index
    @current_pointer = 0

    current = 0
    @times = Array.new
    sample_count.times do |i|
        times << (current += rand(1))
    end
end

Public Instance Methods

<=>(other) click to toggle source
# File benchmarks/sorted_set.rb, line 33
def <=>(other)
    current <=> other.current
end
current() click to toggle source
# File benchmarks/sorted_set.rb, line 13
def current
    times[current_pointer]
end
next() click to toggle source
# File benchmarks/sorted_set.rb, line 16
def next
    times[@current_pointer += 1]
end
rewind() click to toggle source
# File benchmarks/sorted_set.rb, line 19
def rewind
    @current_pointer = 0
end