Class: Jubatus::Burst::Batch

Inherits:
Object
  • Object
show all
Includes:
Common
Defined in:
lib/jubatus/burst/types.rb

Constant Summary collapse

TYPE =
TTuple.new(TInt.new(true, 4), TInt.new(true, 4), TFloat.new)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Common

check_type, check_types

Constructor Details

#initialize(all_data_count, relevant_data_count, burst_weight) ⇒ Batch

Returns a new instance of Batch.



49
50
51
52
53
# File 'lib/jubatus/burst/types.rb', line 49

def initialize(all_data_count, relevant_data_count, burst_weight)
  @all_data_count = all_data_count
  @relevant_data_count = relevant_data_count
  @burst_weight = burst_weight
end

Instance Attribute Details

#all_data_countObject (readonly)

Returns the value of attribute all_data_count.



75
76
77
# File 'lib/jubatus/burst/types.rb', line 75

def all_data_count
  @all_data_count
end

#burst_weightObject (readonly)

Returns the value of attribute burst_weight.



75
76
77
# File 'lib/jubatus/burst/types.rb', line 75

def burst_weight
  @burst_weight
end

#relevant_data_countObject (readonly)

Returns the value of attribute relevant_data_count.



75
76
77
# File 'lib/jubatus/burst/types.rb', line 75

def relevant_data_count
  @relevant_data_count
end

Class Method Details

.from_msgpack(m) ⇒ Object



60
61
62
63
# File 'lib/jubatus/burst/types.rb', line 60

def Batch.from_msgpack(m)
  val = TYPE.from_msgpack(m)
  Batch.new(*val)
end

Instance Method Details

#to_msgpack(out = '') ⇒ Object



55
56
57
58
# File 'lib/jubatus/burst/types.rb', line 55

def to_msgpack(out = '')
  t = [@all_data_count, @relevant_data_count, @burst_weight]
  return TYPE.to_msgpack(t)
end

#to_sObject



65
66
67
68
69
70
71
72
73
# File 'lib/jubatus/burst/types.rb', line 65

def to_s
  gen = Jubatus::Common::MessageStringGenerator.new
  gen.open("batch")
  gen.add("all_data_count", @all_data_count)
  gen.add("relevant_data_count", @relevant_data_count)
  gen.add("burst_weight", @burst_weight)
  gen.close()
  return gen.to_s
end