Class: Jubatus::Graph::Node

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), TList.new(TInt.new(
false, 8)), TList.new(TInt.new(false, 8)))

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Common

check_type, check_types

Constructor Details

#initialize(property, in_edges, out_edges) ⇒ Node

Returns a new instance of Node.



16
17
18
19
20
# File 'lib/jubatus/graph/types.rb', line 16

def initialize(property, in_edges, out_edges)
  @property = property
  @in_edges = in_edges
  @out_edges = out_edges
end

Instance Attribute Details

#in_edgesObject (readonly)

Returns the value of attribute in_edges.



42
43
44
# File 'lib/jubatus/graph/types.rb', line 42

def in_edges
  @in_edges
end

#out_edgesObject (readonly)

Returns the value of attribute out_edges.



42
43
44
# File 'lib/jubatus/graph/types.rb', line 42

def out_edges
  @out_edges
end

#propertyObject (readonly)

Returns the value of attribute property.



42
43
44
# File 'lib/jubatus/graph/types.rb', line 42

def property
  @property
end

Class Method Details

.from_msgpack(m) ⇒ Object



27
28
29
30
# File 'lib/jubatus/graph/types.rb', line 27

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

Instance Method Details

#to_msgpack(out = '') ⇒ Object



22
23
24
25
# File 'lib/jubatus/graph/types.rb', line 22

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

#to_sObject



32
33
34
35
36
37
38
39
40
# File 'lib/jubatus/graph/types.rb', line 32

def to_s
  gen = Jubatus::Common::MessageStringGenerator.new
  gen.open("node")
  gen.add("property", @property)
  gen.add("in_edges", @in_edges)
  gen.add("out_edges", @out_edges)
  gen.close()
  return gen.to_s
end