Class: Node
- Inherits:
-
Object
- Object
- Node
- Defined in:
- lib/node.rb
Instance Method Summary collapse
- #addLink ⇒ Object
- #getID ⇒ Object
- #getName ⇒ Object
- #getType ⇒ Object
- #getValue ⇒ Object
-
#initialize(num, name, type, value) ⇒ Node
constructor
A new instance of Node.
- #nodeData ⇒ Object
- #setGroup(group) ⇒ Object
- #update(toadd) ⇒ Object
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
#addLink ⇒ Object
36 37 38 |
# File 'lib/node.rb', line 36 def addLink @linkcount += 1 end |
#getID ⇒ Object
16 17 18 |
# File 'lib/node.rb', line 16 def getID return @num end |
#getName ⇒ Object
20 21 22 |
# File 'lib/node.rb', line 20 def getName return @name end |
#getType ⇒ Object
24 25 26 |
# File 'lib/node.rb', line 24 def getType return @type end |
#getValue ⇒ Object
28 29 30 |
# File 'lib/node.rb', line 28 def getValue return @value end |
#nodeData ⇒ Object
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 |