Class: Item
- Inherits:
-
Object
- Object
- Item
- Defined in:
- lib/quantile_estimator/item.rb
Overview
n = items k = asymptote S = data structure containing multiple tuples s = samples of items from the data stream
Instance Attribute Summary collapse
-
#delta ⇒ Object
Returns the value of attribute delta.
-
#g ⇒ Object
Returns the value of attribute g.
-
#rank ⇒ Object
Returns the value of attribute rank.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(value, g, delta, rank = nil) ⇒ Item
constructor
A new instance of Item.
- #merge(item) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(value, g, delta, rank = nil) ⇒ Item
Returns a new instance of Item.
7 8 9 10 11 12 |
# File 'lib/quantile_estimator/item.rb', line 7 def initialize(value, g, delta, rank=nil) self.value = value self.g = g self.delta = delta self.rank = rank end |
Instance Attribute Details
#delta ⇒ Object
Returns the value of attribute delta.
6 7 8 |
# File 'lib/quantile_estimator/item.rb', line 6 def delta @delta end |
#g ⇒ Object
Returns the value of attribute g.
6 7 8 |
# File 'lib/quantile_estimator/item.rb', line 6 def g @g end |
#rank ⇒ Object
Returns the value of attribute rank.
6 7 8 |
# File 'lib/quantile_estimator/item.rb', line 6 def rank @rank end |
#value ⇒ Object
Returns the value of attribute value.
6 7 8 |
# File 'lib/quantile_estimator/item.rb', line 6 def value @value end |
Instance Method Details
#merge(item) ⇒ Object
14 15 16 |
# File 'lib/quantile_estimator/item.rb', line 14 def merge(item) Item.new(item.value, self.g + item.g, item.delta, item.rank) end |
#to_s ⇒ Object
18 19 20 |
# File 'lib/quantile_estimator/item.rb', line 18 def to_s [value, g, delta, rank].inspect end |