Class: Shades::StreamBin

Inherits:
Object
  • Object
show all
Defined in:
lib/shades/histo.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(count, sum) ⇒ StreamBin

Returns a new instance of StreamBin.



122
123
124
125
# File 'lib/shades/histo.rb', line 122

def initialize(count, sum)
  @count = count
  @sum = sum
end

Instance Attribute Details

#countObject

Returns the value of attribute count.



119
120
121
# File 'lib/shades/histo.rb', line 119

def count
  @count
end

#sumObject

Returns the value of attribute sum.



120
121
122
# File 'lib/shades/histo.rb', line 120

def sum
  @sum
end

Instance Method Details

#meanObject



132
133
134
# File 'lib/shades/histo.rb', line 132

def mean
  Float(@sum) / Float(@count)
end

#merge(sb) ⇒ Object



127
128
129
130
# File 'lib/shades/histo.rb', line 127

def merge(sb)
  @count += sb.count
  @sum += sb.sum
end