Class: Jubatus::Graph::Edge

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

Constant Summary collapse

TYPE =
TTuple.new(TMap.new(TString.new, TString.new), TString.new,
TString.new)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Common

check_type, check_types

Constructor Details

#initialize(property, source, target) ⇒ Edge

Returns a new instance of Edge.


116
117
118
119
120
# File 'lib/jubatus/graph/types.rb', line 116

def initialize(property, source, target)
  @property = property
  @source = source
  @target = target
end

Instance Attribute Details

#propertyObject (readonly)

Returns the value of attribute property


142
143
144
# File 'lib/jubatus/graph/types.rb', line 142

def property
  @property
end

#sourceObject (readonly)

Returns the value of attribute source


142
143
144
# File 'lib/jubatus/graph/types.rb', line 142

def source
  @source
end

#targetObject (readonly)

Returns the value of attribute target


142
143
144
# File 'lib/jubatus/graph/types.rb', line 142

def target
  @target
end

Class Method Details

.from_msgpack(m) ⇒ Object


127
128
129
130
# File 'lib/jubatus/graph/types.rb', line 127

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

Instance Method Details

#to_msgpack(out = '') ⇒ Object


122
123
124
125
# File 'lib/jubatus/graph/types.rb', line 122

def to_msgpack(out = '')
  t = [@property, @source, @target]
  return TYPE.to_msgpack(t)
end

#to_sObject


132
133
134
135
136
137
138
139
140
# File 'lib/jubatus/graph/types.rb', line 132

def to_s
  gen = Jubatus::Common::MessageStringGenerator.new
  gen.open("edge")
  gen.add("property", @property)
  gen.add("source", @source)
  gen.add("target", @target)
  gen.close()
  return gen.to_s
end