Class: Jubatus::Clustering::WeightedDatum
- Inherits:
-
Object
- Object
- Jubatus::Clustering::WeightedDatum
- Includes:
- Jubatus::Common
- Defined in:
- lib/jubatus/clustering/types.rb
Constant Summary collapse
Instance Attribute Summary collapse
-
#point ⇒ Object
readonly
Returns the value of attribute point.
-
#weight ⇒ Object
readonly
Returns the value of attribute weight.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(weight, point) ⇒ WeightedDatum
constructor
A new instance of WeightedDatum.
- #to_msgpack(out = '') ⇒ Object
- #to_s ⇒ Object
Methods included from Jubatus::Common
Constructor Details
#initialize(weight, point) ⇒ WeightedDatum
Returns a new instance of WeightedDatum.
15 16 17 18 |
# File 'lib/jubatus/clustering/types.rb', line 15 def initialize(weight, point) @weight = weight @point = point end |
Instance Attribute Details
#point ⇒ Object (readonly)
Returns the value of attribute point
39 40 41 |
# File 'lib/jubatus/clustering/types.rb', line 39 def point @point end |
#weight ⇒ Object (readonly)
Returns the value of attribute weight
39 40 41 |
# File 'lib/jubatus/clustering/types.rb', line 39 def weight @weight end |
Class Method Details
.from_msgpack(m) ⇒ Object
25 26 27 28 |
# File 'lib/jubatus/clustering/types.rb', line 25 def WeightedDatum.from_msgpack(m) val = TYPE.from_msgpack(m) WeightedDatum.new(*val) end |
Instance Method Details
#to_msgpack(out = '') ⇒ Object
20 21 22 23 |
# File 'lib/jubatus/clustering/types.rb', line 20 def to_msgpack(out = '') t = [@weight, @point] return TYPE.to_msgpack(t) end |
#to_s ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/jubatus/clustering/types.rb', line 30 def to_s gen = Jubatus::Common::MessageStringGenerator.new gen.open("weighted_datum") gen.add("weight", @weight) gen.add("point", @point) gen.close() return gen.to_s end |