JohnSmall-acts-as-hausdorff-space 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +10 -0
- data/VERSION.yml +1 -1
- data/acts-as-hausdorff-space.gemspec +97 -0
- data/design_idea.rdoc +27 -0
- data/doc/LICENSE.html +113 -0
- data/doc/MindoroMarine.html +153 -0
- data/doc/MindoroMarine/Acts.html +150 -0
- data/doc/MindoroMarine/Acts/HausdorffSpace.html +160 -0
- data/doc/MindoroMarine/Acts/HausdorffSpace/ActMethods.html +230 -0
- data/doc/MindoroMarine/Acts/HausdorffSpace/ClassMethods.html +466 -0
- data/doc/MindoroMarine/Acts/HausdorffSpace/Gap.html +193 -0
- data/doc/MindoroMarine/Acts/HausdorffSpace/HSArray.html +234 -0
- data/doc/MindoroMarine/Acts/HausdorffSpace/InstanceMethods.html +1152 -0
- data/doc/MindoroMarine/Acts/HausdorffSpace/VirtualRoot.html +261 -0
- data/doc/README_rdoc.html +386 -0
- data/doc/created.rid +1 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +140 -0
- data/doc/js/darkfish.js +116 -0
- data/doc/js/jquery.js +32 -0
- data/doc/js/quicksearch.js +114 -0
- data/doc/js/thickbox-compressed.js +10 -0
- data/doc/lib/acts-as-hausdorff-space_rb.html +55 -0
- data/doc/lib/acts_as_hausdorff_space_rb.html +53 -0
- data/doc/rdoc.css +696 -0
- data/lib/acts_as_hausdorff_space.rb +22 -14
- data/test/acts_as_hausdorff_space_test.rb +13 -0
- metadata +48 -4
@@ -0,0 +1,193 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
|
7
|
+
|
8
|
+
<title>Class: MindoroMarine::Acts::HausdorffSpace::Gap</title>
|
9
|
+
|
10
|
+
<link rel="stylesheet" href="../../../rdoc.css" type="text/css" media="screen" />
|
11
|
+
|
12
|
+
<script src="../../../js/jquery.js" type="text/javascript"
|
13
|
+
charset="utf-8"></script>
|
14
|
+
<script src="../../../js/thickbox-compressed.js" type="text/javascript"
|
15
|
+
charset="utf-8"></script>
|
16
|
+
<script src="../../../js/quicksearch.js" type="text/javascript"
|
17
|
+
charset="utf-8"></script>
|
18
|
+
<script src="../../../js/darkfish.js" type="text/javascript"
|
19
|
+
charset="utf-8"></script>
|
20
|
+
|
21
|
+
</head>
|
22
|
+
<body class="class">
|
23
|
+
|
24
|
+
<div id="metadata">
|
25
|
+
<div id="file-metadata">
|
26
|
+
<div id="file-list-section" class="section">
|
27
|
+
<h3 class="section-header">In Files</h3>
|
28
|
+
<div class="section-body">
|
29
|
+
<ul>
|
30
|
+
|
31
|
+
<li><a href="../../../lib/acts_as_hausdorff_space.rb.html?TB_iframe=true&height=550&width=785"
|
32
|
+
class="thickbox" title="lib/acts_as_hausdorff_space.rb">lib/acts_as_hausdorff_space.rb</a></li>
|
33
|
+
|
34
|
+
</ul>
|
35
|
+
</div>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div id="class-metadata">
|
42
|
+
|
43
|
+
<!-- Parent Class -->
|
44
|
+
|
45
|
+
<div id="parent-class-section" class="section">
|
46
|
+
<h3 class="section-header">Parent</h3>
|
47
|
+
|
48
|
+
<p class="link">Object</p>
|
49
|
+
|
50
|
+
</div>
|
51
|
+
|
52
|
+
|
53
|
+
<!-- Namespace Contents -->
|
54
|
+
|
55
|
+
|
56
|
+
<!-- Method Quickref -->
|
57
|
+
|
58
|
+
|
59
|
+
<!-- Included Modules -->
|
60
|
+
|
61
|
+
</div>
|
62
|
+
|
63
|
+
<div id="project-metadata">
|
64
|
+
|
65
|
+
|
66
|
+
<div id="fileindex-section" class="section project-section">
|
67
|
+
<h3 class="section-header">Files</h3>
|
68
|
+
<ul>
|
69
|
+
|
70
|
+
<li class="file"><a href="../../../LICENSE.html">LICENSE</a></li>
|
71
|
+
|
72
|
+
<li class="file"><a href="../../../README_rdoc.html">README.rdoc</a></li>
|
73
|
+
|
74
|
+
</ul>
|
75
|
+
</div>
|
76
|
+
|
77
|
+
|
78
|
+
<div id="classindex-section" class="section project-section">
|
79
|
+
<h3 class="section-header">Class Index
|
80
|
+
<span class="search-toggle"><img src="../../../images/find.png"
|
81
|
+
height="16" width="16" alt="[+]"
|
82
|
+
title="show/hide quicksearch" /></span></h3>
|
83
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
84
|
+
<fieldset>
|
85
|
+
<legend>Quicksearch</legend>
|
86
|
+
<input type="text" name="quicksearch" value=""
|
87
|
+
class="quicksearch-field" />
|
88
|
+
</fieldset>
|
89
|
+
</form>
|
90
|
+
|
91
|
+
<ul class="link-list">
|
92
|
+
|
93
|
+
<li><a href="../../../MindoroMarine.html">MindoroMarine</a></li>
|
94
|
+
|
95
|
+
<li><a href="../../../MindoroMarine/Acts/HausdorffSpace/ActMethods.html">MindoroMarine::Acts::HausdorffSpace::ActMethods</a></li>
|
96
|
+
|
97
|
+
<li><a href="../../../MindoroMarine/Acts/HausdorffSpace/ClassMethods.html">MindoroMarine::Acts::HausdorffSpace::ClassMethods</a></li>
|
98
|
+
|
99
|
+
<li><a href="../../../MindoroMarine/Acts/HausdorffSpace/Gap.html">MindoroMarine::Acts::HausdorffSpace::Gap</a></li>
|
100
|
+
|
101
|
+
<li><a href="../../../MindoroMarine/Acts/HausdorffSpace/HSArray.html">MindoroMarine::Acts::HausdorffSpace::HSArray</a></li>
|
102
|
+
|
103
|
+
<li><a href="../../../MindoroMarine/Acts/HausdorffSpace/InstanceMethods.html">MindoroMarine::Acts::HausdorffSpace::InstanceMethods</a></li>
|
104
|
+
|
105
|
+
<li><a href="../../../MindoroMarine/Acts/HausdorffSpace/VirtualRoot.html">MindoroMarine::Acts::HausdorffSpace::VirtualRoot</a></li>
|
106
|
+
|
107
|
+
</ul>
|
108
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
109
|
+
</div>
|
110
|
+
|
111
|
+
|
112
|
+
</div>
|
113
|
+
</div>
|
114
|
+
|
115
|
+
<div id="documentation">
|
116
|
+
<h1 class="class">MindoroMarine::Acts::HausdorffSpace::Gap</h1>
|
117
|
+
|
118
|
+
<div id="description">
|
119
|
+
<p>
|
120
|
+
Each branch has branches and/or leaves and gaps to put new things in A gap
|
121
|
+
has attributes <a href="Gap.html#left_col_val">left_col_val</a> and <a
|
122
|
+
href="Gap.html#right_col_val">right_col_val</a>
|
123
|
+
</p>
|
124
|
+
|
125
|
+
</div>
|
126
|
+
|
127
|
+
<!-- Constants -->
|
128
|
+
|
129
|
+
|
130
|
+
<!-- Attributes -->
|
131
|
+
|
132
|
+
<div id="attribute-method-details" class="method-section section">
|
133
|
+
<h3 class="section-header">Attributes</h3>
|
134
|
+
|
135
|
+
|
136
|
+
<div id="left-col-val-attribute-method" class="method-detail">
|
137
|
+
<a name="left_col_val"></a>
|
138
|
+
|
139
|
+
<a name="left_col_val="></a>
|
140
|
+
|
141
|
+
<div class="method-heading attribute-method-heading">
|
142
|
+
<span class="method-name">left_col_val</span><span
|
143
|
+
class="attribute-access-type">[RW]</span>
|
144
|
+
</div>
|
145
|
+
|
146
|
+
<div class="method-description">
|
147
|
+
|
148
|
+
<p class="missing-docs">(Not documented)</p>
|
149
|
+
|
150
|
+
</div>
|
151
|
+
</div>
|
152
|
+
|
153
|
+
<div id="right-col-val-attribute-method" class="method-detail">
|
154
|
+
<a name="right_col_val"></a>
|
155
|
+
|
156
|
+
<a name="right_col_val="></a>
|
157
|
+
|
158
|
+
<div class="method-heading attribute-method-heading">
|
159
|
+
<span class="method-name">right_col_val</span><span
|
160
|
+
class="attribute-access-type">[RW]</span>
|
161
|
+
</div>
|
162
|
+
|
163
|
+
<div class="method-description">
|
164
|
+
|
165
|
+
<p class="missing-docs">(Not documented)</p>
|
166
|
+
|
167
|
+
</div>
|
168
|
+
</div>
|
169
|
+
|
170
|
+
</div>
|
171
|
+
|
172
|
+
|
173
|
+
<!-- Methods -->
|
174
|
+
|
175
|
+
|
176
|
+
</div>
|
177
|
+
|
178
|
+
|
179
|
+
<div id="rdoc-debugging-section-dump" class="debugging-section">
|
180
|
+
|
181
|
+
<p>Disabled; run with --debug to generate this.</p>
|
182
|
+
|
183
|
+
</div>
|
184
|
+
|
185
|
+
<div id="validator-badges">
|
186
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
187
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
188
|
+
Rdoc Generator</a> 1.1.6</small>.</p>
|
189
|
+
</div>
|
190
|
+
|
191
|
+
</body>
|
192
|
+
</html>
|
193
|
+
|
@@ -0,0 +1,234 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
|
7
|
+
|
8
|
+
<title>Class: MindoroMarine::Acts::HausdorffSpace::HSArray</title>
|
9
|
+
|
10
|
+
<link rel="stylesheet" href="../../../rdoc.css" type="text/css" media="screen" />
|
11
|
+
|
12
|
+
<script src="../../../js/jquery.js" type="text/javascript"
|
13
|
+
charset="utf-8"></script>
|
14
|
+
<script src="../../../js/thickbox-compressed.js" type="text/javascript"
|
15
|
+
charset="utf-8"></script>
|
16
|
+
<script src="../../../js/quicksearch.js" type="text/javascript"
|
17
|
+
charset="utf-8"></script>
|
18
|
+
<script src="../../../js/darkfish.js" type="text/javascript"
|
19
|
+
charset="utf-8"></script>
|
20
|
+
|
21
|
+
</head>
|
22
|
+
<body class="class">
|
23
|
+
|
24
|
+
<div id="metadata">
|
25
|
+
<div id="file-metadata">
|
26
|
+
<div id="file-list-section" class="section">
|
27
|
+
<h3 class="section-header">In Files</h3>
|
28
|
+
<div class="section-body">
|
29
|
+
<ul>
|
30
|
+
|
31
|
+
<li><a href="../../../lib/acts_as_hausdorff_space.rb.html?TB_iframe=true&height=550&width=785"
|
32
|
+
class="thickbox" title="lib/acts_as_hausdorff_space.rb">lib/acts_as_hausdorff_space.rb</a></li>
|
33
|
+
|
34
|
+
</ul>
|
35
|
+
</div>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div id="class-metadata">
|
42
|
+
|
43
|
+
<!-- Parent Class -->
|
44
|
+
|
45
|
+
<div id="parent-class-section" class="section">
|
46
|
+
<h3 class="section-header">Parent</h3>
|
47
|
+
|
48
|
+
<p class="link">Array</p>
|
49
|
+
|
50
|
+
</div>
|
51
|
+
|
52
|
+
|
53
|
+
<!-- Namespace Contents -->
|
54
|
+
|
55
|
+
|
56
|
+
<!-- Method Quickref -->
|
57
|
+
|
58
|
+
<div id="method-list-section" class="section">
|
59
|
+
<h3 class="section-header">Methods</h3>
|
60
|
+
<ul class="link-list">
|
61
|
+
|
62
|
+
<li><a href="#M000002">#<<</a></li>
|
63
|
+
|
64
|
+
</ul>
|
65
|
+
</div>
|
66
|
+
|
67
|
+
|
68
|
+
<!-- Included Modules -->
|
69
|
+
|
70
|
+
</div>
|
71
|
+
|
72
|
+
<div id="project-metadata">
|
73
|
+
|
74
|
+
|
75
|
+
<div id="fileindex-section" class="section project-section">
|
76
|
+
<h3 class="section-header">Files</h3>
|
77
|
+
<ul>
|
78
|
+
|
79
|
+
<li class="file"><a href="../../../LICENSE.html">LICENSE</a></li>
|
80
|
+
|
81
|
+
<li class="file"><a href="../../../README_rdoc.html">README.rdoc</a></li>
|
82
|
+
|
83
|
+
</ul>
|
84
|
+
</div>
|
85
|
+
|
86
|
+
|
87
|
+
<div id="classindex-section" class="section project-section">
|
88
|
+
<h3 class="section-header">Class Index
|
89
|
+
<span class="search-toggle"><img src="../../../images/find.png"
|
90
|
+
height="16" width="16" alt="[+]"
|
91
|
+
title="show/hide quicksearch" /></span></h3>
|
92
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
93
|
+
<fieldset>
|
94
|
+
<legend>Quicksearch</legend>
|
95
|
+
<input type="text" name="quicksearch" value=""
|
96
|
+
class="quicksearch-field" />
|
97
|
+
</fieldset>
|
98
|
+
</form>
|
99
|
+
|
100
|
+
<ul class="link-list">
|
101
|
+
|
102
|
+
<li><a href="../../../MindoroMarine.html">MindoroMarine</a></li>
|
103
|
+
|
104
|
+
<li><a href="../../../MindoroMarine/Acts/HausdorffSpace/ActMethods.html">MindoroMarine::Acts::HausdorffSpace::ActMethods</a></li>
|
105
|
+
|
106
|
+
<li><a href="../../../MindoroMarine/Acts/HausdorffSpace/ClassMethods.html">MindoroMarine::Acts::HausdorffSpace::ClassMethods</a></li>
|
107
|
+
|
108
|
+
<li><a href="../../../MindoroMarine/Acts/HausdorffSpace/Gap.html">MindoroMarine::Acts::HausdorffSpace::Gap</a></li>
|
109
|
+
|
110
|
+
<li><a href="../../../MindoroMarine/Acts/HausdorffSpace/HSArray.html">MindoroMarine::Acts::HausdorffSpace::HSArray</a></li>
|
111
|
+
|
112
|
+
<li><a href="../../../MindoroMarine/Acts/HausdorffSpace/InstanceMethods.html">MindoroMarine::Acts::HausdorffSpace::InstanceMethods</a></li>
|
113
|
+
|
114
|
+
<li><a href="../../../MindoroMarine/Acts/HausdorffSpace/VirtualRoot.html">MindoroMarine::Acts::HausdorffSpace::VirtualRoot</a></li>
|
115
|
+
|
116
|
+
</ul>
|
117
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
118
|
+
</div>
|
119
|
+
|
120
|
+
|
121
|
+
</div>
|
122
|
+
</div>
|
123
|
+
|
124
|
+
<div id="documentation">
|
125
|
+
<h1 class="class">MindoroMarine::Acts::HausdorffSpace::HSArray</h1>
|
126
|
+
|
127
|
+
<div id="description">
|
128
|
+
<p>
|
129
|
+
We need an array to hold children. Because we want to be able to write
|
130
|
+
parent.children << SomeModel.new then we need to do special stuff in
|
131
|
+
“<<” but we don’t want to mixin into Array because that
|
132
|
+
might (almost certainly would) mess up other code, so we’ll get very
|
133
|
+
javary and subclass Array
|
134
|
+
</p>
|
135
|
+
|
136
|
+
</div>
|
137
|
+
|
138
|
+
<!-- Constants -->
|
139
|
+
|
140
|
+
|
141
|
+
<!-- Attributes -->
|
142
|
+
|
143
|
+
<div id="attribute-method-details" class="method-section section">
|
144
|
+
<h3 class="section-header">Attributes</h3>
|
145
|
+
|
146
|
+
|
147
|
+
<div id="parent-attribute-method" class="method-detail">
|
148
|
+
<a name="parent"></a>
|
149
|
+
|
150
|
+
<a name="parent="></a>
|
151
|
+
|
152
|
+
<div class="method-heading attribute-method-heading">
|
153
|
+
<span class="method-name">parent</span><span
|
154
|
+
class="attribute-access-type">[RW]</span>
|
155
|
+
</div>
|
156
|
+
|
157
|
+
<div class="method-description">
|
158
|
+
|
159
|
+
<p class="missing-docs">(Not documented)</p>
|
160
|
+
|
161
|
+
</div>
|
162
|
+
</div>
|
163
|
+
|
164
|
+
</div>
|
165
|
+
|
166
|
+
|
167
|
+
<!-- Methods -->
|
168
|
+
|
169
|
+
<div id="public-instance-method-details" class="method-section section">
|
170
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
171
|
+
|
172
|
+
|
173
|
+
<div id="--method" class="method-detail ">
|
174
|
+
<a name="M000002"></a>
|
175
|
+
|
176
|
+
<div class="method-heading">
|
177
|
+
|
178
|
+
<span class="method-name"><<</span><span
|
179
|
+
class="method-args">(elem)</span>
|
180
|
+
<span class="method-click-advice">click to toggle source</span>
|
181
|
+
|
182
|
+
</div>
|
183
|
+
|
184
|
+
<div class="method-description">
|
185
|
+
|
186
|
+
<p class="missing-docs">(Not documented)</p>
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
<div class="method-source-code"
|
191
|
+
id="--source">
|
192
|
+
<pre>
|
193
|
+
<span class="ruby-comment cmt"># File lib/acts_as_hausdorff_space.rb, line 65</span>
|
194
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-operator"><<</span>(<span class="ruby-identifier">elem</span>)
|
195
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">elem</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>) <span class="ruby-comment cmt"># if it is an array then load each item into the HSArray in turn</span>
|
196
|
+
<span class="ruby-identifier">elem</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span>
|
197
|
+
<span class="ruby-comment cmt">#puts "each item #{elem.class.name} item #{item.class.name}"</span>
|
198
|
+
<span class="ruby-keyword kw">self</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">item</span>
|
199
|
+
<span class="ruby-keyword kw">end</span>
|
200
|
+
<span class="ruby-keyword kw">else</span>
|
201
|
+
<span class="ruby-keyword kw">super</span>
|
202
|
+
<span class="ruby-comment cmt">#puts "add one #{elem.class.name}"</span>
|
203
|
+
<span class="ruby-identifier">elem</span>.<span class="ruby-identifier">parent</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">parent</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">parent</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">elem</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value str">'parent'</span>)
|
204
|
+
<span class="ruby-keyword kw">end</span>
|
205
|
+
<span class="ruby-keyword kw">end</span></pre>
|
206
|
+
</div>
|
207
|
+
|
208
|
+
</div>
|
209
|
+
|
210
|
+
|
211
|
+
</div>
|
212
|
+
|
213
|
+
|
214
|
+
</div>
|
215
|
+
|
216
|
+
|
217
|
+
</div>
|
218
|
+
|
219
|
+
|
220
|
+
<div id="rdoc-debugging-section-dump" class="debugging-section">
|
221
|
+
|
222
|
+
<p>Disabled; run with --debug to generate this.</p>
|
223
|
+
|
224
|
+
</div>
|
225
|
+
|
226
|
+
<div id="validator-badges">
|
227
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
228
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
229
|
+
Rdoc Generator</a> 1.1.6</small>.</p>
|
230
|
+
</div>
|
231
|
+
|
232
|
+
</body>
|
233
|
+
</html>
|
234
|
+
|
@@ -0,0 +1,1152 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
|
7
|
+
|
8
|
+
<title>Module: MindoroMarine::Acts::HausdorffSpace::InstanceMethods</title>
|
9
|
+
|
10
|
+
<link rel="stylesheet" href="../../../rdoc.css" type="text/css" media="screen" />
|
11
|
+
|
12
|
+
<script src="../../../js/jquery.js" type="text/javascript"
|
13
|
+
charset="utf-8"></script>
|
14
|
+
<script src="../../../js/thickbox-compressed.js" type="text/javascript"
|
15
|
+
charset="utf-8"></script>
|
16
|
+
<script src="../../../js/quicksearch.js" type="text/javascript"
|
17
|
+
charset="utf-8"></script>
|
18
|
+
<script src="../../../js/darkfish.js" type="text/javascript"
|
19
|
+
charset="utf-8"></script>
|
20
|
+
|
21
|
+
</head>
|
22
|
+
<body class="module">
|
23
|
+
|
24
|
+
<div id="metadata">
|
25
|
+
<div id="file-metadata">
|
26
|
+
<div id="file-list-section" class="section">
|
27
|
+
<h3 class="section-header">In Files</h3>
|
28
|
+
<div class="section-body">
|
29
|
+
<ul>
|
30
|
+
|
31
|
+
<li><a href="../../../lib/acts_as_hausdorff_space.rb.html?TB_iframe=true&height=550&width=785"
|
32
|
+
class="thickbox" title="lib/acts_as_hausdorff_space.rb">lib/acts_as_hausdorff_space.rb</a></li>
|
33
|
+
|
34
|
+
</ul>
|
35
|
+
</div>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div id="class-metadata">
|
42
|
+
|
43
|
+
<!-- Parent Class -->
|
44
|
+
|
45
|
+
|
46
|
+
<!-- Namespace Contents -->
|
47
|
+
|
48
|
+
|
49
|
+
<!-- Method Quickref -->
|
50
|
+
|
51
|
+
<div id="method-list-section" class="section">
|
52
|
+
<h3 class="section-header">Methods</h3>
|
53
|
+
<ul class="link-list">
|
54
|
+
|
55
|
+
<li><a href="#M000011">#after_initialize</a></li>
|
56
|
+
|
57
|
+
<li><a href="#M000027">#after_save</a></li>
|
58
|
+
|
59
|
+
<li><a href="#M000026">#before_save</a></li>
|
60
|
+
|
61
|
+
<li><a href="#M000020">#build_full_tree</a></li>
|
62
|
+
|
63
|
+
<li><a href="#M000034">#build_tree_by_recursion</a></li>
|
64
|
+
|
65
|
+
<li><a href="#M000025">#children</a></li>
|
66
|
+
|
67
|
+
<li><a href="#M000032">#furthrest_left</a></li>
|
68
|
+
|
69
|
+
<li><a href="#M000033">#furthrest_right</a></li>
|
70
|
+
|
71
|
+
<li><a href="#M000023">#is_root?</a></li>
|
72
|
+
|
73
|
+
<li><a href="#M000029">#leaf_nodes</a></li>
|
74
|
+
|
75
|
+
<li><a href="#M000012">#left_col_name</a></li>
|
76
|
+
|
77
|
+
<li><a href="#M000014">#left_col_val</a></li>
|
78
|
+
|
79
|
+
<li><a href="#M000015">#left_col_val=</a></li>
|
80
|
+
|
81
|
+
<li><a href="#M000021">#lft_gap</a></li>
|
82
|
+
|
83
|
+
<li><a href="#M000030">#mid_point</a></li>
|
84
|
+
|
85
|
+
<li><a href="#M000024">#my_root</a></li>
|
86
|
+
|
87
|
+
<li><a href="#M000031">#needs_moving</a></li>
|
88
|
+
|
89
|
+
<li><a href="#M000018">#parent</a></li>
|
90
|
+
|
91
|
+
<li><a href="#M000019">#parent=</a></li>
|
92
|
+
|
93
|
+
<li><a href="#M000022">#rgt_gap</a></li>
|
94
|
+
|
95
|
+
<li><a href="#M000013">#right_col_name</a></li>
|
96
|
+
|
97
|
+
<li><a href="#M000016">#right_col_val</a></li>
|
98
|
+
|
99
|
+
<li><a href="#M000017">#right_col_val=</a></li>
|
100
|
+
|
101
|
+
<li><a href="#M000028">#siblings</a></li>
|
102
|
+
|
103
|
+
</ul>
|
104
|
+
</div>
|
105
|
+
|
106
|
+
|
107
|
+
<!-- Included Modules -->
|
108
|
+
|
109
|
+
</div>
|
110
|
+
|
111
|
+
<div id="project-metadata">
|
112
|
+
|
113
|
+
|
114
|
+
<div id="fileindex-section" class="section project-section">
|
115
|
+
<h3 class="section-header">Files</h3>
|
116
|
+
<ul>
|
117
|
+
|
118
|
+
<li class="file"><a href="../../../LICENSE.html">LICENSE</a></li>
|
119
|
+
|
120
|
+
<li class="file"><a href="../../../README_rdoc.html">README.rdoc</a></li>
|
121
|
+
|
122
|
+
</ul>
|
123
|
+
</div>
|
124
|
+
|
125
|
+
|
126
|
+
<div id="classindex-section" class="section project-section">
|
127
|
+
<h3 class="section-header">Class Index
|
128
|
+
<span class="search-toggle"><img src="../../../images/find.png"
|
129
|
+
height="16" width="16" alt="[+]"
|
130
|
+
title="show/hide quicksearch" /></span></h3>
|
131
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
132
|
+
<fieldset>
|
133
|
+
<legend>Quicksearch</legend>
|
134
|
+
<input type="text" name="quicksearch" value=""
|
135
|
+
class="quicksearch-field" />
|
136
|
+
</fieldset>
|
137
|
+
</form>
|
138
|
+
|
139
|
+
<ul class="link-list">
|
140
|
+
|
141
|
+
<li><a href="../../../MindoroMarine.html">MindoroMarine</a></li>
|
142
|
+
|
143
|
+
<li><a href="../../../MindoroMarine/Acts/HausdorffSpace/ActMethods.html">MindoroMarine::Acts::HausdorffSpace::ActMethods</a></li>
|
144
|
+
|
145
|
+
<li><a href="../../../MindoroMarine/Acts/HausdorffSpace/ClassMethods.html">MindoroMarine::Acts::HausdorffSpace::ClassMethods</a></li>
|
146
|
+
|
147
|
+
<li><a href="../../../MindoroMarine/Acts/HausdorffSpace/Gap.html">MindoroMarine::Acts::HausdorffSpace::Gap</a></li>
|
148
|
+
|
149
|
+
<li><a href="../../../MindoroMarine/Acts/HausdorffSpace/HSArray.html">MindoroMarine::Acts::HausdorffSpace::HSArray</a></li>
|
150
|
+
|
151
|
+
<li><a href="../../../MindoroMarine/Acts/HausdorffSpace/InstanceMethods.html">MindoroMarine::Acts::HausdorffSpace::InstanceMethods</a></li>
|
152
|
+
|
153
|
+
<li><a href="../../../MindoroMarine/Acts/HausdorffSpace/VirtualRoot.html">MindoroMarine::Acts::HausdorffSpace::VirtualRoot</a></li>
|
154
|
+
|
155
|
+
</ul>
|
156
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
157
|
+
</div>
|
158
|
+
|
159
|
+
|
160
|
+
</div>
|
161
|
+
</div>
|
162
|
+
|
163
|
+
<div id="documentation">
|
164
|
+
<h1 class="module">MindoroMarine::Acts::HausdorffSpace::InstanceMethods</h1>
|
165
|
+
|
166
|
+
<div id="description">
|
167
|
+
<p>
|
168
|
+
INSTANCE METHODS ######################################################
|
169
|
+
</p>
|
170
|
+
|
171
|
+
</div>
|
172
|
+
|
173
|
+
<!-- Constants -->
|
174
|
+
|
175
|
+
|
176
|
+
<!-- Attributes -->
|
177
|
+
|
178
|
+
<div id="attribute-method-details" class="method-section section">
|
179
|
+
<h3 class="section-header">Attributes</h3>
|
180
|
+
|
181
|
+
|
182
|
+
<div id="parent-attribute-method" class="method-detail">
|
183
|
+
<a name="parent"></a>
|
184
|
+
|
185
|
+
<a name="parent="></a>
|
186
|
+
|
187
|
+
<div class="method-heading attribute-method-heading">
|
188
|
+
<span class="method-name">parent</span><span
|
189
|
+
class="attribute-access-type">[RW]</span>
|
190
|
+
</div>
|
191
|
+
|
192
|
+
<div class="method-description">
|
193
|
+
|
194
|
+
<p class="missing-docs">(Not documented)</p>
|
195
|
+
|
196
|
+
</div>
|
197
|
+
</div>
|
198
|
+
|
199
|
+
<div id="in-tree-attribute-method" class="method-detail">
|
200
|
+
<a name="in_tree"></a>
|
201
|
+
|
202
|
+
<a name="in_tree="></a>
|
203
|
+
|
204
|
+
<div class="method-heading attribute-method-heading">
|
205
|
+
<span class="method-name">in_tree</span><span
|
206
|
+
class="attribute-access-type">[RW]</span>
|
207
|
+
</div>
|
208
|
+
|
209
|
+
<div class="method-description">
|
210
|
+
|
211
|
+
<p class="missing-docs">(Not documented)</p>
|
212
|
+
|
213
|
+
</div>
|
214
|
+
</div>
|
215
|
+
|
216
|
+
</div>
|
217
|
+
|
218
|
+
|
219
|
+
<!-- Methods -->
|
220
|
+
|
221
|
+
<div id="public-instance-method-details" class="method-section section">
|
222
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
223
|
+
|
224
|
+
|
225
|
+
<div id="after-initialize-method" class="method-detail ">
|
226
|
+
<a name="M000011"></a>
|
227
|
+
|
228
|
+
<div class="method-heading">
|
229
|
+
|
230
|
+
<span class="method-name">after_initialize</span><span
|
231
|
+
class="method-args">(# initialize isn't always called)</span>
|
232
|
+
<span class="method-click-advice">click to toggle source</span>
|
233
|
+
|
234
|
+
</div>
|
235
|
+
|
236
|
+
<div class="method-description">
|
237
|
+
|
238
|
+
<p class="missing-docs">(Not documented)</p>
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
<div class="method-source-code"
|
243
|
+
id="after-initialize-source">
|
244
|
+
<pre>
|
245
|
+
<span class="ruby-comment cmt"># File lib/acts_as_hausdorff_space.rb, line 141</span>
|
246
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">after_initialize</span> <span class="ruby-comment cmt"># initialize isn't always called</span>
|
247
|
+
<span class="ruby-ivar">@parent</span> = <span class="ruby-keyword kw">nil</span>
|
248
|
+
<span class="ruby-ivar">@children</span> = <span class="ruby-constant">HSArray</span>.<span class="ruby-identifier">new</span>
|
249
|
+
<span class="ruby-ivar">@children</span>.<span class="ruby-identifier">parent</span> = <span class="ruby-keyword kw">self</span>
|
250
|
+
<span class="ruby-ivar">@root</span> = <span class="ruby-keyword kw">nil</span>
|
251
|
+
<span class="ruby-ivar">@is_root</span>=<span class="ruby-keyword kw">false</span>
|
252
|
+
<span class="ruby-ivar">@in_tree</span> = <span class="ruby-keyword kw">false</span>
|
253
|
+
<span class="ruby-ivar">@prev_left</span> = <span class="ruby-keyword kw">nil</span>
|
254
|
+
<span class="ruby-ivar">@prev_right</span> = <span class="ruby-keyword kw">nil</span>
|
255
|
+
<span class="ruby-keyword kw">end</span></pre>
|
256
|
+
</div>
|
257
|
+
|
258
|
+
</div>
|
259
|
+
|
260
|
+
|
261
|
+
</div>
|
262
|
+
|
263
|
+
|
264
|
+
<div id="after-save-method" class="method-detail ">
|
265
|
+
<a name="M000027"></a>
|
266
|
+
|
267
|
+
<div class="method-heading">
|
268
|
+
|
269
|
+
<span class="method-name">after_save</span><span
|
270
|
+
class="method-args">()</span>
|
271
|
+
<span class="method-click-advice">click to toggle source</span>
|
272
|
+
|
273
|
+
</div>
|
274
|
+
|
275
|
+
<div class="method-description">
|
276
|
+
|
277
|
+
<p class="missing-docs">(Not documented)</p>
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
<div class="method-source-code"
|
282
|
+
id="after-save-source">
|
283
|
+
<pre>
|
284
|
+
<span class="ruby-comment cmt"># File lib/acts_as_hausdorff_space.rb, line 295</span>
|
285
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">after_save</span>
|
286
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@prev_left</span> <span class="ruby-operator">&&</span> <span class="ruby-ivar">@prev_right</span> <span class="ruby-operator">&&</span> <span class="ruby-ivar">@children</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span> <span class="ruby-comment cmt"># if we're moving from somewhere else</span>
|
287
|
+
<span class="ruby-ivar">@children</span>.<span class="ruby-identifier">clear</span>
|
288
|
+
<span class="ruby-identifier">scale</span> = ((<span class="ruby-identifier">right_col_val</span><span class="ruby-operator">-</span><span class="ruby-identifier">left_col_val</span>)<span class="ruby-operator">/</span>(<span class="ruby-ivar">@prev_right</span> <span class="ruby-operator">-</span> <span class="ruby-ivar">@prev_left</span>)).<span class="ruby-identifier">abs</span>
|
289
|
+
<span class="ruby-identifier">old_mid_point</span> = (<span class="ruby-ivar">@prev_right</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@prev_left</span>)<span class="ruby-operator">/</span><span class="ruby-value">2</span>
|
290
|
+
<span class="ruby-identifier">new_mid_point</span> = (<span class="ruby-identifier">right_col_val</span><span class="ruby-operator">+</span><span class="ruby-identifier">left_col_val</span>)<span class="ruby-operator">/</span><span class="ruby-value">2</span>
|
291
|
+
<span class="ruby-identifier">sql</span> = <span class="ruby-node">"update #{self.class.table_name} t1 set t1.#{left_col_name} = ((t1.#{left_col_name} - #{old_mid_point})*#{scale})+#{new_mid_point}, t1.#{right_col_name} = ((t1.#{right_col_name} - #{old_mid_point})*#{scale})+#{new_mid_point} where t1.#{left_col_name} >#{@prev_left} and t1.#{right_col_name} < #{@prev_right} "</span>
|
292
|
+
<span class="ruby-identifier">connection</span>.<span class="ruby-identifier">update_sql</span>(<span class="ruby-identifier">sql</span>)
|
293
|
+
<span class="ruby-identifier">build_full_tree</span> <span class="ruby-comment cmt"># get the children back</span>
|
294
|
+
<span class="ruby-keyword kw">else</span>
|
295
|
+
<span class="ruby-ivar">@children</span>.<span class="ruby-identifier">each</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">child</span><span class="ruby-operator">|</span> <span class="ruby-identifier">child</span>.<span class="ruby-identifier">save</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span>(<span class="ruby-identifier">child</span>.<span class="ruby-identifier">left_col_val</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">child</span>.<span class="ruby-identifier">right_col_val</span>) } <span class="ruby-comment cmt"># save only the ones that need lft and rgt</span>
|
296
|
+
<span class="ruby-keyword kw">end</span>
|
297
|
+
<span class="ruby-ivar">@prev_left</span> = <span class="ruby-ivar">@prev_right</span> = <span class="ruby-keyword kw">nil</span>
|
298
|
+
<span class="ruby-keyword kw">end</span></pre>
|
299
|
+
</div>
|
300
|
+
|
301
|
+
</div>
|
302
|
+
|
303
|
+
|
304
|
+
</div>
|
305
|
+
|
306
|
+
|
307
|
+
<div id="before-save-method" class="method-detail ">
|
308
|
+
<a name="M000026"></a>
|
309
|
+
|
310
|
+
<div class="method-heading">
|
311
|
+
|
312
|
+
<span class="method-name">before_save</span><span
|
313
|
+
class="method-args">()</span>
|
314
|
+
<span class="method-click-advice">click to toggle source</span>
|
315
|
+
|
316
|
+
</div>
|
317
|
+
|
318
|
+
<div class="method-description">
|
319
|
+
|
320
|
+
<p class="missing-docs">(Not documented)</p>
|
321
|
+
|
322
|
+
|
323
|
+
|
324
|
+
<div class="method-source-code"
|
325
|
+
id="before-save-source">
|
326
|
+
<pre>
|
327
|
+
<span class="ruby-comment cmt"># File lib/acts_as_hausdorff_space.rb, line 278</span>
|
328
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">before_save</span>
|
329
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@parent</span>
|
330
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">roots</span> <span class="ruby-comment cmt"># this loads virtual_root with roots</span>
|
331
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">virtual_root</span>.<span class="ruby-identifier">children</span> <span class="ruby-operator"><<</span> <span class="ruby-keyword kw">self</span> <span class="ruby-comment cmt"># if we haven't got a parent then make the virtual root the parent</span>
|
332
|
+
<span class="ruby-keyword kw">end</span>
|
333
|
+
<span class="ruby-identifier">far_left</span> = <span class="ruby-identifier">furthrest_left</span>
|
334
|
+
<span class="ruby-identifier">far_right</span> = <span class="ruby-identifier">furthrest_right</span>
|
335
|
+
<span class="ruby-comment cmt">#puts "furthrest_right = #{far_right} furthrest_left = #{far_left}"</span>
|
336
|
+
<span class="ruby-identifier">gap</span> = <span class="ruby-identifier">far_right</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">far_left</span>
|
337
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@children</span>.<span class="ruby-identifier">size</span><span class="ruby-operator">></span><span class="ruby-value">0</span>
|
338
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">left_col_val</span> = <span class="ruby-identifier">far_left</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">gap</span><span class="ruby-operator">/</span><span class="ruby-value">4</span>
|
339
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">right_col_val</span> = <span class="ruby-identifier">far_right</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">gap</span><span class="ruby-operator">/</span><span class="ruby-value">4</span>
|
340
|
+
<span class="ruby-keyword kw">else</span>
|
341
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">left_col_val</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">right_col_val</span> = <span class="ruby-identifier">far_left</span><span class="ruby-operator">+</span>(<span class="ruby-identifier">gap</span><span class="ruby-operator">/</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">bias</span>)
|
342
|
+
<span class="ruby-keyword kw">end</span>
|
343
|
+
<span class="ruby-keyword kw">end</span></pre>
|
344
|
+
</div>
|
345
|
+
|
346
|
+
</div>
|
347
|
+
|
348
|
+
|
349
|
+
</div>
|
350
|
+
|
351
|
+
|
352
|
+
<div id="build-full-tree-method" class="method-detail ">
|
353
|
+
<a name="M000020"></a>
|
354
|
+
|
355
|
+
<div class="method-heading">
|
356
|
+
|
357
|
+
<span class="method-name">build_full_tree</span><span
|
358
|
+
class="method-args">()</span>
|
359
|
+
<span class="method-click-advice">click to toggle source</span>
|
360
|
+
|
361
|
+
</div>
|
362
|
+
|
363
|
+
<div class="method-description">
|
364
|
+
|
365
|
+
<p class="missing-docs">(Not documented)</p>
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
<div class="method-source-code"
|
370
|
+
id="build-full-tree-source">
|
371
|
+
<pre>
|
372
|
+
<span class="ruby-comment cmt"># File lib/acts_as_hausdorff_space.rb, line 211</span>
|
373
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">build_full_tree</span>
|
374
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">in_tree</span> = <span class="ruby-keyword kw">true</span>
|
375
|
+
<span class="ruby-keyword kw">begin</span>
|
376
|
+
<span class="ruby-comment cmt"># get all the children with levels counted and ordered in one SQL statement - this is what nested sets are all about </span>
|
377
|
+
<span class="ruby-comment cmt"># then do a depth first traversal of all the entire list to build the tree in memory</span>
|
378
|
+
<span class="ruby-identifier">child_list</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">find_by_sql</span>(<span class="ruby-node">"SELECT t1.*,(select count(*) from #{self.class.table_name} t2 where t2.#{left_col_name}<t1.#{left_col_name} and t2.#{right_col_name} > t1.#{right_col_name}) as depth from #{self.class.table_name} t1 where t1.#{left_col_name} >#{left_col_val} and t1.#{right_col_name} <#{right_col_val} order by #{left_col_name} desc"</span>)
|
379
|
+
<span class="ruby-identifier">child_list</span>.<span class="ruby-identifier">each</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span> <span class="ruby-identifier">r</span>.<span class="ruby-identifier">in_tree</span> = <span class="ruby-keyword kw">true</span>}
|
380
|
+
<span class="ruby-comment cmt">#for some strange reason depth comes back as a string in Postgresql hence the .to_i</span>
|
381
|
+
<span class="ruby-identifier">build_tree_by_recursion</span>(<span class="ruby-keyword kw">self</span>,<span class="ruby-identifier">child_list</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">depth</span>.<span class="ruby-identifier">to_i</span>,<span class="ruby-identifier">child_list</span>)
|
382
|
+
<span class="ruby-keyword kw">rescue</span>
|
383
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">in_tree</span> = <span class="ruby-keyword kw">false</span>
|
384
|
+
<span class="ruby-identifier">raise</span>
|
385
|
+
<span class="ruby-keyword kw">end</span>
|
386
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>
|
387
|
+
<span class="ruby-keyword kw">end</span></pre>
|
388
|
+
</div>
|
389
|
+
|
390
|
+
</div>
|
391
|
+
|
392
|
+
|
393
|
+
</div>
|
394
|
+
|
395
|
+
|
396
|
+
<div id="children-method" class="method-detail ">
|
397
|
+
<a name="M000025"></a>
|
398
|
+
|
399
|
+
<div class="method-heading">
|
400
|
+
|
401
|
+
<span class="method-name">children</span><span
|
402
|
+
class="method-args">()</span>
|
403
|
+
<span class="method-click-advice">click to toggle source</span>
|
404
|
+
|
405
|
+
</div>
|
406
|
+
|
407
|
+
<div class="method-description">
|
408
|
+
|
409
|
+
<p class="missing-docs">(Not documented)</p>
|
410
|
+
|
411
|
+
|
412
|
+
|
413
|
+
<div class="method-source-code"
|
414
|
+
id="children-source">
|
415
|
+
<pre>
|
416
|
+
<span class="ruby-comment cmt"># File lib/acts_as_hausdorff_space.rb, line 269</span>
|
417
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">children</span>
|
418
|
+
<span class="ruby-keyword kw">unless</span> ( <span class="ruby-ivar">@children</span>.<span class="ruby-identifier">size</span><span class="ruby-operator">></span><span class="ruby-value">0</span> <span class="ruby-operator">||</span> ( <span class="ruby-identifier">left_col_val</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">right_col_val</span> ) <span class="ruby-operator">||</span> <span class="ruby-identifier">in_tree</span>) <span class="ruby-comment cmt"># don't get children unless lft is not equal to rgt </span>
|
419
|
+
<span class="ruby-comment cmt"># puts "load_tree = #{in_tree}" </span>
|
420
|
+
<span class="ruby-ivar">@children</span> <span class="ruby-operator"><<</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">find</span>( <span class="ruby-identifier">:all</span>,<span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">></span> <span class="ruby-node">" #{self.class.table_name}.#{left_col_name} >#{left_col_val} and #{self.class.table_name}.#{right_col_name} < #{right_col_val} and #{left_col_val} = (select max(t1.#{left_col_name}) from #{self.class.table_name} t1 where #{self.class.table_name}.#{left_col_name} between t1.#{left_col_name} and t1.#{right_col_name})"</span> )
|
421
|
+
<span class="ruby-keyword kw">else</span>
|
422
|
+
<span class="ruby-ivar">@children</span>
|
423
|
+
<span class="ruby-keyword kw">end</span>
|
424
|
+
<span class="ruby-keyword kw">end</span></pre>
|
425
|
+
</div>
|
426
|
+
|
427
|
+
</div>
|
428
|
+
|
429
|
+
|
430
|
+
</div>
|
431
|
+
|
432
|
+
|
433
|
+
<div id="is-root--method" class="method-detail ">
|
434
|
+
<a name="M000023"></a>
|
435
|
+
|
436
|
+
<div class="method-heading">
|
437
|
+
|
438
|
+
<span class="method-name">is_root?</span><span
|
439
|
+
class="method-args">()</span>
|
440
|
+
<span class="method-click-advice">click to toggle source</span>
|
441
|
+
|
442
|
+
</div>
|
443
|
+
|
444
|
+
<div class="method-description">
|
445
|
+
|
446
|
+
<p class="missing-docs">(Not documented)</p>
|
447
|
+
|
448
|
+
|
449
|
+
|
450
|
+
<div class="method-source-code"
|
451
|
+
id="is-root--source">
|
452
|
+
<pre>
|
453
|
+
<span class="ruby-comment cmt"># File lib/acts_as_hausdorff_space.rb, line 257</span>
|
454
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">is_root?</span>
|
455
|
+
<span class="ruby-ivar">@is_root</span>
|
456
|
+
<span class="ruby-keyword kw">end</span></pre>
|
457
|
+
</div>
|
458
|
+
|
459
|
+
</div>
|
460
|
+
|
461
|
+
|
462
|
+
</div>
|
463
|
+
|
464
|
+
|
465
|
+
<div id="leaf-nodes-method" class="method-detail ">
|
466
|
+
<a name="M000029"></a>
|
467
|
+
|
468
|
+
<div class="method-heading">
|
469
|
+
|
470
|
+
<span class="method-name">leaf_nodes</span><span
|
471
|
+
class="method-args">()</span>
|
472
|
+
<span class="method-click-advice">click to toggle source</span>
|
473
|
+
|
474
|
+
</div>
|
475
|
+
|
476
|
+
<div class="method-description">
|
477
|
+
|
478
|
+
<p class="missing-docs">(Not documented)</p>
|
479
|
+
|
480
|
+
|
481
|
+
|
482
|
+
<div class="method-source-code"
|
483
|
+
id="leaf-nodes-source">
|
484
|
+
<pre>
|
485
|
+
<span class="ruby-comment cmt"># File lib/acts_as_hausdorff_space.rb, line 316</span>
|
486
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">leaf_nodes</span>
|
487
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">find</span> <span class="ruby-identifier">:all</span>,<span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">></span> <span class="ruby-node">" #{left_col_name} >#{left_col_val} and #{right_col_name} < #{right_col_val} and #{left_col_name} = #{right_col_name}"</span>
|
488
|
+
<span class="ruby-keyword kw">end</span></pre>
|
489
|
+
</div>
|
490
|
+
|
491
|
+
</div>
|
492
|
+
|
493
|
+
|
494
|
+
</div>
|
495
|
+
|
496
|
+
|
497
|
+
<div id="left-col-name-method" class="method-detail ">
|
498
|
+
<a name="M000012"></a>
|
499
|
+
|
500
|
+
<div class="method-heading">
|
501
|
+
|
502
|
+
<span class="method-name">left_col_name</span><span
|
503
|
+
class="method-args">()</span>
|
504
|
+
<span class="method-click-advice">click to toggle source</span>
|
505
|
+
|
506
|
+
</div>
|
507
|
+
|
508
|
+
<div class="method-description">
|
509
|
+
|
510
|
+
<p>
|
511
|
+
Short hand method to save typing self.class.left_col_name
|
512
|
+
</p>
|
513
|
+
|
514
|
+
|
515
|
+
|
516
|
+
<div class="method-source-code"
|
517
|
+
id="left-col-name-source">
|
518
|
+
<pre>
|
519
|
+
<span class="ruby-comment cmt"># File lib/acts_as_hausdorff_space.rb, line 153</span>
|
520
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">left_col_name</span>
|
521
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">left_col_name</span>
|
522
|
+
<span class="ruby-keyword kw">end</span></pre>
|
523
|
+
</div>
|
524
|
+
|
525
|
+
</div>
|
526
|
+
|
527
|
+
|
528
|
+
</div>
|
529
|
+
|
530
|
+
|
531
|
+
<div id="left-col-val-method" class="method-detail ">
|
532
|
+
<a name="M000014"></a>
|
533
|
+
|
534
|
+
<div class="method-heading">
|
535
|
+
|
536
|
+
<span class="method-name">left_col_val</span><span
|
537
|
+
class="method-args">()</span>
|
538
|
+
<span class="method-click-advice">click to toggle source</span>
|
539
|
+
|
540
|
+
</div>
|
541
|
+
|
542
|
+
<div class="method-description">
|
543
|
+
|
544
|
+
<p>
|
545
|
+
get the left col value
|
546
|
+
</p>
|
547
|
+
|
548
|
+
|
549
|
+
|
550
|
+
<div class="method-source-code"
|
551
|
+
id="left-col-val-source">
|
552
|
+
<pre>
|
553
|
+
<span class="ruby-comment cmt"># File lib/acts_as_hausdorff_space.rb, line 163</span>
|
554
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">left_col_val</span>
|
555
|
+
<span class="ruby-identifier">read_attribute</span>(<span class="ruby-identifier">left_col_name</span>)
|
556
|
+
<span class="ruby-keyword kw">end</span></pre>
|
557
|
+
</div>
|
558
|
+
|
559
|
+
</div>
|
560
|
+
|
561
|
+
|
562
|
+
</div>
|
563
|
+
|
564
|
+
|
565
|
+
<div id="left-col-val--method" class="method-detail ">
|
566
|
+
<a name="M000015"></a>
|
567
|
+
|
568
|
+
<div class="method-heading">
|
569
|
+
|
570
|
+
<span class="method-name">left_col_val=</span><span
|
571
|
+
class="method-args">(value)</span>
|
572
|
+
<span class="method-click-advice">click to toggle source</span>
|
573
|
+
|
574
|
+
</div>
|
575
|
+
|
576
|
+
<div class="method-description">
|
577
|
+
|
578
|
+
<p>
|
579
|
+
set the left col value
|
580
|
+
</p>
|
581
|
+
|
582
|
+
|
583
|
+
|
584
|
+
<div class="method-source-code"
|
585
|
+
id="left-col-val--source">
|
586
|
+
<pre>
|
587
|
+
<span class="ruby-comment cmt"># File lib/acts_as_hausdorff_space.rb, line 168</span>
|
588
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">left_col_val=</span>(<span class="ruby-identifier">value</span>)
|
589
|
+
<span class="ruby-identifier">write_attribute</span>(<span class="ruby-identifier">left_col_name</span>,<span class="ruby-identifier">value</span>)
|
590
|
+
<span class="ruby-keyword kw">end</span></pre>
|
591
|
+
</div>
|
592
|
+
|
593
|
+
</div>
|
594
|
+
|
595
|
+
|
596
|
+
</div>
|
597
|
+
|
598
|
+
|
599
|
+
<div id="lft-gap-method" class="method-detail ">
|
600
|
+
<a name="M000021"></a>
|
601
|
+
|
602
|
+
<div class="method-heading">
|
603
|
+
|
604
|
+
<span class="method-name">lft_gap</span><span
|
605
|
+
class="method-args">()</span>
|
606
|
+
<span class="method-click-advice">click to toggle source</span>
|
607
|
+
|
608
|
+
</div>
|
609
|
+
|
610
|
+
<div class="method-description">
|
611
|
+
|
612
|
+
<p class="missing-docs">(Not documented)</p>
|
613
|
+
|
614
|
+
|
615
|
+
|
616
|
+
<div class="method-source-code"
|
617
|
+
id="lft-gap-source">
|
618
|
+
<pre>
|
619
|
+
<span class="ruby-comment cmt"># File lib/acts_as_hausdorff_space.rb, line 227</span>
|
620
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">lft_gap</span>
|
621
|
+
<span class="ruby-comment cmt"># puts " in lft gap #{parent.class.name}"</span>
|
622
|
+
<span class="ruby-identifier">gap</span> = <span class="ruby-constant">Gap</span>.<span class="ruby-identifier">new</span>
|
623
|
+
<span class="ruby-identifier">gap</span>.<span class="ruby-identifier">right_col_val</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">left_col_val</span>
|
624
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">parent</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">self</span>
|
625
|
+
<span class="ruby-identifier">gap</span>.<span class="ruby-identifier">left_col_val</span> = <span class="ruby-identifier">parent</span>.<span class="ruby-identifier">left_col_val</span>
|
626
|
+
<span class="ruby-keyword kw">else</span>
|
627
|
+
<span class="ruby-comment cmt"># puts "get prev index"</span>
|
628
|
+
<span class="ruby-identifier">prev_index</span> = <span class="ruby-identifier">parent</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">index</span>(<span class="ruby-keyword kw">self</span>)<span class="ruby-operator">-</span><span class="ruby-value">1</span>
|
629
|
+
<span class="ruby-comment cmt"># puts "prev index = #{prev_index} count = #{parent.children.size}"</span>
|
630
|
+
<span class="ruby-identifier">gap</span>.<span class="ruby-identifier">left_col_val</span> = <span class="ruby-identifier">parent</span>.<span class="ruby-identifier">children</span>[<span class="ruby-identifier">prev_index</span>].<span class="ruby-identifier">right_col_val</span>
|
631
|
+
<span class="ruby-keyword kw">end</span>
|
632
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">gap</span>
|
633
|
+
<span class="ruby-keyword kw">end</span></pre>
|
634
|
+
</div>
|
635
|
+
|
636
|
+
</div>
|
637
|
+
|
638
|
+
|
639
|
+
</div>
|
640
|
+
|
641
|
+
|
642
|
+
<div id="mid-point-method" class="method-detail ">
|
643
|
+
<a name="M000030"></a>
|
644
|
+
|
645
|
+
<div class="method-heading">
|
646
|
+
|
647
|
+
<span class="method-name">mid_point</span><span
|
648
|
+
class="method-args">()</span>
|
649
|
+
<span class="method-click-advice">click to toggle source</span>
|
650
|
+
|
651
|
+
</div>
|
652
|
+
|
653
|
+
<div class="method-description">
|
654
|
+
|
655
|
+
<p class="missing-docs">(Not documented)</p>
|
656
|
+
|
657
|
+
|
658
|
+
|
659
|
+
<div class="method-source-code"
|
660
|
+
id="mid-point-source">
|
661
|
+
<pre>
|
662
|
+
<span class="ruby-comment cmt"># File lib/acts_as_hausdorff_space.rb, line 320</span>
|
663
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mid_point</span>
|
664
|
+
(<span class="ruby-identifier">furthrest_left</span><span class="ruby-operator">+</span><span class="ruby-identifier">furthrest_right</span>)<span class="ruby-operator">/</span><span class="ruby-value">2</span>
|
665
|
+
<span class="ruby-keyword kw">end</span></pre>
|
666
|
+
</div>
|
667
|
+
|
668
|
+
</div>
|
669
|
+
|
670
|
+
|
671
|
+
</div>
|
672
|
+
|
673
|
+
|
674
|
+
<div id="my-root-method" class="method-detail ">
|
675
|
+
<a name="M000024"></a>
|
676
|
+
|
677
|
+
<div class="method-heading">
|
678
|
+
|
679
|
+
<span class="method-name">my_root</span><span
|
680
|
+
class="method-args">()</span>
|
681
|
+
<span class="method-click-advice">click to toggle source</span>
|
682
|
+
|
683
|
+
</div>
|
684
|
+
|
685
|
+
<div class="method-description">
|
686
|
+
|
687
|
+
<p class="missing-docs">(Not documented)</p>
|
688
|
+
|
689
|
+
|
690
|
+
|
691
|
+
<div class="method-source-code"
|
692
|
+
id="my-root-source">
|
693
|
+
<pre>
|
694
|
+
<span class="ruby-comment cmt"># File lib/acts_as_hausdorff_space.rb, line 261</span>
|
695
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">my_root</span>
|
696
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@root</span>
|
697
|
+
<span class="ruby-ivar">@root</span> = (<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">find</span> <span class="ruby-identifier">:first</span>, <span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">></span> <span class="ruby-node">" #{left_col_val} >= #{left_col_name} and #{right_col_val}<= #{right_col_name} "</span>,<span class="ruby-identifier">:order</span> =<span class="ruby-operator">></span><span class="ruby-node">"#{left_col_name}"</span>) <span class="ruby-comment cmt">#between includes the end points</span>
|
698
|
+
<span class="ruby-keyword kw">else</span>
|
699
|
+
<span class="ruby-ivar">@root</span>
|
700
|
+
<span class="ruby-keyword kw">end</span>
|
701
|
+
<span class="ruby-keyword kw">end</span></pre>
|
702
|
+
</div>
|
703
|
+
|
704
|
+
</div>
|
705
|
+
|
706
|
+
|
707
|
+
</div>
|
708
|
+
|
709
|
+
|
710
|
+
<div id="needs-moving-method" class="method-detail ">
|
711
|
+
<a name="M000031"></a>
|
712
|
+
|
713
|
+
<div class="method-heading">
|
714
|
+
|
715
|
+
<span class="method-name">needs_moving</span><span
|
716
|
+
class="method-args">()</span>
|
717
|
+
<span class="method-click-advice">click to toggle source</span>
|
718
|
+
|
719
|
+
</div>
|
720
|
+
|
721
|
+
<div class="method-description">
|
722
|
+
|
723
|
+
<p class="missing-docs">(Not documented)</p>
|
724
|
+
|
725
|
+
|
726
|
+
|
727
|
+
<div class="method-source-code"
|
728
|
+
id="needs-moving-source">
|
729
|
+
<pre>
|
730
|
+
<span class="ruby-comment cmt"># File lib/acts_as_hausdorff_space.rb, line 324</span>
|
731
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">needs_moving</span>
|
732
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">left_col_val</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">right_col_val</span> <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-identifier">in_tree</span>
|
733
|
+
<span class="ruby-ivar">@prev_left</span> = <span class="ruby-identifier">left_col_val</span>
|
734
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">left_col_val</span> = <span class="ruby-keyword kw">nil</span>
|
735
|
+
<span class="ruby-ivar">@prev_right</span> = <span class="ruby-identifier">right_col_val</span>
|
736
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">right_col_val</span> = <span class="ruby-keyword kw">nil</span>
|
737
|
+
<span class="ruby-keyword kw">end</span>
|
738
|
+
<span class="ruby-keyword kw">end</span></pre>
|
739
|
+
</div>
|
740
|
+
|
741
|
+
</div>
|
742
|
+
|
743
|
+
|
744
|
+
</div>
|
745
|
+
|
746
|
+
|
747
|
+
<div id="parent-method" class="method-detail ">
|
748
|
+
<a name="M000018"></a>
|
749
|
+
|
750
|
+
<div class="method-heading">
|
751
|
+
|
752
|
+
<span class="method-name">parent</span><span
|
753
|
+
class="method-args">()</span>
|
754
|
+
<span class="method-click-advice">click to toggle source</span>
|
755
|
+
|
756
|
+
</div>
|
757
|
+
|
758
|
+
<div class="method-description">
|
759
|
+
|
760
|
+
<p>
|
761
|
+
Get the parent. If the parent hasn’t already been set, and if
|
762
|
+
we’re not building the full tree (which sets parents) and if
|
763
|
+
we’ve got a valid lft and right then construct the SQL to get the
|
764
|
+
parent from the DB. If none is found then it’s a root so set the
|
765
|
+
parent to be the class.virtual_root If the parent is already set then
|
766
|
+
don’t go to the database to look for it, just return it
|
767
|
+
</p>
|
768
|
+
|
769
|
+
|
770
|
+
|
771
|
+
<div class="method-source-code"
|
772
|
+
id="parent-source">
|
773
|
+
<pre>
|
774
|
+
<span class="ruby-comment cmt"># File lib/acts_as_hausdorff_space.rb, line 187</span>
|
775
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parent</span>
|
776
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">in_tree</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">left_col_val</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">right_col_val</span> <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@parent</span> <span class="ruby-comment cmt"># only get the parent by SQL if we don't know what it is</span>
|
777
|
+
<span class="ruby-ivar">@parent</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">find</span> <span class="ruby-identifier">:first</span>, <span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">></span> <span class="ruby-node">" #{left_col_val} > #{self.class.left_col_name} and #{left_col_val} < #{self.class.right_col_name} "</span>,<span class="ruby-identifier">:order</span> =<span class="ruby-operator">></span><span class="ruby-value str">'#{self.class.left_col_name} DESC'</span>
|
778
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@parent</span>
|
779
|
+
<span class="ruby-comment cmt"># @is_root = (lft == rgt) || (id == root.id)</span>
|
780
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">virtual_root</span>
|
781
|
+
<span class="ruby-keyword kw">end</span>
|
782
|
+
<span class="ruby-keyword kw">else</span>
|
783
|
+
<span class="ruby-ivar">@parent</span>
|
784
|
+
<span class="ruby-keyword kw">end</span>
|
785
|
+
<span class="ruby-keyword kw">end</span></pre>
|
786
|
+
</div>
|
787
|
+
|
788
|
+
</div>
|
789
|
+
|
790
|
+
|
791
|
+
</div>
|
792
|
+
|
793
|
+
|
794
|
+
<div id="parent--method" class="method-detail ">
|
795
|
+
<a name="M000019"></a>
|
796
|
+
|
797
|
+
<div class="method-heading">
|
798
|
+
|
799
|
+
<span class="method-name">parent=</span><span
|
800
|
+
class="method-args">(new_parent)</span>
|
801
|
+
<span class="method-click-advice">click to toggle source</span>
|
802
|
+
|
803
|
+
</div>
|
804
|
+
|
805
|
+
<div class="method-description">
|
806
|
+
|
807
|
+
<p class="missing-docs">(Not documented)</p>
|
808
|
+
|
809
|
+
|
810
|
+
|
811
|
+
<div class="method-source-code"
|
812
|
+
id="parent--source">
|
813
|
+
<pre>
|
814
|
+
<span class="ruby-comment cmt"># File lib/acts_as_hausdorff_space.rb, line 200</span>
|
815
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parent=</span>(<span class="ruby-identifier">new_parent</span>)
|
816
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@parent</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">new_parent</span>
|
817
|
+
<span class="ruby-ivar">@parent</span> = <span class="ruby-identifier">new_parent</span>
|
818
|
+
<span class="ruby-identifier">needs_moving</span>
|
819
|
+
<span class="ruby-ivar">@is_root</span> = <span class="ruby-ivar">@parent</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">VirtualRoot</span>)
|
820
|
+
<span class="ruby-keyword kw">end</span>
|
821
|
+
<span class="ruby-comment cmt"># [TODO] clean this up with parent.save_children </span>
|
822
|
+
<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">save</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">in_tree</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@parent</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">VirtualRoot</span>)
|
823
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@parent</span>
|
824
|
+
<span class="ruby-keyword kw">end</span></pre>
|
825
|
+
</div>
|
826
|
+
|
827
|
+
</div>
|
828
|
+
|
829
|
+
|
830
|
+
</div>
|
831
|
+
|
832
|
+
|
833
|
+
<div id="rgt-gap-method" class="method-detail ">
|
834
|
+
<a name="M000022"></a>
|
835
|
+
|
836
|
+
<div class="method-heading">
|
837
|
+
|
838
|
+
<span class="method-name">rgt_gap</span><span
|
839
|
+
class="method-args">()</span>
|
840
|
+
<span class="method-click-advice">click to toggle source</span>
|
841
|
+
|
842
|
+
</div>
|
843
|
+
|
844
|
+
<div class="method-description">
|
845
|
+
|
846
|
+
<p class="missing-docs">(Not documented)</p>
|
847
|
+
|
848
|
+
|
849
|
+
|
850
|
+
<div class="method-source-code"
|
851
|
+
id="rgt-gap-source">
|
852
|
+
<pre>
|
853
|
+
<span class="ruby-comment cmt"># File lib/acts_as_hausdorff_space.rb, line 242</span>
|
854
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rgt_gap</span>
|
855
|
+
<span class="ruby-comment cmt"># puts " in rgt gap #{parent.class.name}"</span>
|
856
|
+
<span class="ruby-identifier">gap</span> = <span class="ruby-constant">Gap</span>.<span class="ruby-identifier">new</span>
|
857
|
+
<span class="ruby-identifier">gap</span>.<span class="ruby-identifier">left_col_val</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">right_col_val</span>
|
858
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">parent</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">last</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">self</span>
|
859
|
+
<span class="ruby-identifier">gap</span>.<span class="ruby-identifier">right_col_val</span> = <span class="ruby-identifier">parent</span>.<span class="ruby-identifier">right_col_val</span>
|
860
|
+
<span class="ruby-keyword kw">else</span>
|
861
|
+
<span class="ruby-comment cmt"># puts "get next index"</span>
|
862
|
+
<span class="ruby-identifier">next_index</span> = <span class="ruby-identifier">parent</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">index</span>(<span class="ruby-keyword kw">self</span>)<span class="ruby-operator">+</span><span class="ruby-value">1</span>
|
863
|
+
<span class="ruby-comment cmt"># puts "next index = #{next_index} count = #{parent.children.size}"</span>
|
864
|
+
<span class="ruby-identifier">gap</span>.<span class="ruby-identifier">right_col_val</span> = <span class="ruby-identifier">parent</span>.<span class="ruby-identifier">children</span>[<span class="ruby-identifier">next_index</span>].<span class="ruby-identifier">left_col_val</span>
|
865
|
+
<span class="ruby-keyword kw">end</span>
|
866
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">gap</span>
|
867
|
+
<span class="ruby-keyword kw">end</span></pre>
|
868
|
+
</div>
|
869
|
+
|
870
|
+
</div>
|
871
|
+
|
872
|
+
|
873
|
+
</div>
|
874
|
+
|
875
|
+
|
876
|
+
<div id="right-col-name-method" class="method-detail ">
|
877
|
+
<a name="M000013"></a>
|
878
|
+
|
879
|
+
<div class="method-heading">
|
880
|
+
|
881
|
+
<span class="method-name">right_col_name</span><span
|
882
|
+
class="method-args">()</span>
|
883
|
+
<span class="method-click-advice">click to toggle source</span>
|
884
|
+
|
885
|
+
</div>
|
886
|
+
|
887
|
+
<div class="method-description">
|
888
|
+
|
889
|
+
<p>
|
890
|
+
Short hand method to save typing self.class.right_col_name
|
891
|
+
</p>
|
892
|
+
|
893
|
+
|
894
|
+
|
895
|
+
<div class="method-source-code"
|
896
|
+
id="right-col-name-source">
|
897
|
+
<pre>
|
898
|
+
<span class="ruby-comment cmt"># File lib/acts_as_hausdorff_space.rb, line 158</span>
|
899
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">right_col_name</span>
|
900
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">right_col_name</span>
|
901
|
+
<span class="ruby-keyword kw">end</span></pre>
|
902
|
+
</div>
|
903
|
+
|
904
|
+
</div>
|
905
|
+
|
906
|
+
|
907
|
+
</div>
|
908
|
+
|
909
|
+
|
910
|
+
<div id="right-col-val-method" class="method-detail ">
|
911
|
+
<a name="M000016"></a>
|
912
|
+
|
913
|
+
<div class="method-heading">
|
914
|
+
|
915
|
+
<span class="method-name">right_col_val</span><span
|
916
|
+
class="method-args">()</span>
|
917
|
+
<span class="method-click-advice">click to toggle source</span>
|
918
|
+
|
919
|
+
</div>
|
920
|
+
|
921
|
+
<div class="method-description">
|
922
|
+
|
923
|
+
<p>
|
924
|
+
get the right col value
|
925
|
+
</p>
|
926
|
+
|
927
|
+
|
928
|
+
|
929
|
+
<div class="method-source-code"
|
930
|
+
id="right-col-val-source">
|
931
|
+
<pre>
|
932
|
+
<span class="ruby-comment cmt"># File lib/acts_as_hausdorff_space.rb, line 173</span>
|
933
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">right_col_val</span>
|
934
|
+
<span class="ruby-identifier">read_attribute</span>(<span class="ruby-identifier">right_col_name</span>)
|
935
|
+
<span class="ruby-keyword kw">end</span></pre>
|
936
|
+
</div>
|
937
|
+
|
938
|
+
</div>
|
939
|
+
|
940
|
+
|
941
|
+
</div>
|
942
|
+
|
943
|
+
|
944
|
+
<div id="right-col-val--method" class="method-detail ">
|
945
|
+
<a name="M000017"></a>
|
946
|
+
|
947
|
+
<div class="method-heading">
|
948
|
+
|
949
|
+
<span class="method-name">right_col_val=</span><span
|
950
|
+
class="method-args">(value)</span>
|
951
|
+
<span class="method-click-advice">click to toggle source</span>
|
952
|
+
|
953
|
+
</div>
|
954
|
+
|
955
|
+
<div class="method-description">
|
956
|
+
|
957
|
+
<p>
|
958
|
+
set the right col value
|
959
|
+
</p>
|
960
|
+
|
961
|
+
|
962
|
+
|
963
|
+
<div class="method-source-code"
|
964
|
+
id="right-col-val--source">
|
965
|
+
<pre>
|
966
|
+
<span class="ruby-comment cmt"># File lib/acts_as_hausdorff_space.rb, line 178</span>
|
967
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">right_col_val=</span>(<span class="ruby-identifier">value</span>)
|
968
|
+
<span class="ruby-identifier">write_attribute</span>(<span class="ruby-identifier">right_col_name</span>,<span class="ruby-identifier">value</span>)
|
969
|
+
<span class="ruby-keyword kw">end</span></pre>
|
970
|
+
</div>
|
971
|
+
|
972
|
+
</div>
|
973
|
+
|
974
|
+
|
975
|
+
</div>
|
976
|
+
|
977
|
+
|
978
|
+
<div id="siblings-method" class="method-detail ">
|
979
|
+
<a name="M000028"></a>
|
980
|
+
|
981
|
+
<div class="method-heading">
|
982
|
+
|
983
|
+
<span class="method-name">siblings</span><span
|
984
|
+
class="method-args">()</span>
|
985
|
+
<span class="method-click-advice">click to toggle source</span>
|
986
|
+
|
987
|
+
</div>
|
988
|
+
|
989
|
+
<div class="method-description">
|
990
|
+
|
991
|
+
<p class="missing-docs">(Not documented)</p>
|
992
|
+
|
993
|
+
|
994
|
+
|
995
|
+
<div class="method-source-code"
|
996
|
+
id="siblings-source">
|
997
|
+
<pre>
|
998
|
+
<span class="ruby-comment cmt"># File lib/acts_as_hausdorff_space.rb, line 310</span>
|
999
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">siblings</span>
|
1000
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">parent</span>
|
1001
|
+
<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">reject</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span> <span class="ruby-identifier">r</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">self</span>}
|
1002
|
+
<span class="ruby-keyword kw">end</span>
|
1003
|
+
<span class="ruby-keyword kw">end</span></pre>
|
1004
|
+
</div>
|
1005
|
+
|
1006
|
+
</div>
|
1007
|
+
|
1008
|
+
|
1009
|
+
</div>
|
1010
|
+
|
1011
|
+
|
1012
|
+
</div>
|
1013
|
+
|
1014
|
+
<div id="private-instance-method-details" class="method-section section">
|
1015
|
+
<h3 class="section-header">Private Instance Methods</h3>
|
1016
|
+
|
1017
|
+
|
1018
|
+
<div id="build-tree-by-recursion-method" class="method-detail ">
|
1019
|
+
<a name="M000034"></a>
|
1020
|
+
|
1021
|
+
<div class="method-heading">
|
1022
|
+
|
1023
|
+
<span class="method-name">build_tree_by_recursion</span><span
|
1024
|
+
class="method-args">(parent,depth,ar_results)</span>
|
1025
|
+
<span class="method-click-advice">click to toggle source</span>
|
1026
|
+
|
1027
|
+
</div>
|
1028
|
+
|
1029
|
+
<div class="method-description">
|
1030
|
+
|
1031
|
+
<p>
|
1032
|
+
this assumes a nicely ordered tree such that the next depth is always one
|
1033
|
+
more tha the existing depth otherwise throw a wobbly the strange .to_i has
|
1034
|
+
to be there because depth can come back from the db as a string
|
1035
|
+
</p>
|
1036
|
+
|
1037
|
+
|
1038
|
+
|
1039
|
+
<div class="method-source-code"
|
1040
|
+
id="build-tree-by-recursion-source">
|
1041
|
+
<pre>
|
1042
|
+
<span class="ruby-comment cmt"># File lib/acts_as_hausdorff_space.rb, line 355</span>
|
1043
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">build_tree_by_recursion</span>(<span class="ruby-identifier">parent</span>,<span class="ruby-identifier">depth</span>,<span class="ruby-identifier">ar_results</span>)
|
1044
|
+
<span class="ruby-keyword kw">while</span> <span class="ruby-identifier">ar_results</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">ar_results</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">depth</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">>=</span> <span class="ruby-identifier">depth</span>
|
1045
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ar_results</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">depth</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">depth</span>
|
1046
|
+
<span class="ruby-identifier">current_record</span> = <span class="ruby-identifier">ar_results</span>.<span class="ruby-identifier">pop</span>
|
1047
|
+
<span class="ruby-comment cmt"># puts "curr record in tree =#{current_record.in_tree} parent in tree = #{parent.in_tree}"</span>
|
1048
|
+
<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">children</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">current_record</span>
|
1049
|
+
<span class="ruby-identifier">current_record</span>.<span class="ruby-identifier">in_tree</span> = <span class="ruby-keyword kw">false</span>
|
1050
|
+
<span class="ruby-comment cmt"># puts "+++"</span>
|
1051
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">ar_results</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">depth</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">==</span> (<span class="ruby-identifier">depth</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>)
|
1052
|
+
<span class="ruby-identifier">current_record</span>.<span class="ruby-identifier">in_tree</span> = <span class="ruby-keyword kw">true</span>
|
1053
|
+
<span class="ruby-identifier">build_tree_by_recursion</span>(<span class="ruby-identifier">current_record</span>,<span class="ruby-identifier">ar_results</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">depth</span>.<span class="ruby-identifier">to_i</span>,<span class="ruby-identifier">ar_results</span>)
|
1054
|
+
<span class="ruby-identifier">current_record</span>.<span class="ruby-identifier">in_tree</span> = <span class="ruby-keyword kw">false</span>
|
1055
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">ar_results</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">depth</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">></span> (<span class="ruby-identifier">depth</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>)
|
1056
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-value str">"badly formed nested set result set"</span>
|
1057
|
+
<span class="ruby-keyword kw">end</span>
|
1058
|
+
<span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt"># while</span>
|
1059
|
+
<span class="ruby-keyword kw">end</span></pre>
|
1060
|
+
</div>
|
1061
|
+
|
1062
|
+
</div>
|
1063
|
+
|
1064
|
+
|
1065
|
+
</div>
|
1066
|
+
|
1067
|
+
|
1068
|
+
<div id="furthrest-left-method" class="method-detail ">
|
1069
|
+
<a name="M000032"></a>
|
1070
|
+
|
1071
|
+
<div class="method-heading">
|
1072
|
+
|
1073
|
+
<span class="method-name">furthrest_left</span><span
|
1074
|
+
class="method-args">()</span>
|
1075
|
+
<span class="method-click-advice">click to toggle source</span>
|
1076
|
+
|
1077
|
+
</div>
|
1078
|
+
|
1079
|
+
<div class="method-description">
|
1080
|
+
|
1081
|
+
<p class="missing-docs">(Not documented)</p>
|
1082
|
+
|
1083
|
+
|
1084
|
+
|
1085
|
+
<div class="method-source-code"
|
1086
|
+
id="furthrest-left-source">
|
1087
|
+
<pre>
|
1088
|
+
<span class="ruby-comment cmt"># File lib/acts_as_hausdorff_space.rb, line 344</span>
|
1089
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">furthrest_left</span>
|
1090
|
+
<span class="ruby-identifier">lft_gap</span>.<span class="ruby-identifier">left_col_val</span>
|
1091
|
+
<span class="ruby-keyword kw">end</span></pre>
|
1092
|
+
</div>
|
1093
|
+
|
1094
|
+
</div>
|
1095
|
+
|
1096
|
+
|
1097
|
+
</div>
|
1098
|
+
|
1099
|
+
|
1100
|
+
<div id="furthrest-right-method" class="method-detail ">
|
1101
|
+
<a name="M000033"></a>
|
1102
|
+
|
1103
|
+
<div class="method-heading">
|
1104
|
+
|
1105
|
+
<span class="method-name">furthrest_right</span><span
|
1106
|
+
class="method-args">()</span>
|
1107
|
+
<span class="method-click-advice">click to toggle source</span>
|
1108
|
+
|
1109
|
+
</div>
|
1110
|
+
|
1111
|
+
<div class="method-description">
|
1112
|
+
|
1113
|
+
<p class="missing-docs">(Not documented)</p>
|
1114
|
+
|
1115
|
+
|
1116
|
+
|
1117
|
+
<div class="method-source-code"
|
1118
|
+
id="furthrest-right-source">
|
1119
|
+
<pre>
|
1120
|
+
<span class="ruby-comment cmt"># File lib/acts_as_hausdorff_space.rb, line 348</span>
|
1121
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">furthrest_right</span>
|
1122
|
+
<span class="ruby-identifier">rgt_gap</span>.<span class="ruby-identifier">right_col_val</span>
|
1123
|
+
<span class="ruby-keyword kw">end</span></pre>
|
1124
|
+
</div>
|
1125
|
+
|
1126
|
+
</div>
|
1127
|
+
|
1128
|
+
|
1129
|
+
</div>
|
1130
|
+
|
1131
|
+
|
1132
|
+
</div>
|
1133
|
+
|
1134
|
+
|
1135
|
+
</div>
|
1136
|
+
|
1137
|
+
|
1138
|
+
<div id="rdoc-debugging-section-dump" class="debugging-section">
|
1139
|
+
|
1140
|
+
<p>Disabled; run with --debug to generate this.</p>
|
1141
|
+
|
1142
|
+
</div>
|
1143
|
+
|
1144
|
+
<div id="validator-badges">
|
1145
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
1146
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
1147
|
+
Rdoc Generator</a> 1.1.6</small>.</p>
|
1148
|
+
</div>
|
1149
|
+
|
1150
|
+
</body>
|
1151
|
+
</html>
|
1152
|
+
|