Class: Jubatus::Clustering::WeightedIndex
- Inherits:
-
Object
- Object
- Jubatus::Clustering::WeightedIndex
- Includes:
- Jubatus::Common
- Defined in:
- lib/jubatus/clustering/types.rb
Constant Summary collapse
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#weight ⇒ Object
readonly
Returns the value of attribute weight.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(weight, id) ⇒ WeightedIndex
constructor
A new instance of WeightedIndex.
- #to_msgpack(out = '') ⇒ Object
- #to_s ⇒ Object
Methods included from Jubatus::Common
Constructor Details
#initialize(weight, id) ⇒ WeightedIndex
Returns a new instance of WeightedIndex.
79 80 81 82 |
# File 'lib/jubatus/clustering/types.rb', line 79 def initialize(weight, id) @weight = weight @id = id end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
103 104 105 |
# File 'lib/jubatus/clustering/types.rb', line 103 def id @id end |
#weight ⇒ Object (readonly)
Returns the value of attribute weight.
103 104 105 |
# File 'lib/jubatus/clustering/types.rb', line 103 def weight @weight end |
Class Method Details
.from_msgpack(m) ⇒ Object
89 90 91 92 |
# File 'lib/jubatus/clustering/types.rb', line 89 def WeightedIndex.from_msgpack(m) val = TYPE.from_msgpack(m) WeightedIndex.new(*val) end |
Instance Method Details
#to_msgpack(out = '') ⇒ Object
84 85 86 87 |
# File 'lib/jubatus/clustering/types.rb', line 84 def to_msgpack(out = '') t = [@weight, @id] return TYPE.to_msgpack(t) end |
#to_s ⇒ Object
94 95 96 97 98 99 100 101 |
# File 'lib/jubatus/clustering/types.rb', line 94 def to_s gen = Jubatus::Common::MessageStringGenerator.new gen.open("weighted_index") gen.add("weight", @weight) gen.add("id", @id) gen.close() return gen.to_s end |