Class: Node

Inherits:
Object
  • Object
show all
Defined in:
lib/node.rb

Instance Method Summary collapse

Constructor Details

#initialize(num, name, type, value) ⇒ Node

Returns a new instance of Node.



2
3
4
5
6
7
8
9
10
# File 'lib/node.rb', line 2

def initialize(num, name, type, value)
  @num = num
  @name = name
  @type = type
  @group = nil
  @linkcount = 0
  @value = Array.new
  @value.push(value)
end

Instance Method Details



36
37
38
# File 'lib/node.rb', line 36

def addLink
  @linkcount += 1
end

#getIDObject



16
17
18
# File 'lib/node.rb', line 16

def getID
  return @num
end

#getNameObject



20
21
22
# File 'lib/node.rb', line 20

def getName
  return @name
end

#getTypeObject



24
25
26
# File 'lib/node.rb', line 24

def getType
  return @type
end

#getValueObject



28
29
30
# File 'lib/node.rb', line 28

def getValue
  return @value
end

#nodeDataObject



40
41
42
# File 'lib/node.rb', line 40

def nodeData
  json_hash = {:name => @name, :type => @type, :group => @group, :linkcount => @linkcount, :data => @value}
end

#setGroup(group) ⇒ Object



32
33
34
# File 'lib/node.rb', line 32

def setGroup(group)
  @group = group
end

#update(toadd) ⇒ Object



12
13
14
# File 'lib/node.rb', line 12

def update(toadd)
  @value.push(toadd)
end