blob: 748eee9429a420fab0c8bc5b71e1889ff8e945e9 (
plain)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
-- Copyright 2011 by Jannis Pohlmann
-- Copyright 2012 by Till Tantau
--
-- This file may be distributed an/or modified
--
-- 1. under the LaTeX Project Public License and/or
-- 2. under the GNU Public License
--
-- See the file doc/generic/pgf/licenses/LICENSE for more information
-- @release $Header: /cvsroot/pgf/pgf/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Cluster.lua,v 1.1 2012/11/27 17:24:25 tantau Exp $
--- The Cluser class defines a model of a cluster inside a graph.
--
--
local Cluster = {}
Cluster.__index = Cluster
-- Namespace
--- TODO Jannis: Add documentation for this class.
--
function Cluster.new(name)
local cluster = {
name = name,
nodes = {},
contains_node = {},
}
setmetatable(cluster, Cluster)
return cluster
end
function Cluster:getName()
return self.name
end
function Cluster:addNode(node)
if not self:findNode(node) then
self.contains_node[node] = true
self.nodes[#self.nodes + 1] = node
end
end
function Cluster:findNode(node)
return self.contains_node[node]
end
-- Done
return Cluster
|