-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDataTreeObj.lua
executable file
·48 lines (38 loc) · 935 Bytes
/
DataTreeObj.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
--
-- DataTreeObj.lua
--
-- DataTreeModel - Simple Toolkit for Information Visualization
--
-- Copyright (c) 2018-2019 Armando Arce - [email protected]
--
-- This library is free software; you can redistribute it and/or modify
-- it under the terms of the MIT license. See LICENSE for details.
--
require "DataTree"
function DataTree:newNode(label)
return newNode(self,label)
end
function DataTree:addChild(node,label)
return addChild(self,node,label)
end
function DataTree:addField(name)
addField(self,name)
end
function DataTree:setField(field,value,num)
setField(self,field,value,num)
end
function DataTree:setValue(field,node,value)
self[field][node] = value
end
function DataTree:getValue(field,node)
return self[field][node]
end
function DataTree:getRoot()
return getRoot(self)
end
function isRoot(self,node)
return (self.parent[node] == NULL)
end
function DataTree:print()
printTree(self,self.root)
end