autoc 1.4 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/CHANGES.md +3 -0
- data/README.md +149 -0
- data/cmake/AutoC.cmake +39 -0
- data/lib/autoc/allocators.rb +51 -0
- data/lib/autoc/association.rb +126 -0
- data/lib/autoc/box.rb +311 -0
- data/lib/autoc/cmake.rb +54 -0
- data/lib/autoc/collection.rb +83 -110
- data/lib/autoc/composite.rb +333 -0
- data/lib/autoc/cstring.rb +263 -0
- data/lib/autoc/function.rb +247 -0
- data/lib/autoc/hash_map.rb +328 -0
- data/lib/autoc/hash_set.rb +339 -0
- data/lib/autoc/hashers.rb +102 -0
- data/lib/autoc/list.rb +444 -0
- data/lib/autoc/module.rb +434 -0
- data/lib/autoc/openmp.rb +15 -0
- data/lib/autoc/primitive.rb +27 -0
- data/lib/autoc/ranges.rb +707 -0
- data/lib/autoc/record.rb +247 -0
- data/lib/autoc/scaffold/docs.rb +117 -0
- data/lib/autoc/scaffold/generic_value.rb +86 -0
- data/lib/autoc/scaffold/project.rb +75 -0
- data/lib/autoc/scaffold/test_cstring.rb +113 -0
- data/lib/autoc/scaffold/test_cstring_hash_set.rb +35 -0
- data/lib/autoc/scaffold/test_int_box.rb +22 -0
- data/lib/autoc/scaffold/test_int_hash_set.rb +448 -0
- data/lib/autoc/scaffold/test_int_list.rb +106 -0
- data/lib/autoc/scaffold/test_int_vector.rb +83 -0
- data/lib/autoc/scaffold/test_v2v_hash_map.rb +83 -0
- data/lib/autoc/scaffold/test_value_hash_set.rb +60 -0
- data/lib/autoc/scaffold/test_value_vector.rb +146 -0
- data/{test/test.rb → lib/autoc/scaffold/tests.rb} +179 -158
- data/lib/autoc/scaffold.rb +12 -0
- data/lib/autoc/sequential.rb +99 -0
- data/lib/autoc/set.rb +331 -0
- data/lib/autoc/std.rb +149 -0
- data/lib/autoc/type.rb +93 -531
- data/lib/autoc/vector.rb +290 -0
- data/lib/autoc.rb +4 -35
- metadata +55 -85
- data/.yardopts +0 -4
- data/CHANGES +0 -23
- data/README +0 -28
- data/doc/AutoC/Code.html +0 -523
- data/doc/AutoC/Collection.html +0 -1214
- data/doc/AutoC/HashMap.html +0 -1441
- data/doc/AutoC/HashSet.html +0 -916
- data/doc/AutoC/Iterators/Bidirectional.html +0 -204
- data/doc/AutoC/Iterators/Unidirectional.html +0 -200
- data/doc/AutoC/Iterators.html +0 -126
- data/doc/AutoC/List.html +0 -1039
- data/doc/AutoC/Maps.html +0 -290
- data/doc/AutoC/Module/File.html +0 -415
- data/doc/AutoC/Module/Header.html +0 -437
- data/doc/AutoC/Module/Source.html +0 -707
- data/doc/AutoC/Module.html +0 -948
- data/doc/AutoC/Priority.html +0 -138
- data/doc/AutoC/Queue.html +0 -1172
- data/doc/AutoC/Reference.html +0 -735
- data/doc/AutoC/Sets.html +0 -520
- data/doc/AutoC/String.html +0 -1394
- data/doc/AutoC/TreeMap.html +0 -1565
- data/doc/AutoC/TreeSet.html +0 -1447
- data/doc/AutoC/Type.html +0 -2148
- data/doc/AutoC/UserDefinedType.html +0 -1047
- data/doc/AutoC/Vector.html +0 -987
- data/doc/AutoC.html +0 -331
- data/doc/_index.html +0 -388
- data/doc/class_list.html +0 -51
- data/doc/css/common.css +0 -1
- data/doc/css/full_list.css +0 -58
- data/doc/css/style.css +0 -481
- data/doc/file.CHANGES.html +0 -117
- data/doc/file.README.html +0 -116
- data/doc/file_list.html +0 -61
- data/doc/frames.html +0 -17
- data/doc/index.html +0 -116
- data/doc/js/app.js +0 -243
- data/doc/js/full_list.js +0 -216
- data/doc/js/jquery.js +0 -4
- data/doc/method_list.html +0 -1307
- data/doc/top-level-namespace.html +0 -112
- data/lib/autoc/code.rb +0 -237
- data/lib/autoc/collection/hash_map.rb +0 -385
- data/lib/autoc/collection/hash_set.rb +0 -337
- data/lib/autoc/collection/iterator.rb +0 -39
- data/lib/autoc/collection/list.rb +0 -429
- data/lib/autoc/collection/map.rb +0 -41
- data/lib/autoc/collection/queue.rb +0 -517
- data/lib/autoc/collection/set.rb +0 -134
- data/lib/autoc/collection/tree_map.rb +0 -464
- data/lib/autoc/collection/tree_set.rb +0 -611
- data/lib/autoc/collection/vector.rb +0 -336
- data/lib/autoc/string.rb +0 -492
- data/test/test_auto.c +0 -7141
- data/test/test_auto.h +0 -753
- data/test/test_char_string.rb +0 -270
- data/test/test_int_list.rb +0 -35
- data/test/test_int_tree_set.rb +0 -111
- data/test/test_int_vector.rb +0 -34
- data/test/test_value_hash_map.rb +0 -162
- data/test/test_value_hash_set.rb +0 -173
- data/test/test_value_list.rb +0 -193
- data/test/test_value_queue.rb +0 -275
- data/test/test_value_tree_map.rb +0 -176
- data/test/test_value_tree_set.rb +0 -173
- data/test/test_value_vector.rb +0 -155
- data/test/value.rb +0 -80
data/doc/AutoC/TreeSet.html
DELETED
@@ -1,1447 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<meta charset="utf-8">
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
-
<title>
|
7
|
-
Class: AutoC::TreeSet
|
8
|
-
|
9
|
-
— Documentation by YARD 0.9.5
|
10
|
-
|
11
|
-
</title>
|
12
|
-
|
13
|
-
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
14
|
-
|
15
|
-
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
16
|
-
|
17
|
-
<script type="text/javascript" charset="utf-8">
|
18
|
-
pathId = "AutoC::TreeSet";
|
19
|
-
relpath = '../';
|
20
|
-
</script>
|
21
|
-
|
22
|
-
|
23
|
-
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
24
|
-
|
25
|
-
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
26
|
-
|
27
|
-
|
28
|
-
</head>
|
29
|
-
<body>
|
30
|
-
<div class="nav_wrap">
|
31
|
-
<iframe id="nav" src="../class_list.html"></iframe>
|
32
|
-
<div id="resizer"></div>
|
33
|
-
</div>
|
34
|
-
|
35
|
-
<div id="main" tabindex="-1">
|
36
|
-
<div id="header">
|
37
|
-
<div id="menu">
|
38
|
-
|
39
|
-
<a href="../_index.html">Index (T)</a> »
|
40
|
-
<span class='title'><span class='object_link'><a href="../AutoC.html" title="AutoC (module)">AutoC</a></span></span>
|
41
|
-
»
|
42
|
-
<span class="title">TreeSet</span>
|
43
|
-
|
44
|
-
</div>
|
45
|
-
|
46
|
-
<div id="search">
|
47
|
-
|
48
|
-
<a class="full_list_link" id="class_list_link"
|
49
|
-
href="../class_list.html">
|
50
|
-
|
51
|
-
<svg width="24" height="24">
|
52
|
-
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
-
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
-
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
-
</svg>
|
56
|
-
</a>
|
57
|
-
|
58
|
-
</div>
|
59
|
-
<div class="clear"></div>
|
60
|
-
</div>
|
61
|
-
|
62
|
-
<iframe id="search_frame" src="../class_list.html"></iframe>
|
63
|
-
|
64
|
-
<div id="content"><h1>Class: AutoC::TreeSet
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
</h1>
|
69
|
-
<div class="box_info">
|
70
|
-
|
71
|
-
<dl>
|
72
|
-
<dt>Inherits:</dt>
|
73
|
-
<dd>
|
74
|
-
<span class="inheritName"><span class='object_link'><a href="Collection.html" title="AutoC::Collection (class)">Collection</a></span></span>
|
75
|
-
|
76
|
-
<ul class="fullTree">
|
77
|
-
<li>Object</li>
|
78
|
-
|
79
|
-
<li class="next"><span class='object_link'><a href="Code.html" title="AutoC::Code (class)">Code</a></span></li>
|
80
|
-
|
81
|
-
<li class="next"><span class='object_link'><a href="Type.html" title="AutoC::Type (class)">Type</a></span></li>
|
82
|
-
|
83
|
-
<li class="next"><span class='object_link'><a href="Collection.html" title="AutoC::Collection (class)">Collection</a></span></li>
|
84
|
-
|
85
|
-
<li class="next">AutoC::TreeSet</li>
|
86
|
-
|
87
|
-
</ul>
|
88
|
-
<a href="#" class="inheritanceTree">show all</a>
|
89
|
-
|
90
|
-
</dd>
|
91
|
-
</dl>
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
<dl>
|
99
|
-
<dt>Includes:</dt>
|
100
|
-
<dd><span class='object_link'><a href="Iterators/Bidirectional.html" title="AutoC::Iterators::Bidirectional (module)">Iterators::Bidirectional</a></span>, <span class='object_link'><a href="Sets.html" title="AutoC::Sets (module)">Sets</a></span></dd>
|
101
|
-
</dl>
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
<dl>
|
109
|
-
<dt>Defined in:</dt>
|
110
|
-
<dd>lib/autoc/collection/tree_set.rb</dd>
|
111
|
-
</dl>
|
112
|
-
|
113
|
-
</div>
|
114
|
-
|
115
|
-
<h2>Overview</h2><div class="docstring">
|
116
|
-
<div class="discussion">
|
117
|
-
<div class="paragraph">
|
118
|
-
<p>TreeSet< <strong><em>E</em></strong> > is a sorted container holding unique elements.</p>
|
119
|
-
</div>
|
120
|
-
<div class="paragraph">
|
121
|
-
<p>The TreeSet implements the Red-Black Tree algorithm.</p>
|
122
|
-
</div>
|
123
|
-
<div class="paragraph">
|
124
|
-
<p>This code is an adaptation of the rbtree code from the <a href="http://www.nlnetlabs.nl/projects/ldns">NLNetLabs LDNS</a> project.</p>
|
125
|
-
</div>
|
126
|
-
<div class="paragraph">
|
127
|
-
<p>The collection’s C++ counterpart is std::set<> template class.</p>
|
128
|
-
</div>
|
129
|
-
<div class="sect1">
|
130
|
-
<h2 id="_generated_c_interface">Generated C interface</h2>
|
131
|
-
<div class="sectionbody">
|
132
|
-
<div class="sect2">
|
133
|
-
<h3 id="_collection_management">Collection management</h3>
|
134
|
-
<table class="tableblock frame-all grid-all spread">
|
135
|
-
<colgroup>
|
136
|
-
<col style="width: 50%;">
|
137
|
-
<col style="width: 50%;">
|
138
|
-
</colgroup>
|
139
|
-
<tbody>
|
140
|
-
<tr>
|
141
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>void</em></strong> <sub>type</sub>Copy(<strong><em>Type</em></strong> * dst, <strong><em>Type</em></strong> * src)</p></td>
|
142
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Create a new set dst filled with the contents of src.
|
143
|
-
A copy operation is performed on every element in src.
|
144
|
-
</p><p class="tableblock">NOTE: Previous contents of dst is overwritten.</p></td>
|
145
|
-
</tr>
|
146
|
-
<tr>
|
147
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>void</em></strong> <sub>type</sub>Ctor(<strong><em>Type</em></strong> * self)</p></td>
|
148
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Create a new empty set self.
|
149
|
-
</p><p class="tableblock">NOTE: Previous contents of self is overwritten.</p></td>
|
150
|
-
</tr>
|
151
|
-
<tr>
|
152
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>void</em></strong> <sub>type</sub>Dtor(<strong><em>Type</em></strong> * self)</p></td>
|
153
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Destroy set self.
|
154
|
-
Stored elements are destroyed as well by calling the respective destructors.</p></td>
|
155
|
-
</tr>
|
156
|
-
<tr>
|
157
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>int</em></strong> <sub>type</sub>Equal(<strong><em>Type</em></strong> * lt, <strong><em>Type</em></strong> * rt)</p></td>
|
158
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Return non-zero value if sets lt and rt are considered equal by contents and zero value otherwise.</p></td>
|
159
|
-
</tr>
|
160
|
-
<tr>
|
161
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>size_t</em></strong> <sub>type</sub>Identify(<strong><em>Type</em></strong> * self)</p></td>
|
162
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Return hash code for set self.</p></td>
|
163
|
-
</tr>
|
164
|
-
</tbody>
|
165
|
-
</table>
|
166
|
-
</div>
|
167
|
-
<div class="sect2">
|
168
|
-
<h3 id="_basic_operations">Basic operations</h3>
|
169
|
-
<table class="tableblock frame-all grid-all spread">
|
170
|
-
<colgroup>
|
171
|
-
<col style="width: 50%;">
|
172
|
-
<col style="width: 50%;">
|
173
|
-
</colgroup>
|
174
|
-
<tbody>
|
175
|
-
<tr>
|
176
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>int</em></strong> <sub>type</sub>Contains(<strong><em>Type</em></strong> * self, <strong><em>E</em></strong> what)</p></td>
|
177
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Return non-zero value if set self contains an element considered equal to the element what and zero value otherwise.</p></td>
|
178
|
-
</tr>
|
179
|
-
<tr>
|
180
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>int</em></strong> <sub>type</sub>Empty(<strong><em>Type</em></strong> * self)</p></td>
|
181
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Return non-zero value if set self contains no elements and zero value otherwise.</p></td>
|
182
|
-
</tr>
|
183
|
-
<tr>
|
184
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>E</em></strong> <sub>type</sub>Get(<strong><em>Type</em></strong> * self, <strong><em>E</em></strong> what)</p></td>
|
185
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Return a <em>copy</em> of the element in self considered equal to the element what.
|
186
|
-
</p><p class="tableblock">WARNING: self <strong>must</strong> contain such element otherwise the behavior is undefined. See <sub>type</sub>Contains().</p></td>
|
187
|
-
</tr>
|
188
|
-
<tr>
|
189
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>E</em></strong> <sub>type</sub>PeekLowest(<strong><em>Type</em></strong> * self)</p></td>
|
190
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Return a <em>copy</em> of the lowest element in self.
|
191
|
-
</p><p class="tableblock">WARNING: self <strong>must not</strong> be empty otherwise the behavior is undefined. See <sub>type</sub>Empty().</p></td>
|
192
|
-
</tr>
|
193
|
-
<tr>
|
194
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>E</em></strong> <sub>type</sub>PeekHighest(<strong><em>Type</em></strong> * self)</p></td>
|
195
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Return a <em>copy</em> of the highest element in self.
|
196
|
-
</p><p class="tableblock">WARNING: self <strong>must not</strong> be empty otherwise the behavior is undefined. See <sub>type</sub>Empty().</p></td>
|
197
|
-
</tr>
|
198
|
-
<tr>
|
199
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>void</em></strong> <sub>type</sub>Purge(<strong><em>Type</em></strong> * self)</p></td>
|
200
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Remove and destroy all elements stored in self.</p></td>
|
201
|
-
</tr>
|
202
|
-
<tr>
|
203
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>int</em></strong> <sub>type</sub>Put(<strong><em>Type</em></strong> * self, <strong><em>E</em></strong> what)</p></td>
|
204
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Put a <em>copy</em> of the element what into self <strong>only if</strong> there is no such element in self which is considered equal to what.
|
205
|
-
</p><p class="tableblock">Return non-zero value on successful element put (that is there was not such element in self) and zero value otherwise.</p></td>
|
206
|
-
</tr>
|
207
|
-
<tr>
|
208
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>int</em></strong> <sub>type</sub>Replace(<strong><em>Type</em></strong> * self, <strong><em>E</em></strong> with)</p></td>
|
209
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">If self contains an element which is considered equal to the element with,
|
210
|
-
replace that element with a <em>copy</em> of with, otherwise do nothing.
|
211
|
-
Replaced element is destroyed.
|
212
|
-
</p><p class="tableblock">Return non-zero value if the replacement was actually performed and zero value otherwise.</p></td>
|
213
|
-
</tr>
|
214
|
-
<tr>
|
215
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>int</em></strong> <sub>type</sub>Remove(<strong><em>Type</em></strong> * self, <strong><em>E</em></strong> what)</p></td>
|
216
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Remove and destroy an element in self which is considered equal to the element what.
|
217
|
-
</p><p class="tableblock">Return non-zero value on successful element removal and zero value otherwise.</p></td>
|
218
|
-
</tr>
|
219
|
-
<tr>
|
220
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>size_t</em></strong> <sub>type</sub>Size(<strong><em>Type</em></strong> * self)</p></td>
|
221
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Return number of elements stored in self.</p></td>
|
222
|
-
</tr>
|
223
|
-
</tbody>
|
224
|
-
</table>
|
225
|
-
</div>
|
226
|
-
<div class="sect2">
|
227
|
-
<h3 id="_logical_operations">Logical operations</h3>
|
228
|
-
<table class="tableblock frame-all grid-all spread">
|
229
|
-
<colgroup>
|
230
|
-
<col style="width: 50%;">
|
231
|
-
<col style="width: 50%;">
|
232
|
-
</colgroup>
|
233
|
-
<tbody>
|
234
|
-
<tr>
|
235
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>void</em></strong> <sub>type</sub>Exclude(<strong><em>Type</em></strong> * self, <strong><em>Type</em></strong> * other)</p></td>
|
236
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Perform the difference operation that is self will retain only the elements not contained in other.
|
237
|
-
</p><p class="tableblock">Removed elements are destroyed.</p></td>
|
238
|
-
</tr>
|
239
|
-
<tr>
|
240
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>void</em></strong> <sub>type</sub>Include(<strong><em>Type</em></strong> * self, <strong><em>Type</em></strong> * other)</p></td>
|
241
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Perform the union operation that is self will contain the elements from both self and other.
|
242
|
-
</p><p class="tableblock">self receives the <em>copies</em> of extra elements in other.</p></td>
|
243
|
-
</tr>
|
244
|
-
<tr>
|
245
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>void</em></strong> <sub>type</sub>Invert(<strong><em>Type</em></strong> * self, <strong><em>Type</em></strong> * other)</p></td>
|
246
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Perform the symmetric difference operation that is self will retain the elements contained in either self or other, but not in both.
|
247
|
-
</p><p class="tableblock">Removed elements are destroyed, extra elements are <em>copied</em>.</p></td>
|
248
|
-
</tr>
|
249
|
-
<tr>
|
250
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>void</em></strong> <sub>type</sub>Retain(<strong><em>Type</em></strong> * self, <strong><em>Type</em></strong> * other)</p></td>
|
251
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Perform the intersection operation that is self will retain only the elements contained in both self and other.
|
252
|
-
</p><p class="tableblock">Removed elements are destroyed.</p></td>
|
253
|
-
</tr>
|
254
|
-
</tbody>
|
255
|
-
</table>
|
256
|
-
</div>
|
257
|
-
<div class="sect2">
|
258
|
-
<h3 id="_iteration">Iteration</h3>
|
259
|
-
<table class="tableblock frame-all grid-all spread">
|
260
|
-
<colgroup>
|
261
|
-
<col style="width: 50%;">
|
262
|
-
<col style="width: 50%;">
|
263
|
-
</colgroup>
|
264
|
-
<tbody>
|
265
|
-
<tr>
|
266
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>void</em></strong> <sub>it</sub>Ctor(<strong><em>IteratorType</em></strong> * it, <strong><em>Type</em></strong> * self)</p></td>
|
267
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Create a new ascending iterator it on tree self. See <sub>it</sub>CtorEx().
|
268
|
-
</p><p class="tableblock">NOTE: Previous contents of it is overwritten.</p></td>
|
269
|
-
</tr>
|
270
|
-
<tr>
|
271
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>void</em></strong> <sub>it</sub>CtorEx(<strong><em>IteratorType</em></strong> * it, <strong><em>Type</em></strong> * self, <strong><em>int</em></strong> ascending)</p></td>
|
272
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Create a new iterator it on tree self.
|
273
|
-
Non-zero value of ascending specifies an ascending (lowest to highest element traversal) iterator, zero value specifies a descending (highest to lowest element traversal) iterator.
|
274
|
-
</p><p class="tableblock">NOTE: Previous contents of it is overwritten.</p></td>
|
275
|
-
</tr>
|
276
|
-
<tr>
|
277
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>int</em></strong> <sub>it</sub>Move(<strong><em>IteratorType</em></strong> * it)</p></td>
|
278
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Advance iterator position of it <strong>and</strong> return non-zero value if new position is valid and zero value otherwise.</p></td>
|
279
|
-
</tr>
|
280
|
-
<tr>
|
281
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>E</em></strong> <sub>it</sub>Get(<strong><em>IteratorType</em></strong> * it)</p></td>
|
282
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Return a <em>copy</em> of current element pointed to by the iterator it.
|
283
|
-
</p><p class="tableblock">WARNING: current position <strong>must</strong> be valid otherwise the behavior is undefined. See <sub>it</sub>Move().</p></td>
|
284
|
-
</tr>
|
285
|
-
</tbody>
|
286
|
-
</table>
|
287
|
-
</div>
|
288
|
-
</div>
|
289
|
-
</div>
|
290
|
-
|
291
|
-
</div>
|
292
|
-
</div>
|
293
|
-
<div class="tags">
|
294
|
-
|
295
|
-
|
296
|
-
</div>
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
<h2>Instance Attribute Summary</h2>
|
303
|
-
|
304
|
-
<h3 class="inherited">Attributes inherited from <span class='object_link'><a href="Collection.html" title="AutoC::Collection (class)">Collection</a></span></h3>
|
305
|
-
<p class="inherited"><span class='object_link'><a href="Collection.html#element-instance_method" title="AutoC::Collection#element (method)">#element</a></span>, <span class='object_link'><a href="Collection.html#it_ref-instance_method" title="AutoC::Collection#it_ref (method)">#it_ref</a></span></p>
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
<h3 class="inherited">Attributes inherited from <span class='object_link'><a href="Type.html" title="AutoC::Type (class)">Type</a></span></h3>
|
310
|
-
<p class="inherited"><span class='object_link'><a href="Type.html#type-instance_method" title="AutoC::Type#type (method)">#type</a></span>, <span class='object_link'><a href="Type.html#type_ref-instance_method" title="AutoC::Type#type_ref (method)">#type_ref</a></span></p>
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
<h2>
|
315
|
-
Instance Method Summary
|
316
|
-
<small><a href="#" class="summary_toggle">collapse</a></small>
|
317
|
-
</h2>
|
318
|
-
|
319
|
-
<ul class="summary">
|
320
|
-
|
321
|
-
<li class="public ">
|
322
|
-
<span class="summary_signature">
|
323
|
-
|
324
|
-
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(*args) ⇒ TreeSet </a>
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
</span>
|
329
|
-
|
330
|
-
|
331
|
-
<span class="note title constructor">constructor</span>
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
<span class="summary_desc"><div class='inline'><div class="paragraph">
|
341
|
-
<p>A new instance of TreeSet.</p>
|
342
|
-
</div></div></span>
|
343
|
-
|
344
|
-
</li>
|
345
|
-
|
346
|
-
|
347
|
-
<li class="public ">
|
348
|
-
<span class="summary_signature">
|
349
|
-
|
350
|
-
<a href="#write_impls-instance_method" title="#write_impls (instance method)">#<strong>write_impls</strong>(stream, define) ⇒ Object </a>
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
</span>
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
<span class="summary_desc"><div class='inline'></div></span>
|
365
|
-
|
366
|
-
</li>
|
367
|
-
|
368
|
-
|
369
|
-
<li class="public ">
|
370
|
-
<span class="summary_signature">
|
371
|
-
|
372
|
-
<a href="#write_intf_decls-instance_method" title="#write_intf_decls (instance method)">#<strong>write_intf_decls</strong>(stream, declare, define) ⇒ Object </a>
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
</span>
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
<span class="summary_desc"><div class='inline'></div></span>
|
387
|
-
|
388
|
-
</li>
|
389
|
-
|
390
|
-
|
391
|
-
<li class="public ">
|
392
|
-
<span class="summary_signature">
|
393
|
-
|
394
|
-
<a href="#write_intf_types-instance_method" title="#write_intf_types (instance method)">#<strong>write_intf_types</strong>(stream) ⇒ Object </a>
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
</span>
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
<span class="summary_desc"><div class='inline'></div></span>
|
409
|
-
|
410
|
-
</li>
|
411
|
-
|
412
|
-
|
413
|
-
</ul>
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Collection.html" title="AutoC::Collection (class)">Collection</a></span></h3>
|
438
|
-
<p class="inherited"><span class='object_link'><a href="Collection.html#%3D%3D-instance_method" title="AutoC::Collection#== (method)">#==</a></span>, <span class='object_link'><a href="Collection.html#comparable%3F-instance_method" title="AutoC::Collection#comparable? (method)">#comparable?</a></span>, <span class='object_link'><a href="Collection.html#constructible%3F-instance_method" title="AutoC::Collection#constructible? (method)">#constructible?</a></span>, <span class='object_link'><a href="Collection.html#copyable%3F-instance_method" title="AutoC::Collection#copyable? (method)">#copyable?</a></span>, <span class='object_link'><a href="Collection.html#destructible%3F-instance_method" title="AutoC::Collection#destructible? (method)">#destructible?</a></span>, <span class='object_link'><a href="Collection.html#entities-instance_method" title="AutoC::Collection#entities (method)">#entities</a></span>, <span class='object_link'><a href="Collection.html#hash-instance_method" title="AutoC::Collection#hash (method)">#hash</a></span>, <span class='object_link'><a href="Collection.html#hashable%3F-instance_method" title="AutoC::Collection#hashable? (method)">#hashable?</a></span>, <span class='object_link'><a href="Collection.html#initializable%3F-instance_method" title="AutoC::Collection#initializable? (method)">#initializable?</a></span></p>
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Type.html" title="AutoC::Type (class)">Type</a></span></h3>
|
450
|
-
<p class="inherited"><span class='object_link'><a href="Type.html#%3D%3D-instance_method" title="AutoC::Type#== (method)">#==</a></span>, <span class='object_link'><a href="Type.html#abort-instance_method" title="AutoC::Type#abort (method)">#abort</a></span>, <span class='object_link'><a href="Type.html#assert-instance_method" title="AutoC::Type#assert (method)">#assert</a></span>, <span class='object_link'><a href="Type.html#calloc-instance_method" title="AutoC::Type#calloc (method)">#calloc</a></span>, <span class='object_link'><a href="Type.html#coerce-class_method" title="AutoC::Type.coerce (method)">coerce</a></span>, <span class='object_link'><a href="Type.html#comparable%3F-instance_method" title="AutoC::Type#comparable? (method)">#comparable?</a></span>, <span class='object_link'><a href="Type.html#constructible%3F-instance_method" title="AutoC::Type#constructible? (method)">#constructible?</a></span>, <span class='object_link'><a href="Type.html#copyable%3F-instance_method" title="AutoC::Type#copyable? (method)">#copyable?</a></span>, <span class='object_link'><a href="Type.html#destructible%3F-instance_method" title="AutoC::Type#destructible? (method)">#destructible?</a></span>, <span class='object_link'><a href="Type.html#entities-instance_method" title="AutoC::Type#entities (method)">#entities</a></span>, <span class='object_link'><a href="Type.html#extern-instance_method" title="AutoC::Type#extern (method)">#extern</a></span>, <span class='object_link'><a href="Type.html#free-instance_method" title="AutoC::Type#free (method)">#free</a></span>, <span class='object_link'><a href="Type.html#hash-instance_method" title="AutoC::Type#hash (method)">#hash</a></span>, <span class='object_link'><a href="Type.html#hashable%3F-instance_method" title="AutoC::Type#hashable? (method)">#hashable?</a></span>, <span class='object_link'><a href="Type.html#initializable%3F-instance_method" title="AutoC::Type#initializable? (method)">#initializable?</a></span>, <span class='object_link'><a href="Type.html#inline-instance_method" title="AutoC::Type#inline (method)">#inline</a></span>, <span class='object_link'><a href="Type.html#malloc-instance_method" title="AutoC::Type#malloc (method)">#malloc</a></span>, <span class='object_link'><a href="Type.html#method_missing-instance_method" title="AutoC::Type#method_missing (method)">#method_missing</a></span>, <span class='object_link'><a href="Type.html#orderable%3F-instance_method" title="AutoC::Type#orderable? (method)">#orderable?</a></span>, <span class='object_link'><a href="Type.html#prefix-instance_method" title="AutoC::Type#prefix (method)">#prefix</a></span>, <span class='object_link'><a href="Type.html#private%3F-instance_method" title="AutoC::Type#private? (method)">#private?</a></span>, <span class='object_link'><a href="Type.html#public%3F-instance_method" title="AutoC::Type#public? (method)">#public?</a></span>, <span class='object_link'><a href="Type.html#sortable%3F-instance_method" title="AutoC::Type#sortable? (method)">#sortable?</a></span>, <span class='object_link'><a href="Type.html#static-instance_method" title="AutoC::Type#static (method)">#static</a></span>, <span class='object_link'><a href="Type.html#static%3F-instance_method" title="AutoC::Type#static? (method)">#static?</a></span>, <span class='object_link'><a href="Type.html#write_decls-instance_method" title="AutoC::Type#write_decls (method)">#write_decls</a></span>, <span class='object_link'><a href="Type.html#write_defs-instance_method" title="AutoC::Type#write_defs (method)">#write_defs</a></span>, <span class='object_link'><a href="Type.html#write_intf-instance_method" title="AutoC::Type#write_intf (method)">#write_intf</a></span></p>
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Code.html" title="AutoC::Code (class)">Code</a></span></h3>
|
461
|
-
<p class="inherited"><span class='object_link'><a href="Code.html#attach-instance_method" title="AutoC::Code#attach (method)">#attach</a></span>, <span class='object_link'><a href="Code.html#entities-instance_method" title="AutoC::Code#entities (method)">#entities</a></span>, <span class='object_link'><a href="Code.html#priority-instance_method" title="AutoC::Code#priority (method)">#priority</a></span>, <span class='object_link'><a href="Code.html#source_size-instance_method" title="AutoC::Code#source_size (method)">#source_size</a></span>, <span class='object_link'><a href="Code.html#write_decls-instance_method" title="AutoC::Code#write_decls (method)">#write_decls</a></span>, <span class='object_link'><a href="Code.html#write_defs-instance_method" title="AutoC::Code#write_defs (method)">#write_defs</a></span>, <span class='object_link'><a href="Code.html#write_intf-instance_method" title="AutoC::Code#write_intf (method)">#write_intf</a></span></p>
|
462
|
-
<div id="constructor_details" class="method_details_list">
|
463
|
-
<h2>Constructor Details</h2>
|
464
|
-
|
465
|
-
<div class="method_details first">
|
466
|
-
<h3 class="signature first" id="initialize-instance_method">
|
467
|
-
|
468
|
-
#<strong>initialize</strong>(*args) ⇒ <tt><span class='object_link'><a href="" title="AutoC::TreeSet (class)">TreeSet</a></span></tt>
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
</h3><div class="docstring">
|
475
|
-
<div class="discussion">
|
476
|
-
<div class="paragraph">
|
477
|
-
<p>Returns a new instance of TreeSet</p>
|
478
|
-
</div>
|
479
|
-
|
480
|
-
</div>
|
481
|
-
</div>
|
482
|
-
<div class="tags">
|
483
|
-
|
484
|
-
|
485
|
-
</div><table class="source_code">
|
486
|
-
<tr>
|
487
|
-
<td>
|
488
|
-
<pre class="lines">
|
489
|
-
|
490
|
-
|
491
|
-
175
|
492
|
-
176
|
493
|
-
177
|
494
|
-
178</pre>
|
495
|
-
</td>
|
496
|
-
<td>
|
497
|
-
<pre class="code"><span class="info file"># File 'lib/autoc/collection/tree_set.rb', line 175</span>
|
498
|
-
|
499
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
|
500
|
-
<span class='kw'>super</span>
|
501
|
-
<span class='id identifier rubyid_key_requirement'>key_requirement</span><span class='lparen'>(</span><span class='id identifier rubyid_element'>element</span><span class='rparen'>)</span>
|
502
|
-
<span class='kw'>end</span></pre>
|
503
|
-
</td>
|
504
|
-
</tr>
|
505
|
-
</table>
|
506
|
-
</div>
|
507
|
-
|
508
|
-
</div>
|
509
|
-
<div id="method_missing_details" class="method_details_list">
|
510
|
-
<h2>Dynamic Method Handling</h2>
|
511
|
-
<p class="notice super">
|
512
|
-
This class handles dynamic methods through the <tt>method_missing</tt> method
|
513
|
-
|
514
|
-
in the class <span class='object_link'><a href="Type.html#method_missing-instance_method" title="AutoC::Type#method_missing (method)">AutoC::Type</a></span>
|
515
|
-
|
516
|
-
</p>
|
517
|
-
|
518
|
-
</div>
|
519
|
-
|
520
|
-
|
521
|
-
<div id="instance_method_details" class="method_details_list">
|
522
|
-
<h2>Instance Method Details</h2>
|
523
|
-
|
524
|
-
|
525
|
-
<div class="method_details first">
|
526
|
-
<h3 class="signature first" id="write_impls-instance_method">
|
527
|
-
|
528
|
-
#<strong>write_impls</strong>(stream, define) ⇒ <tt>Object</tt>
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
</h3><table class="source_code">
|
535
|
-
<tr>
|
536
|
-
<td>
|
537
|
-
<pre class="lines">
|
538
|
-
|
539
|
-
|
540
|
-
212
|
541
|
-
213
|
542
|
-
214
|
543
|
-
215
|
544
|
-
216
|
545
|
-
217
|
546
|
-
218
|
547
|
-
219
|
548
|
-
220
|
549
|
-
221
|
550
|
-
222
|
551
|
-
223
|
552
|
-
224
|
553
|
-
225
|
554
|
-
226
|
555
|
-
227
|
556
|
-
228
|
557
|
-
229
|
558
|
-
230
|
559
|
-
231
|
560
|
-
232
|
561
|
-
233
|
562
|
-
234
|
563
|
-
235
|
564
|
-
236
|
565
|
-
237
|
566
|
-
238
|
567
|
-
239
|
568
|
-
240
|
569
|
-
241
|
570
|
-
242
|
571
|
-
243
|
572
|
-
244
|
573
|
-
245
|
574
|
-
246
|
575
|
-
247
|
576
|
-
248
|
577
|
-
249
|
578
|
-
250
|
579
|
-
251
|
580
|
-
252
|
581
|
-
253
|
582
|
-
254
|
583
|
-
255
|
584
|
-
256
|
585
|
-
257
|
586
|
-
258
|
587
|
-
259
|
588
|
-
260
|
589
|
-
261
|
590
|
-
262
|
591
|
-
263
|
592
|
-
264
|
593
|
-
265
|
594
|
-
266
|
595
|
-
267
|
596
|
-
268
|
597
|
-
269
|
598
|
-
270
|
599
|
-
271
|
600
|
-
272
|
601
|
-
273
|
602
|
-
274
|
603
|
-
275
|
604
|
-
276
|
605
|
-
277
|
606
|
-
278
|
607
|
-
279
|
608
|
-
280
|
609
|
-
281
|
610
|
-
282
|
611
|
-
283
|
612
|
-
284
|
613
|
-
285
|
614
|
-
286
|
615
|
-
287
|
616
|
-
288
|
617
|
-
289
|
618
|
-
290
|
619
|
-
291
|
620
|
-
292
|
621
|
-
293
|
622
|
-
294
|
623
|
-
295
|
624
|
-
296
|
625
|
-
297
|
626
|
-
298
|
627
|
-
299
|
628
|
-
300
|
629
|
-
301
|
630
|
-
302
|
631
|
-
303
|
632
|
-
304
|
633
|
-
305
|
634
|
-
306
|
635
|
-
307
|
636
|
-
308
|
637
|
-
309
|
638
|
-
310
|
639
|
-
311
|
640
|
-
312
|
641
|
-
313
|
642
|
-
314
|
643
|
-
315
|
644
|
-
316
|
645
|
-
317
|
646
|
-
318
|
647
|
-
319
|
648
|
-
320
|
649
|
-
321
|
650
|
-
322
|
651
|
-
323
|
652
|
-
324
|
653
|
-
325
|
654
|
-
326
|
655
|
-
327
|
656
|
-
328
|
657
|
-
329
|
658
|
-
330
|
659
|
-
331
|
660
|
-
332
|
661
|
-
333
|
662
|
-
334
|
663
|
-
335
|
664
|
-
336
|
665
|
-
337
|
666
|
-
338
|
667
|
-
339
|
668
|
-
340
|
669
|
-
341
|
670
|
-
342
|
671
|
-
343
|
672
|
-
344
|
673
|
-
345
|
674
|
-
346
|
675
|
-
347
|
676
|
-
348
|
677
|
-
349
|
678
|
-
350
|
679
|
-
351
|
680
|
-
352
|
681
|
-
353
|
682
|
-
354
|
683
|
-
355
|
684
|
-
356
|
685
|
-
357
|
686
|
-
358
|
687
|
-
359
|
688
|
-
360
|
689
|
-
361
|
690
|
-
362
|
691
|
-
363
|
692
|
-
364
|
693
|
-
365
|
694
|
-
366
|
695
|
-
367
|
696
|
-
368
|
697
|
-
369
|
698
|
-
370
|
699
|
-
371
|
700
|
-
372
|
701
|
-
373
|
702
|
-
374
|
703
|
-
375
|
704
|
-
376
|
705
|
-
377
|
706
|
-
378
|
707
|
-
379
|
708
|
-
380
|
709
|
-
381
|
710
|
-
382
|
711
|
-
383
|
712
|
-
384
|
713
|
-
385
|
714
|
-
386
|
715
|
-
387
|
716
|
-
388
|
717
|
-
389
|
718
|
-
390
|
719
|
-
391
|
720
|
-
392
|
721
|
-
393
|
722
|
-
394
|
723
|
-
395
|
724
|
-
396
|
725
|
-
397
|
726
|
-
398
|
727
|
-
399
|
728
|
-
400
|
729
|
-
401
|
730
|
-
402
|
731
|
-
403
|
732
|
-
404
|
733
|
-
405
|
734
|
-
406
|
735
|
-
407
|
736
|
-
408
|
737
|
-
409
|
738
|
-
410
|
739
|
-
411
|
740
|
-
412
|
741
|
-
413
|
742
|
-
414
|
743
|
-
415
|
744
|
-
416
|
745
|
-
417
|
746
|
-
418
|
747
|
-
419
|
748
|
-
420
|
749
|
-
421
|
750
|
-
422
|
751
|
-
423
|
752
|
-
424
|
753
|
-
425
|
754
|
-
426
|
755
|
-
427
|
756
|
-
428
|
757
|
-
429
|
758
|
-
430
|
759
|
-
431
|
760
|
-
432
|
761
|
-
433
|
762
|
-
434
|
763
|
-
435
|
764
|
-
436
|
765
|
-
437
|
766
|
-
438
|
767
|
-
439
|
768
|
-
440
|
769
|
-
441
|
770
|
-
442
|
771
|
-
443
|
772
|
-
444
|
773
|
-
445
|
774
|
-
446
|
775
|
-
447
|
776
|
-
448
|
777
|
-
449
|
778
|
-
450
|
779
|
-
451
|
780
|
-
452
|
781
|
-
453
|
782
|
-
454
|
783
|
-
455
|
784
|
-
456
|
785
|
-
457
|
786
|
-
458
|
787
|
-
459
|
788
|
-
460
|
789
|
-
461
|
790
|
-
462
|
791
|
-
463
|
792
|
-
464
|
793
|
-
465
|
794
|
-
466
|
795
|
-
467
|
796
|
-
468
|
797
|
-
469
|
798
|
-
470
|
799
|
-
471
|
800
|
-
472
|
801
|
-
473
|
802
|
-
474
|
803
|
-
475
|
804
|
-
476
|
805
|
-
477
|
806
|
-
478
|
807
|
-
479
|
808
|
-
480
|
809
|
-
481
|
810
|
-
482
|
811
|
-
483
|
812
|
-
484
|
813
|
-
485
|
814
|
-
486
|
815
|
-
487
|
816
|
-
488
|
817
|
-
489
|
818
|
-
490
|
819
|
-
491
|
820
|
-
492
|
821
|
-
493
|
822
|
-
494
|
823
|
-
495
|
824
|
-
496
|
825
|
-
497
|
826
|
-
498
|
827
|
-
499
|
828
|
-
500
|
829
|
-
501
|
830
|
-
502
|
831
|
-
503
|
832
|
-
504
|
833
|
-
505
|
834
|
-
506
|
835
|
-
507
|
836
|
-
508
|
837
|
-
509
|
838
|
-
510
|
839
|
-
511
|
840
|
-
512
|
841
|
-
513
|
842
|
-
514
|
843
|
-
515
|
844
|
-
516
|
845
|
-
517
|
846
|
-
518
|
847
|
-
519
|
848
|
-
520
|
849
|
-
521
|
850
|
-
522
|
851
|
-
523
|
852
|
-
524
|
853
|
-
525
|
854
|
-
526
|
855
|
-
527
|
856
|
-
528
|
857
|
-
529
|
858
|
-
530
|
859
|
-
531
|
860
|
-
532
|
861
|
-
533
|
862
|
-
534
|
863
|
-
535
|
864
|
-
536
|
865
|
-
537
|
866
|
-
538
|
867
|
-
539
|
868
|
-
540
|
869
|
-
541
|
870
|
-
542
|
871
|
-
543
|
872
|
-
544
|
873
|
-
545
|
874
|
-
546
|
875
|
-
547
|
876
|
-
548
|
877
|
-
549
|
878
|
-
550
|
879
|
-
551
|
880
|
-
552
|
881
|
-
553
|
882
|
-
554
|
883
|
-
555
|
884
|
-
556
|
885
|
-
557
|
886
|
-
558
|
887
|
-
559
|
888
|
-
560
|
889
|
-
561
|
890
|
-
562
|
891
|
-
563
|
892
|
-
564
|
893
|
-
565
|
894
|
-
566
|
895
|
-
567
|
896
|
-
568
|
897
|
-
569
|
898
|
-
570
|
899
|
-
571
|
900
|
-
572
|
901
|
-
573
|
902
|
-
574
|
903
|
-
575
|
904
|
-
576
|
905
|
-
577
|
906
|
-
578
|
907
|
-
579
|
908
|
-
580
|
909
|
-
581
|
910
|
-
582
|
911
|
-
583
|
912
|
-
584
|
913
|
-
585
|
914
|
-
586
|
915
|
-
587
|
916
|
-
588
|
917
|
-
589
|
918
|
-
590
|
919
|
-
591
|
920
|
-
592
|
921
|
-
593
|
922
|
-
594
|
923
|
-
595
|
924
|
-
596
|
925
|
-
597
|
926
|
-
598
|
927
|
-
599
|
928
|
-
600</pre>
|
929
|
-
</td>
|
930
|
-
<td>
|
931
|
-
<pre class="code"><span class="info file"># File 'lib/autoc/collection/tree_set.rb', line 212</span>
|
932
|
-
|
933
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_write_impls'>write_impls</span><span class='lparen'>(</span><span class='id identifier rubyid_stream'>stream</span><span class='comma'>,</span> <span class='id identifier rubyid_define'>define</span><span class='rparen'>)</span>
|
934
|
-
<span class='kw'>super</span>
|
935
|
-
<span class='id identifier rubyid_stream'>stream</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>%$</span><span class='tstring_content'>
|
936
|
-
#define </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_isRed'>isRed</span><span class='embexpr_end'>}</span><span class='tstring_content'>(x) (x->color)
|
937
|
-
#define </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_isBlack'>isBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(x) !</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_isRed'>isRed</span><span class='embexpr_end'>}</span><span class='tstring_content'>(x)
|
938
|
-
#define </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_setRed'>setRed</span><span class='embexpr_end'>}</span><span class='tstring_content'>(x) (x->color = 1)
|
939
|
-
#define </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_setBlack'>setBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(x) (x->color = 0)
|
940
|
-
#define </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_compare'>compare</span><span class='embexpr_end'>}</span><span class='tstring_content'>(lt, rt) (</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_equal'>equal</span><span class='lparen'>(</span><span class='symbol'>:lt</span><span class='comma'>,</span> <span class='symbol'>:rt</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'> ? 0 : (</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_less'>less</span><span class='lparen'>(</span><span class='symbol'>:lt</span><span class='comma'>,</span> <span class='symbol'>:rt</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'> ? -1 : +1))
|
941
|
-
static </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_nullNode'>nullNode</span><span class='embexpr_end'>}</span><span class='tstring_content'> = {0, NULL, NULL, NULL};
|
942
|
-
static </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'> = &</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_nullNode'>nullNode</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
943
|
-
static void </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_destroyNode'>destroyNode</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* node) {
|
944
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(node);
|
945
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(node != </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'>);
|
946
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_dtor'>dtor</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>node->element</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
947
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_free'>free</span><span class='embexpr_end'>}</span><span class='tstring_content'>(node);
|
948
|
-
}
|
949
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_define'>define</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_ctor'>ctor</span><span class='period'>.</span><span class='id identifier rubyid_definition'>definition</span><span class='embexpr_end'>}</span><span class='tstring_content'> {
|
950
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
951
|
-
self->size = 0;
|
952
|
-
self->root = </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
953
|
-
}
|
954
|
-
static void </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_destroy'>destroy</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* node) {
|
955
|
-
if(node != </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'>) {
|
956
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_destroy'>destroy</span><span class='embexpr_end'>}</span><span class='tstring_content'>(node->left);
|
957
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_destroy'>destroy</span><span class='embexpr_end'>}</span><span class='tstring_content'>(node->right);
|
958
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_destroyNode'>destroyNode</span><span class='embexpr_end'>}</span><span class='tstring_content'>(node);
|
959
|
-
}
|
960
|
-
}
|
961
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_define'>define</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_dtor'>dtor</span><span class='period'>.</span><span class='id identifier rubyid_definition'>definition</span><span class='embexpr_end'>}</span><span class='tstring_content'> {
|
962
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
963
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_destroy'>destroy</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self->root); /* FIXME recursive algorithm might be inefficient */
|
964
|
-
}
|
965
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_define'>define</span><span class='embexpr_end'>}</span><span class='tstring_content'> void </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_purge'>purge</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type_ref'>type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> self) {
|
966
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
967
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_dtor'>dtor</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
968
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_ctor'>ctor</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
969
|
-
}
|
970
|
-
static void </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_rotateLeft'>rotateLeft</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type_ref'>type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> self, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* node) {
|
971
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* right = node->right;
|
972
|
-
node->right = right->left;
|
973
|
-
if(right->left != </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'>) right->left->parent = node;
|
974
|
-
right->parent = node->parent;
|
975
|
-
if(node->parent != </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'>) {
|
976
|
-
if(node == node->parent->left) {
|
977
|
-
node->parent->left = right;
|
978
|
-
} else {
|
979
|
-
node->parent->right = right;
|
980
|
-
}
|
981
|
-
} else {
|
982
|
-
self->root = right;
|
983
|
-
}
|
984
|
-
right->left = node;
|
985
|
-
node->parent = right;
|
986
|
-
}
|
987
|
-
static void </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_rotateRight'>rotateRight</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type_ref'>type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> self, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* node) {
|
988
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* left = node->left;
|
989
|
-
node->left = left->right;
|
990
|
-
if(left->right != </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'>) left->right->parent = node;
|
991
|
-
left->parent = node->parent;
|
992
|
-
if(node->parent != </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'>) {
|
993
|
-
if(node == node->parent->right) {
|
994
|
-
node->parent->right = left;
|
995
|
-
} else {
|
996
|
-
node->parent->left = left;
|
997
|
-
}
|
998
|
-
} else {
|
999
|
-
self->root = left;
|
1000
|
-
}
|
1001
|
-
left->right = node;
|
1002
|
-
node->parent = left;
|
1003
|
-
}
|
1004
|
-
static void </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_insertFixup'>insertFixup</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type_ref'>type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> self, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* node) {
|
1005
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* uncle;
|
1006
|
-
while(node != self->root && </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_isRed'>isRed</span><span class='embexpr_end'>}</span><span class='tstring_content'>(node->parent)) {
|
1007
|
-
if(node->parent == node->parent->parent->left) {
|
1008
|
-
uncle = node->parent->parent->right;
|
1009
|
-
if(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_isRed'>isRed</span><span class='embexpr_end'>}</span><span class='tstring_content'>(uncle)) {
|
1010
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_setBlack'>setBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(node->parent);
|
1011
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_setBlack'>setBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(uncle);
|
1012
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_setRed'>setRed</span><span class='embexpr_end'>}</span><span class='tstring_content'>(node->parent->parent);
|
1013
|
-
node = node->parent->parent;
|
1014
|
-
} else {
|
1015
|
-
if(node == node->parent->right) {
|
1016
|
-
node = node->parent;
|
1017
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_rotateLeft'>rotateLeft</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, node);
|
1018
|
-
}
|
1019
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_setBlack'>setBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(node->parent);
|
1020
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_setRed'>setRed</span><span class='embexpr_end'>}</span><span class='tstring_content'>(node->parent->parent);
|
1021
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_rotateRight'>rotateRight</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, node->parent->parent);
|
1022
|
-
}
|
1023
|
-
} else {
|
1024
|
-
uncle = node->parent->parent->left;
|
1025
|
-
if(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_isRed'>isRed</span><span class='embexpr_end'>}</span><span class='tstring_content'>(uncle)) {
|
1026
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_setBlack'>setBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(node->parent);
|
1027
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_setBlack'>setBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(uncle);
|
1028
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_setRed'>setRed</span><span class='embexpr_end'>}</span><span class='tstring_content'>(node->parent->parent);
|
1029
|
-
node = node->parent->parent;
|
1030
|
-
} else {
|
1031
|
-
if(node == node->parent->left) {
|
1032
|
-
node = node->parent;
|
1033
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_rotateRight'>rotateRight</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, node);
|
1034
|
-
}
|
1035
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_setBlack'>setBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(node->parent);
|
1036
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_setRed'>setRed</span><span class='embexpr_end'>}</span><span class='tstring_content'>(node->parent->parent);
|
1037
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_rotateLeft'>rotateLeft</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, node->parent->parent);
|
1038
|
-
}
|
1039
|
-
}
|
1040
|
-
}
|
1041
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_setBlack'>setBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self->root);
|
1042
|
-
}
|
1043
|
-
static void </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_deleteFixup'>deleteFixup</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type_ref'>type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> self, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* child, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* child_parent) {
|
1044
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* sibling;
|
1045
|
-
int go_up = 1;
|
1046
|
-
if(child_parent->right == child) sibling = child_parent->left; else sibling = child_parent->right;
|
1047
|
-
while(go_up) {
|
1048
|
-
if(child_parent == </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'>) return;
|
1049
|
-
if(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_isRed'>isRed</span><span class='embexpr_end'>}</span><span class='tstring_content'>(sibling)) {
|
1050
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_setRed'>setRed</span><span class='embexpr_end'>}</span><span class='tstring_content'>(child_parent);
|
1051
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_setBlack'>setBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(sibling);
|
1052
|
-
if(child_parent->right == child) </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_rotateRight'>rotateRight</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, child_parent); else </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_rotateLeft'>rotateLeft</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, child_parent);
|
1053
|
-
if(child_parent->right == child) sibling = child_parent->left; else sibling = child_parent->right;
|
1054
|
-
}
|
1055
|
-
if(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_isBlack'>isBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(child_parent) && </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_isBlack'>isBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(sibling) && </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_isBlack'>isBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(sibling->left) && </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_isBlack'>isBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(sibling->right)) {
|
1056
|
-
if(sibling != </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'>) </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_setRed'>setRed</span><span class='embexpr_end'>}</span><span class='tstring_content'>(sibling);
|
1057
|
-
child = child_parent;
|
1058
|
-
child_parent = child_parent->parent;
|
1059
|
-
if(child_parent->right == child) sibling = child_parent->left; else sibling = child_parent->right;
|
1060
|
-
} else go_up = 0;
|
1061
|
-
}
|
1062
|
-
if(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_isRed'>isRed</span><span class='embexpr_end'>}</span><span class='tstring_content'>(child_parent) && </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_isBlack'>isBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(sibling) && </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_isBlack'>isBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(sibling->left) && </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_isBlack'>isBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(sibling->right)) {
|
1063
|
-
if(sibling != </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'>) </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_setRed'>setRed</span><span class='embexpr_end'>}</span><span class='tstring_content'>(sibling);
|
1064
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_setBlack'>setBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(child_parent);
|
1065
|
-
return;
|
1066
|
-
}
|
1067
|
-
if(child_parent->right == child && </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_isBlack'>isBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(sibling) && </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_isRed'>isRed</span><span class='embexpr_end'>}</span><span class='tstring_content'>(sibling->right) && </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_isBlack'>isBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(sibling->left)) {
|
1068
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_setRed'>setRed</span><span class='embexpr_end'>}</span><span class='tstring_content'>(sibling);
|
1069
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_setBlack'>setBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(sibling->right);
|
1070
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_rotateLeft'>rotateLeft</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, sibling);
|
1071
|
-
if(child_parent->right == child) sibling = child_parent->left; else sibling = child_parent->right;
|
1072
|
-
} else if(child_parent->left == child && </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_isBlack'>isBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(sibling) && </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_isRed'>isRed</span><span class='embexpr_end'>}</span><span class='tstring_content'>(sibling->left) && </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_isBlack'>isBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(sibling->right)) {
|
1073
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_setRed'>setRed</span><span class='embexpr_end'>}</span><span class='tstring_content'>(sibling);
|
1074
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_setBlack'>setBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(sibling->left);
|
1075
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_rotateRight'>rotateRight</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, sibling);
|
1076
|
-
if(child_parent->right == child) sibling = child_parent->left; else sibling = child_parent->right;
|
1077
|
-
}
|
1078
|
-
sibling->color = child_parent->color;
|
1079
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_setBlack'>setBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(child_parent);
|
1080
|
-
if(child_parent->right == child) {
|
1081
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_setBlack'>setBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(sibling->left);
|
1082
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_rotateRight'>rotateRight</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, child_parent);
|
1083
|
-
} else {
|
1084
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_setBlack'>setBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(sibling->right);
|
1085
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_rotateLeft'>rotateLeft</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, child_parent);
|
1086
|
-
}
|
1087
|
-
}
|
1088
|
-
static </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_findNode'>findNode</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type_ref'>type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> self, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> element) {
|
1089
|
-
int r;
|
1090
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* node;
|
1091
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1092
|
-
node = self->root;
|
1093
|
-
while(node != </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'>) {
|
1094
|
-
if((r = </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_compare'>compare</span><span class='embexpr_end'>}</span><span class='tstring_content'>(element, node->element)) == 0) {
|
1095
|
-
return node;
|
1096
|
-
}
|
1097
|
-
if(r < 0) {
|
1098
|
-
node = node->left;
|
1099
|
-
} else {
|
1100
|
-
node = node->right;
|
1101
|
-
}
|
1102
|
-
}
|
1103
|
-
return NULL;
|
1104
|
-
}
|
1105
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_define'>define</span><span class='embexpr_end'>}</span><span class='tstring_content'> int </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_contains'>contains</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type_ref'>type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> self, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> element) {
|
1106
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1107
|
-
return </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_findNode'>findNode</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, element) != NULL;
|
1108
|
-
}
|
1109
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_define'>define</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_get'>get</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type_ref'>type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> self, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> element) {
|
1110
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'> *node;
|
1111
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> result;
|
1112
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1113
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_contains'>contains</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, element));
|
1114
|
-
node = </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_findNode'>findNode</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, element);
|
1115
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_copy'>copy</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>result</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>node->element</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>; /* Here we rely on NULL pointer dereference to manifest the failure! */
|
1116
|
-
return result;
|
1117
|
-
}
|
1118
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_define'>define</span><span class='embexpr_end'>}</span><span class='tstring_content'> int </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_put'>put</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type_ref'>type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> self, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> element) {
|
1119
|
-
int r;
|
1120
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* data;
|
1121
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* node;
|
1122
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* parent;
|
1123
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1124
|
-
node = self->root;
|
1125
|
-
parent = </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
1126
|
-
while(node != </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'>) {
|
1127
|
-
if((r = </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_compare'>compare</span><span class='embexpr_end'>}</span><span class='tstring_content'>(element, node->element)) == 0) {
|
1128
|
-
return 0;
|
1129
|
-
}
|
1130
|
-
parent = node;
|
1131
|
-
if (r < 0) {
|
1132
|
-
node = node->left;
|
1133
|
-
} else {
|
1134
|
-
node = node->right;
|
1135
|
-
}
|
1136
|
-
}
|
1137
|
-
data = </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_malloc'>malloc</span><span class='embexpr_end'>}</span><span class='tstring_content'>(sizeof(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>)); </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(data);
|
1138
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_copy'>copy</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>data->element</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>element</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
1139
|
-
data->parent = parent;
|
1140
|
-
data->left = data->right = </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
1141
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_setRed'>setRed</span><span class='embexpr_end'>}</span><span class='tstring_content'>(data);
|
1142
|
-
++self->size;
|
1143
|
-
if(parent != </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'>) {
|
1144
|
-
if(r < 0) {
|
1145
|
-
parent->left = data;
|
1146
|
-
} else {
|
1147
|
-
parent->right = data;
|
1148
|
-
}
|
1149
|
-
} else {
|
1150
|
-
self->root = data;
|
1151
|
-
}
|
1152
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_insertFixup'>insertFixup</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, data);
|
1153
|
-
return 1;
|
1154
|
-
}
|
1155
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_define'>define</span><span class='embexpr_end'>}</span><span class='tstring_content'> int </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_replace'>replace</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type_ref'>type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> self, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> element) {
|
1156
|
-
int removed;
|
1157
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1158
|
-
/* FIXME removing followed by putting might be inefficient */
|
1159
|
-
if((removed = </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_remove'>remove</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, element))) </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_put'>put</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, element);
|
1160
|
-
return removed;
|
1161
|
-
}
|
1162
|
-
static void </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_swapColors'>swapColors</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* x, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* y) {
|
1163
|
-
int t = x->color;
|
1164
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(x);
|
1165
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(y);
|
1166
|
-
x->color = y->color;
|
1167
|
-
y->color = t;
|
1168
|
-
}
|
1169
|
-
static void </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_swapNodes'>swapNodes</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>** x, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>** y) {
|
1170
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* t = *x; *x = *y; *y = t;
|
1171
|
-
}
|
1172
|
-
static void </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_changeParent'>changeParent</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type_ref'>type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> self, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* parent, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* old_node, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* new_node) {
|
1173
|
-
if(parent == </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'>) {
|
1174
|
-
if(self->root == old_node) self->root = new_node;
|
1175
|
-
return;
|
1176
|
-
}
|
1177
|
-
if(parent->left == old_node) parent->left = new_node;
|
1178
|
-
if(parent->right == old_node) parent->right = new_node;
|
1179
|
-
}
|
1180
|
-
static void </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_changeChild'>changeChild</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* child, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* old_node, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* new_node) {
|
1181
|
-
if(child == </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'>) return;
|
1182
|
-
if(child->parent == old_node) child->parent = new_node;
|
1183
|
-
}
|
1184
|
-
int </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_remove'>remove</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type_ref'>type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> self, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> element) {
|
1185
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* to_delete;
|
1186
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* child;
|
1187
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1188
|
-
if((to_delete = </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_findNode'>findNode</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, element)) == NULL) return 0;
|
1189
|
-
if(to_delete->left != </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'> && to_delete->right != </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'>) {
|
1190
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'> *smright = to_delete->right;
|
1191
|
-
while(smright->left != </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'>) smright = smright->left;
|
1192
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_swapColors'>swapColors</span><span class='embexpr_end'>}</span><span class='tstring_content'>(to_delete, smright);
|
1193
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_changeParent'>changeParent</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, to_delete->parent, to_delete, smright);
|
1194
|
-
if(to_delete->right != smright) </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_changeParent'>changeParent</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, smright->parent, smright, to_delete);
|
1195
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_changeChild'>changeChild</span><span class='embexpr_end'>}</span><span class='tstring_content'>(smright->left, smright, to_delete);
|
1196
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_changeChild'>changeChild</span><span class='embexpr_end'>}</span><span class='tstring_content'>(smright->left, smright, to_delete);
|
1197
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_changeChild'>changeChild</span><span class='embexpr_end'>}</span><span class='tstring_content'>(smright->right, smright, to_delete);
|
1198
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_changeChild'>changeChild</span><span class='embexpr_end'>}</span><span class='tstring_content'>(smright->right, smright, to_delete);
|
1199
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_changeChild'>changeChild</span><span class='embexpr_end'>}</span><span class='tstring_content'>(to_delete->left, to_delete, smright);
|
1200
|
-
if(to_delete->right != smright) </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_changeChild'>changeChild</span><span class='embexpr_end'>}</span><span class='tstring_content'>(to_delete->right, to_delete, smright);
|
1201
|
-
if(to_delete->right == smright) {
|
1202
|
-
to_delete->right = to_delete;
|
1203
|
-
smright->parent = smright;
|
1204
|
-
}
|
1205
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_swapNodes'>swapNodes</span><span class='embexpr_end'>}</span><span class='tstring_content'>(&to_delete->parent, &smright->parent);
|
1206
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_swapNodes'>swapNodes</span><span class='embexpr_end'>}</span><span class='tstring_content'>(&to_delete->left, &smright->left);
|
1207
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_swapNodes'>swapNodes</span><span class='embexpr_end'>}</span><span class='tstring_content'>(&to_delete->right, &smright->right);
|
1208
|
-
}
|
1209
|
-
if(to_delete->left != </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'>) child = to_delete->left; else child = to_delete->right;
|
1210
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_changeParent'>changeParent</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, to_delete->parent, to_delete, child);
|
1211
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_changeChild'>changeChild</span><span class='embexpr_end'>}</span><span class='tstring_content'>(child, to_delete, to_delete->parent);
|
1212
|
-
if(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_isRed'>isRed</span><span class='embexpr_end'>}</span><span class='tstring_content'>(to_delete)) {} else if(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_isRed'>isRed</span><span class='embexpr_end'>}</span><span class='tstring_content'>(child)) {
|
1213
|
-
if(child != </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'>) </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_setBlack'>setBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(child);
|
1214
|
-
} else </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_deleteFixup'>deleteFixup</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, child, to_delete->parent);
|
1215
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_destroyNode'>destroyNode</span><span class='embexpr_end'>}</span><span class='tstring_content'>(to_delete);
|
1216
|
-
--self->size;
|
1217
|
-
return 1;
|
1218
|
-
}
|
1219
|
-
static </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_lowestNode'>lowestNode</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type_ref'>type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> self) {
|
1220
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* node;
|
1221
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1222
|
-
node = self->root;
|
1223
|
-
if(self->root != </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'>) {
|
1224
|
-
for(node = self->root; node->left != </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'>; node = node->left);
|
1225
|
-
}
|
1226
|
-
return node;
|
1227
|
-
}
|
1228
|
-
static </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_highestNode'>highestNode</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type_ref'>type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> self) {
|
1229
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* node;
|
1230
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1231
|
-
node = self->root;
|
1232
|
-
if(self->root != </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'>) {
|
1233
|
-
for(node = self->root; node->right != </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'>; node = node->right);
|
1234
|
-
}
|
1235
|
-
return node;
|
1236
|
-
}
|
1237
|
-
static </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_nextNode'>nextNode</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* node) {
|
1238
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* parent;
|
1239
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(node);
|
1240
|
-
if(node->right != </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'>) {
|
1241
|
-
for(node = node->right;
|
1242
|
-
node->left != </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
1243
|
-
node = node->left);
|
1244
|
-
} else {
|
1245
|
-
parent = node->parent;
|
1246
|
-
while(parent != </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'> && node == parent->right) {
|
1247
|
-
node = parent;
|
1248
|
-
parent = parent->parent;
|
1249
|
-
}
|
1250
|
-
node = parent;
|
1251
|
-
}
|
1252
|
-
return node;
|
1253
|
-
}
|
1254
|
-
static </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_prevNode'>prevNode</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* node) {
|
1255
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* parent;
|
1256
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(node);
|
1257
|
-
if(node->left != </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'>) {
|
1258
|
-
for(node = node->left;
|
1259
|
-
node->right != </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
1260
|
-
node = node->right);
|
1261
|
-
} else {
|
1262
|
-
parent = node->parent;
|
1263
|
-
while(parent != </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'> && node == parent->left) {
|
1264
|
-
node = parent;
|
1265
|
-
parent = parent->parent;
|
1266
|
-
}
|
1267
|
-
node = parent;
|
1268
|
-
}
|
1269
|
-
return node;
|
1270
|
-
}
|
1271
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_define'>define</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_peekLowest'>peekLowest</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type_ref'>type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> self) {
|
1272
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* node;
|
1273
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> result;
|
1274
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1275
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(!</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_empty'>empty</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self));
|
1276
|
-
node = </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_lowestNode'>lowestNode</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1277
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(node);
|
1278
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(node != </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'>);
|
1279
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_copy'>copy</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>result</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>node->element</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
1280
|
-
return result;
|
1281
|
-
}
|
1282
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_define'>define</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_peekHighest'>peekHighest</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type_ref'>type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> self) {
|
1283
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* node;
|
1284
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> result;
|
1285
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1286
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(!</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_empty'>empty</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self));
|
1287
|
-
node = </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_highestNode'>highestNode</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1288
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(node);
|
1289
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(node != </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'>);
|
1290
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_copy'>copy</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>result</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>node->element</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
1291
|
-
return result;
|
1292
|
-
}
|
1293
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_define'>define</span><span class='embexpr_end'>}</span><span class='tstring_content'> void </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_itCtorEx'>itCtorEx</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_it_ref'>it_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> self, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type_ref'>type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> tree, int ascending) {
|
1294
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1295
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(tree);
|
1296
|
-
self->node = (self->ascending = ascending) ? </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_lowestNode'>lowestNode</span><span class='embexpr_end'>}</span><span class='tstring_content'>(tree) : </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_highestNode'>highestNode</span><span class='embexpr_end'>}</span><span class='tstring_content'>(tree);
|
1297
|
-
self->start = 1;
|
1298
|
-
}
|
1299
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_define'>define</span><span class='embexpr_end'>}</span><span class='tstring_content'> int </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_itMove'>itMove</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_it_ref'>it_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> self) {
|
1300
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1301
|
-
if(self->start) {
|
1302
|
-
self->start = 0;
|
1303
|
-
} else {
|
1304
|
-
self->node = self->ascending ? </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_nextNode'>nextNode</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self->node) : </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_prevNode'>prevNode</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self->node);
|
1305
|
-
}
|
1306
|
-
return self->node != </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
1307
|
-
}
|
1308
|
-
static </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type_ref'>type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_itGetRef'>itGetRef</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_it_ref'>it_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> self) {
|
1309
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1310
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self->node);
|
1311
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self->node != </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'>);
|
1312
|
-
return &self->node->element;
|
1313
|
-
}
|
1314
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_define'>define</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_itGet'>itGet</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_it_ref'>it_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> self) {
|
1315
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> result;
|
1316
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1317
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_copy'>copy</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>result</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>*</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_itGetRef'>itGetRef</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self)</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
1318
|
-
return result;
|
1319
|
-
}
|
1320
|
-
</span><span class='tstring_end'>$</span></span>
|
1321
|
-
<span class='kw'>end</span></pre>
|
1322
|
-
</td>
|
1323
|
-
</tr>
|
1324
|
-
</table>
|
1325
|
-
</div>
|
1326
|
-
|
1327
|
-
<div class="method_details ">
|
1328
|
-
<h3 class="signature " id="write_intf_decls-instance_method">
|
1329
|
-
|
1330
|
-
#<strong>write_intf_decls</strong>(stream, declare, define) ⇒ <tt>Object</tt>
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
</h3><table class="source_code">
|
1337
|
-
<tr>
|
1338
|
-
<td>
|
1339
|
-
<pre class="lines">
|
1340
|
-
|
1341
|
-
|
1342
|
-
204
|
1343
|
-
205
|
1344
|
-
206
|
1345
|
-
207
|
1346
|
-
208
|
1347
|
-
209
|
1348
|
-
210</pre>
|
1349
|
-
</td>
|
1350
|
-
<td>
|
1351
|
-
<pre class="code"><span class="info file"># File 'lib/autoc/collection/tree_set.rb', line 204</span>
|
1352
|
-
|
1353
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_write_intf_decls'>write_intf_decls</span><span class='lparen'>(</span><span class='id identifier rubyid_stream'>stream</span><span class='comma'>,</span> <span class='id identifier rubyid_declare'>declare</span><span class='comma'>,</span> <span class='id identifier rubyid_define'>define</span><span class='rparen'>)</span>
|
1354
|
-
<span class='kw'>super</span>
|
1355
|
-
<span class='id identifier rubyid_stream'>stream</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>%$</span><span class='tstring_content'>
|
1356
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_declare'>declare</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_peekLowest'>peekLowest</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type_ref'>type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'>);
|
1357
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_declare'>declare</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_peekHighest'>peekHighest</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type_ref'>type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'>);
|
1358
|
-
</span><span class='tstring_end'>$</span></span>
|
1359
|
-
<span class='kw'>end</span></pre>
|
1360
|
-
</td>
|
1361
|
-
</tr>
|
1362
|
-
</table>
|
1363
|
-
</div>
|
1364
|
-
|
1365
|
-
<div class="method_details ">
|
1366
|
-
<h3 class="signature " id="write_intf_types-instance_method">
|
1367
|
-
|
1368
|
-
#<strong>write_intf_types</strong>(stream) ⇒ <tt>Object</tt>
|
1369
|
-
|
1370
|
-
|
1371
|
-
|
1372
|
-
|
1373
|
-
|
1374
|
-
</h3><table class="source_code">
|
1375
|
-
<tr>
|
1376
|
-
<td>
|
1377
|
-
<pre class="lines">
|
1378
|
-
|
1379
|
-
|
1380
|
-
180
|
1381
|
-
181
|
1382
|
-
182
|
1383
|
-
183
|
1384
|
-
184
|
1385
|
-
185
|
1386
|
-
186
|
1387
|
-
187
|
1388
|
-
188
|
1389
|
-
189
|
1390
|
-
190
|
1391
|
-
191
|
1392
|
-
192
|
1393
|
-
193
|
1394
|
-
194
|
1395
|
-
195
|
1396
|
-
196
|
1397
|
-
197
|
1398
|
-
198
|
1399
|
-
199
|
1400
|
-
200
|
1401
|
-
201
|
1402
|
-
202</pre>
|
1403
|
-
</td>
|
1404
|
-
<td>
|
1405
|
-
<pre class="code"><span class="info file"># File 'lib/autoc/collection/tree_set.rb', line 180</span>
|
1406
|
-
|
1407
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_write_intf_types'>write_intf_types</span><span class='lparen'>(</span><span class='id identifier rubyid_stream'>stream</span><span class='rparen'>)</span>
|
1408
|
-
<span class='kw'>super</span>
|
1409
|
-
<span class='id identifier rubyid_stream'>stream</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>%$</span><span class='tstring_content'>
|
1410
|
-
typedef struct </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
1411
|
-
typedef struct </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
1412
|
-
typedef struct </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_it'>it</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_it'>it</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
1413
|
-
struct </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> {
|
1414
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* root;
|
1415
|
-
size_t size;
|
1416
|
-
};
|
1417
|
-
struct </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_it'>it</span><span class='embexpr_end'>}</span><span class='tstring_content'> {
|
1418
|
-
int start, ascending;
|
1419
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* node;
|
1420
|
-
};
|
1421
|
-
struct </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'> {
|
1422
|
-
int color;
|
1423
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* left;
|
1424
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* right;
|
1425
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* parent;
|
1426
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> element;
|
1427
|
-
};
|
1428
|
-
</span><span class='tstring_end'>$</span></span>
|
1429
|
-
<span class='kw'>end</span></pre>
|
1430
|
-
</td>
|
1431
|
-
</tr>
|
1432
|
-
</table>
|
1433
|
-
</div>
|
1434
|
-
|
1435
|
-
</div>
|
1436
|
-
|
1437
|
-
</div>
|
1438
|
-
|
1439
|
-
<div id="footer">
|
1440
|
-
Generated on Wed Oct 12 12:27:12 2016 by
|
1441
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1442
|
-
0.9.5 (ruby-2.3.1).
|
1443
|
-
</div>
|
1444
|
-
|
1445
|
-
</div>
|
1446
|
-
</body>
|
1447
|
-
</html>
|