autoc 1.4 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGES.md +3 -0
  3. data/README.md +149 -0
  4. data/cmake/AutoC.cmake +39 -0
  5. data/lib/autoc/allocators.rb +51 -0
  6. data/lib/autoc/association.rb +126 -0
  7. data/lib/autoc/box.rb +311 -0
  8. data/lib/autoc/cmake.rb +54 -0
  9. data/lib/autoc/collection.rb +83 -110
  10. data/lib/autoc/composite.rb +333 -0
  11. data/lib/autoc/cstring.rb +263 -0
  12. data/lib/autoc/function.rb +247 -0
  13. data/lib/autoc/hash_map.rb +328 -0
  14. data/lib/autoc/hash_set.rb +339 -0
  15. data/lib/autoc/hashers.rb +102 -0
  16. data/lib/autoc/list.rb +444 -0
  17. data/lib/autoc/module.rb +434 -0
  18. data/lib/autoc/openmp.rb +15 -0
  19. data/lib/autoc/primitive.rb +27 -0
  20. data/lib/autoc/ranges.rb +707 -0
  21. data/lib/autoc/record.rb +247 -0
  22. data/lib/autoc/scaffold/docs.rb +117 -0
  23. data/lib/autoc/scaffold/generic_value.rb +86 -0
  24. data/lib/autoc/scaffold/project.rb +75 -0
  25. data/lib/autoc/scaffold/test_cstring.rb +113 -0
  26. data/lib/autoc/scaffold/test_cstring_hash_set.rb +35 -0
  27. data/lib/autoc/scaffold/test_int_box.rb +22 -0
  28. data/lib/autoc/scaffold/test_int_hash_set.rb +448 -0
  29. data/lib/autoc/scaffold/test_int_list.rb +106 -0
  30. data/lib/autoc/scaffold/test_int_vector.rb +83 -0
  31. data/lib/autoc/scaffold/test_v2v_hash_map.rb +83 -0
  32. data/lib/autoc/scaffold/test_value_hash_set.rb +60 -0
  33. data/lib/autoc/scaffold/test_value_vector.rb +146 -0
  34. data/{test/test.rb → lib/autoc/scaffold/tests.rb} +179 -158
  35. data/lib/autoc/scaffold.rb +12 -0
  36. data/lib/autoc/sequential.rb +99 -0
  37. data/lib/autoc/set.rb +331 -0
  38. data/lib/autoc/std.rb +149 -0
  39. data/lib/autoc/type.rb +93 -531
  40. data/lib/autoc/vector.rb +290 -0
  41. data/lib/autoc.rb +4 -35
  42. metadata +55 -85
  43. data/.yardopts +0 -4
  44. data/CHANGES +0 -23
  45. data/README +0 -28
  46. data/doc/AutoC/Code.html +0 -523
  47. data/doc/AutoC/Collection.html +0 -1214
  48. data/doc/AutoC/HashMap.html +0 -1441
  49. data/doc/AutoC/HashSet.html +0 -916
  50. data/doc/AutoC/Iterators/Bidirectional.html +0 -204
  51. data/doc/AutoC/Iterators/Unidirectional.html +0 -200
  52. data/doc/AutoC/Iterators.html +0 -126
  53. data/doc/AutoC/List.html +0 -1039
  54. data/doc/AutoC/Maps.html +0 -290
  55. data/doc/AutoC/Module/File.html +0 -415
  56. data/doc/AutoC/Module/Header.html +0 -437
  57. data/doc/AutoC/Module/Source.html +0 -707
  58. data/doc/AutoC/Module.html +0 -948
  59. data/doc/AutoC/Priority.html +0 -138
  60. data/doc/AutoC/Queue.html +0 -1172
  61. data/doc/AutoC/Reference.html +0 -735
  62. data/doc/AutoC/Sets.html +0 -520
  63. data/doc/AutoC/String.html +0 -1394
  64. data/doc/AutoC/TreeMap.html +0 -1565
  65. data/doc/AutoC/TreeSet.html +0 -1447
  66. data/doc/AutoC/Type.html +0 -2148
  67. data/doc/AutoC/UserDefinedType.html +0 -1047
  68. data/doc/AutoC/Vector.html +0 -987
  69. data/doc/AutoC.html +0 -331
  70. data/doc/_index.html +0 -388
  71. data/doc/class_list.html +0 -51
  72. data/doc/css/common.css +0 -1
  73. data/doc/css/full_list.css +0 -58
  74. data/doc/css/style.css +0 -481
  75. data/doc/file.CHANGES.html +0 -117
  76. data/doc/file.README.html +0 -116
  77. data/doc/file_list.html +0 -61
  78. data/doc/frames.html +0 -17
  79. data/doc/index.html +0 -116
  80. data/doc/js/app.js +0 -243
  81. data/doc/js/full_list.js +0 -216
  82. data/doc/js/jquery.js +0 -4
  83. data/doc/method_list.html +0 -1307
  84. data/doc/top-level-namespace.html +0 -112
  85. data/lib/autoc/code.rb +0 -237
  86. data/lib/autoc/collection/hash_map.rb +0 -385
  87. data/lib/autoc/collection/hash_set.rb +0 -337
  88. data/lib/autoc/collection/iterator.rb +0 -39
  89. data/lib/autoc/collection/list.rb +0 -429
  90. data/lib/autoc/collection/map.rb +0 -41
  91. data/lib/autoc/collection/queue.rb +0 -517
  92. data/lib/autoc/collection/set.rb +0 -134
  93. data/lib/autoc/collection/tree_map.rb +0 -464
  94. data/lib/autoc/collection/tree_set.rb +0 -611
  95. data/lib/autoc/collection/vector.rb +0 -336
  96. data/lib/autoc/string.rb +0 -492
  97. data/test/test_auto.c +0 -7141
  98. data/test/test_auto.h +0 -753
  99. data/test/test_char_string.rb +0 -270
  100. data/test/test_int_list.rb +0 -35
  101. data/test/test_int_tree_set.rb +0 -111
  102. data/test/test_int_vector.rb +0 -34
  103. data/test/test_value_hash_map.rb +0 -162
  104. data/test/test_value_hash_set.rb +0 -173
  105. data/test/test_value_list.rb +0 -193
  106. data/test/test_value_queue.rb +0 -275
  107. data/test/test_value_tree_map.rb +0 -176
  108. data/test/test_value_tree_set.rb +0 -173
  109. data/test/test_value_vector.rb +0 -155
  110. data/test/value.rb +0 -80
@@ -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
- &mdash; 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> &raquo;
40
- <span class='title'><span class='object_link'><a href="../AutoC.html" title="AutoC (module)">AutoC</a></span></span>
41
- &raquo;
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&lt; <strong><em>E</em></strong> &gt; 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&#8217;s C++ counterpart is std::set&lt;&gt; 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) &#x21d2; 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) &#x21d2; 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) &#x21d2; 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) &#x21d2; 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) &#x21d2; <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) &#x21d2; <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'>&lt;&lt;</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-&gt;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-&gt;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-&gt;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'> = &amp;</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'>&quot;</span><span class='tstring_content'>node-&gt;element</span><span class='tstring_end'>&quot;</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-&gt;size = 0;
952
- self-&gt;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-&gt;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-&gt;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-&gt;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-&gt;right;
972
- node-&gt;right = right-&gt;left;
973
- if(right-&gt;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-&gt;left-&gt;parent = node;
974
- right-&gt;parent = node-&gt;parent;
975
- if(node-&gt;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-&gt;parent-&gt;left) {
977
- node-&gt;parent-&gt;left = right;
978
- } else {
979
- node-&gt;parent-&gt;right = right;
980
- }
981
- } else {
982
- self-&gt;root = right;
983
- }
984
- right-&gt;left = node;
985
- node-&gt;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-&gt;left;
989
- node-&gt;left = left-&gt;right;
990
- if(left-&gt;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-&gt;right-&gt;parent = node;
991
- left-&gt;parent = node-&gt;parent;
992
- if(node-&gt;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-&gt;parent-&gt;right) {
994
- node-&gt;parent-&gt;right = left;
995
- } else {
996
- node-&gt;parent-&gt;left = left;
997
- }
998
- } else {
999
- self-&gt;root = left;
1000
- }
1001
- left-&gt;right = node;
1002
- node-&gt;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-&gt;root &amp;&amp; </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_isRed'>isRed</span><span class='embexpr_end'>}</span><span class='tstring_content'>(node-&gt;parent)) {
1007
- if(node-&gt;parent == node-&gt;parent-&gt;parent-&gt;left) {
1008
- uncle = node-&gt;parent-&gt;parent-&gt;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-&gt;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-&gt;parent-&gt;parent);
1013
- node = node-&gt;parent-&gt;parent;
1014
- } else {
1015
- if(node == node-&gt;parent-&gt;right) {
1016
- node = node-&gt;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-&gt;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-&gt;parent-&gt;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-&gt;parent-&gt;parent);
1022
- }
1023
- } else {
1024
- uncle = node-&gt;parent-&gt;parent-&gt;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-&gt;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-&gt;parent-&gt;parent);
1029
- node = node-&gt;parent-&gt;parent;
1030
- } else {
1031
- if(node == node-&gt;parent-&gt;left) {
1032
- node = node-&gt;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-&gt;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-&gt;parent-&gt;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-&gt;parent-&gt;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-&gt;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-&gt;right == child) sibling = child_parent-&gt;left; else sibling = child_parent-&gt;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-&gt;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-&gt;right == child) sibling = child_parent-&gt;left; else sibling = child_parent-&gt;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) &amp;&amp; </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_isBlack'>isBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(sibling) &amp;&amp; </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_isBlack'>isBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(sibling-&gt;left) &amp;&amp; </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_isBlack'>isBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(sibling-&gt;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-&gt;parent;
1059
- if(child_parent-&gt;right == child) sibling = child_parent-&gt;left; else sibling = child_parent-&gt;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) &amp;&amp; </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_isBlack'>isBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(sibling) &amp;&amp; </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_isBlack'>isBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(sibling-&gt;left) &amp;&amp; </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_isBlack'>isBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(sibling-&gt;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-&gt;right == child &amp;&amp; </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_isBlack'>isBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(sibling) &amp;&amp; </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_isRed'>isRed</span><span class='embexpr_end'>}</span><span class='tstring_content'>(sibling-&gt;right) &amp;&amp; </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_isBlack'>isBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(sibling-&gt;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-&gt;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-&gt;right == child) sibling = child_parent-&gt;left; else sibling = child_parent-&gt;right;
1072
- } else if(child_parent-&gt;left == child &amp;&amp; </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_isBlack'>isBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(sibling) &amp;&amp; </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_isRed'>isRed</span><span class='embexpr_end'>}</span><span class='tstring_content'>(sibling-&gt;left) &amp;&amp; </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_isBlack'>isBlack</span><span class='embexpr_end'>}</span><span class='tstring_content'>(sibling-&gt;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-&gt;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-&gt;right == child) sibling = child_parent-&gt;left; else sibling = child_parent-&gt;right;
1077
- }
1078
- sibling-&gt;color = child_parent-&gt;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-&gt;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-&gt;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-&gt;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-&gt;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-&gt;element)) == 0) {
1095
- return node;
1096
- }
1097
- if(r &lt; 0) {
1098
- node = node-&gt;left;
1099
- } else {
1100
- node = node-&gt;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'>&quot;</span><span class='tstring_content'>result</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>node-&gt;element</span><span class='tstring_end'>&quot;</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-&gt;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-&gt;element)) == 0) {
1128
- return 0;
1129
- }
1130
- parent = node;
1131
- if (r &lt; 0) {
1132
- node = node-&gt;left;
1133
- } else {
1134
- node = node-&gt;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'>&quot;</span><span class='tstring_content'>data-&gt;element</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>element</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
1139
- data-&gt;parent = parent;
1140
- data-&gt;left = data-&gt;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-&gt;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 &lt; 0) {
1145
- parent-&gt;left = data;
1146
- } else {
1147
- parent-&gt;right = data;
1148
- }
1149
- } else {
1150
- self-&gt;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-&gt;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-&gt;color = y-&gt;color;
1167
- y-&gt;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-&gt;root == old_node) self-&gt;root = new_node;
1175
- return;
1176
- }
1177
- if(parent-&gt;left == old_node) parent-&gt;left = new_node;
1178
- if(parent-&gt;right == old_node) parent-&gt;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-&gt;parent == old_node) child-&gt;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-&gt;left != </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_null'>null</span><span class='embexpr_end'>}</span><span class='tstring_content'> &amp;&amp; to_delete-&gt;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-&gt;right;
1191
- while(smright-&gt;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-&gt;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-&gt;parent, to_delete, smright);
1194
- if(to_delete-&gt;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-&gt;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-&gt;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-&gt;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-&gt;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-&gt;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-&gt;left, to_delete, smright);
1200
- if(to_delete-&gt;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-&gt;right, to_delete, smright);
1201
- if(to_delete-&gt;right == smright) {
1202
- to_delete-&gt;right = to_delete;
1203
- smright-&gt;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'>(&amp;to_delete-&gt;parent, &amp;smright-&gt;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'>(&amp;to_delete-&gt;left, &amp;smright-&gt;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'>(&amp;to_delete-&gt;right, &amp;smright-&gt;right);
1208
- }
1209
- if(to_delete-&gt;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-&gt;left; else child = to_delete-&gt;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-&gt;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-&gt;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-&gt;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-&gt;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-&gt;root;
1223
- if(self-&gt;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-&gt;root; node-&gt;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-&gt;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-&gt;root;
1232
- if(self-&gt;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-&gt;root; node-&gt;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-&gt;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-&gt;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-&gt;right;
1242
- node-&gt;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-&gt;left);
1244
- } else {
1245
- parent = node-&gt;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'> &amp;&amp; node == parent-&gt;right) {
1247
- node = parent;
1248
- parent = parent-&gt;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-&gt;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-&gt;left;
1259
- node-&gt;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-&gt;right);
1261
- } else {
1262
- parent = node-&gt;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'> &amp;&amp; node == parent-&gt;left) {
1264
- node = parent;
1265
- parent = parent-&gt;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'>&quot;</span><span class='tstring_content'>result</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>node-&gt;element</span><span class='tstring_end'>&quot;</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'>&quot;</span><span class='tstring_content'>result</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>node-&gt;element</span><span class='tstring_end'>&quot;</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-&gt;node = (self-&gt;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-&gt;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-&gt;start) {
1302
- self-&gt;start = 0;
1303
- } else {
1304
- self-&gt;node = self-&gt;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-&gt;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-&gt;node);
1305
- }
1306
- return self-&gt;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-&gt;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-&gt;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 &amp;self-&gt;node-&gt;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'>&quot;</span><span class='tstring_content'>result</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</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'>&quot;</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) &#x21d2; <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'>&lt;&lt;</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) &#x21d2; <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'>&lt;&lt;</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>