ds 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. data/.gitignore +4 -0
  2. data/Gemfile +4 -0
  3. data/Rakefile +13 -0
  4. data/doc/Array.html +264 -0
  5. data/doc/DS.html +292 -0
  6. data/doc/DS/Array2D.html +345 -0
  7. data/doc/DS/BinaryHeap.html +493 -0
  8. data/doc/DS/BinarySearchTree.html +313 -0
  9. data/doc/DS/BinaryTree.html +433 -0
  10. data/doc/DS/CompleteBinaryTree.html +550 -0
  11. data/doc/DS/CyclicList.html +234 -0
  12. data/doc/DS/Digraph.html +299 -0
  13. data/doc/DS/Edge.html +283 -0
  14. data/doc/DS/ExpandableArray.html +316 -0
  15. data/doc/DS/Graph.html +739 -0
  16. data/doc/DS/GraphAsList.html +361 -0
  17. data/doc/DS/GraphAsMatrix.html +633 -0
  18. data/doc/DS/GraphAsTriMatrix.html +274 -0
  19. data/doc/DS/List.html +1263 -0
  20. data/doc/DS/ListElement.html +344 -0
  21. data/doc/DS/Queue.html +517 -0
  22. data/doc/DS/Ring.html +323 -0
  23. data/doc/DS/Stack.html +407 -0
  24. data/doc/DS/Tree.html +770 -0
  25. data/doc/DS/TreeWalker.html +561 -0
  26. data/doc/DS/TriMatrix.html +338 -0
  27. data/doc/created.rid +25 -0
  28. data/doc/ds/graphs/digraph_rb.html +52 -0
  29. data/doc/ds/graphs/edge_rb.html +52 -0
  30. data/doc/ds/graphs/graph_as_list_rb.html +52 -0
  31. data/doc/ds/graphs/graph_as_matrix_rb.html +52 -0
  32. data/doc/ds/graphs/graph_as_tri_matrix_rb.html +52 -0
  33. data/doc/ds/graphs/graph_rb.html +52 -0
  34. data/doc/ds/lists/cyclic_list_rb.html +52 -0
  35. data/doc/ds/lists/list_element_rb.html +52 -0
  36. data/doc/ds/lists/list_rb.html +52 -0
  37. data/doc/ds/lists/ring_rb.html +52 -0
  38. data/doc/ds/matrixes/array_2d_rb.html +52 -0
  39. data/doc/ds/matrixes/expandable_array_rb.html +52 -0
  40. data/doc/ds/matrixes/tri_matrix_rb.html +52 -0
  41. data/doc/ds/queues/queue_rb.html +52 -0
  42. data/doc/ds/stacks/stack_rb.html +52 -0
  43. data/doc/ds/trees/binary_heap_rb.html +52 -0
  44. data/doc/ds/trees/binary_search_tree_rb.html +52 -0
  45. data/doc/ds/trees/binary_tree_rb.html +52 -0
  46. data/doc/ds/trees/complete_binary_tree_rb.html +52 -0
  47. data/doc/ds/trees/tree_rb.html +52 -0
  48. data/doc/ds/trees/tree_walker_rb.html +52 -0
  49. data/doc/ds/version_rb.html +52 -0
  50. data/doc/ds_rb.html +98 -0
  51. data/doc/ext/ext_rb.html +52 -0
  52. data/doc/images/brick.png +0 -0
  53. data/doc/images/brick_link.png +0 -0
  54. data/doc/images/bug.png +0 -0
  55. data/doc/images/bullet_black.png +0 -0
  56. data/doc/images/bullet_toggle_minus.png +0 -0
  57. data/doc/images/bullet_toggle_plus.png +0 -0
  58. data/doc/images/date.png +0 -0
  59. data/doc/images/find.png +0 -0
  60. data/doc/images/loadingAnimation.gif +0 -0
  61. data/doc/images/macFFBgHack.png +0 -0
  62. data/doc/images/package.png +0 -0
  63. data/doc/images/page_green.png +0 -0
  64. data/doc/images/page_white_text.png +0 -0
  65. data/doc/images/page_white_width.png +0 -0
  66. data/doc/images/plugin.png +0 -0
  67. data/doc/images/ruby.png +0 -0
  68. data/doc/images/tag_green.png +0 -0
  69. data/doc/images/wrench.png +0 -0
  70. data/doc/images/wrench_orange.png +0 -0
  71. data/doc/images/zoom.png +0 -0
  72. data/doc/index.html +375 -0
  73. data/doc/js/darkfish.js +116 -0
  74. data/doc/js/jquery.js +32 -0
  75. data/doc/js/quicksearch.js +114 -0
  76. data/doc/js/thickbox-compressed.js +10 -0
  77. data/doc/rdoc.css +763 -0
  78. data/ds.gemspec +20 -0
  79. data/lib/ds.rb +38 -0
  80. data/lib/ds/graphs/digraph.rb +20 -0
  81. data/lib/ds/graphs/edge.rb +15 -0
  82. data/lib/ds/graphs/graph.rb +107 -0
  83. data/lib/ds/graphs/graph_as_list.rb +48 -0
  84. data/lib/ds/graphs/graph_as_matrix.rb +114 -0
  85. data/lib/ds/graphs/graph_as_tri_matrix.rb +25 -0
  86. data/lib/ds/lists/cyclic_list.rb +21 -0
  87. data/lib/ds/lists/list.rb +303 -0
  88. data/lib/ds/lists/list_element.rb +26 -0
  89. data/lib/ds/lists/ring.rb +42 -0
  90. data/lib/ds/matrixes/array_2d.rb +35 -0
  91. data/lib/ds/matrixes/expandable_array.rb +37 -0
  92. data/lib/ds/matrixes/tri_matrix.rb +30 -0
  93. data/lib/ds/queues/queue.rb +53 -0
  94. data/lib/ds/stacks/stack.rb +39 -0
  95. data/lib/ds/trees/binary_heap.rb +71 -0
  96. data/lib/ds/trees/binary_search_tree.rb +32 -0
  97. data/lib/ds/trees/binary_tree.rb +65 -0
  98. data/lib/ds/trees/complete_binary_tree.rb +52 -0
  99. data/lib/ds/trees/tree.rb +117 -0
  100. data/lib/ds/trees/tree_walker.rb +179 -0
  101. data/lib/ds/version.rb +3 -0
  102. data/lib/ext/ext.rb +15 -0
  103. data/test/help.rb +8 -0
  104. data/test/test_array2d.rb +51 -0
  105. data/test/test_binary_heap.rb +35 -0
  106. data/test/test_binary_search_tree.rb +32 -0
  107. data/test/test_binary_tree.rb +51 -0
  108. data/test/test_complete_binary_tree.rb +30 -0
  109. data/test/test_digraph.rb +134 -0
  110. data/test/test_expandable_array.rb +26 -0
  111. data/test/test_graph.rb +71 -0
  112. data/test/test_list.rb +138 -0
  113. data/test/test_list_element.rb +56 -0
  114. data/test/test_queue.rb +110 -0
  115. data/test/test_ring.rb +28 -0
  116. data/test/test_stack.rb +87 -0
  117. data/test/test_tree.rb +48 -0
  118. data/test/test_tree_walker.rb +69 -0
  119. data/test/test_tri_matrix.rb +22 -0
  120. metadata +184 -0
@@ -0,0 +1,344 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
7
+
8
+ <title>Class: DS::ListElement</title>
9
+
10
+ <link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
11
+
12
+ <script src="../js/jquery.js" type="text/javascript" charset="utf-8"></script>
13
+ <script src="../js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
14
+ <script src="../js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
15
+ <script src="../js/darkfish.js" type="text/javascript" charset="utf-8"></script>
16
+
17
+ </head>
18
+ <body id="top" class="class">
19
+
20
+ <div id="metadata">
21
+ <div id="home-metadata">
22
+ <div id="home-section" class="section">
23
+ <h3 class="section-header">
24
+ <a href="../index.html">Home</a>
25
+ <a href="../index.html#classes">Classes</a>
26
+ <a href="../index.html#methods">Methods</a>
27
+ </h3>
28
+ </div>
29
+ </div>
30
+
31
+ <div id="file-metadata">
32
+ <div id="file-list-section" class="section">
33
+ <h3 class="section-header">In Files</h3>
34
+ <div class="section-body">
35
+ <ul>
36
+
37
+ <li><a href="../ds/lists/list_element_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
38
+ class="thickbox" title="ds/lists/list_element.rb">ds/lists/list_element.rb</a></li>
39
+
40
+ </ul>
41
+ </div>
42
+ </div>
43
+
44
+
45
+ </div>
46
+
47
+ <div id="class-metadata">
48
+
49
+ <!-- Parent Class -->
50
+ <div id="parent-class-section" class="section">
51
+ <h3 class="section-header">Parent</h3>
52
+
53
+ <p class="link">Object</p>
54
+
55
+ </div>
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+ <!-- Method Quickref -->
64
+ <div id="method-list-section" class="section">
65
+ <h3 class="section-header">Methods</h3>
66
+ <ul class="link-list">
67
+
68
+ <li><a href="#method-c-new">::new</a></li>
69
+
70
+ <li><a href="#method-i-append">#append</a></li>
71
+
72
+ <li><a href="#method-i-tail-3F">#tail?</a></li>
73
+
74
+ </ul>
75
+ </div>
76
+
77
+
78
+
79
+ </div>
80
+
81
+ <div id="project-metadata">
82
+
83
+
84
+
85
+ <div id="classindex-section" class="section project-section">
86
+ <h3 class="section-header">Class/Module Index
87
+ <span class="search-toggle"><img src="../images/find.png"
88
+ height="16" width="16" alt="[+]"
89
+ title="show/hide quicksearch" /></span></h3>
90
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
91
+ <fieldset>
92
+ <legend>Quicksearch</legend>
93
+ <input type="text" name="quicksearch" value=""
94
+ class="quicksearch-field" />
95
+ </fieldset>
96
+ </form>
97
+
98
+ <ul class="link-list">
99
+
100
+ <li><a href="../DS.html">DS</a></li>
101
+
102
+ <li><a href="../DS/Array2D.html">DS::Array2D</a></li>
103
+
104
+ <li><a href="../DS/BinaryHeap.html">DS::BinaryHeap</a></li>
105
+
106
+ <li><a href="../DS/BinarySearchTree.html">DS::BinarySearchTree</a></li>
107
+
108
+ <li><a href="../DS/BinaryTree.html">DS::BinaryTree</a></li>
109
+
110
+ <li><a href="../DS/CompleteBinaryTree.html">DS::CompleteBinaryTree</a></li>
111
+
112
+ <li><a href="../DS/CyclicList.html">DS::CyclicList</a></li>
113
+
114
+ <li><a href="../DS/Digraph.html">DS::Digraph</a></li>
115
+
116
+ <li><a href="../DS/Edge.html">DS::Edge</a></li>
117
+
118
+ <li><a href="../DS/ExpandableArray.html">DS::ExpandableArray</a></li>
119
+
120
+ <li><a href="../DS/Graph.html">DS::Graph</a></li>
121
+
122
+ <li><a href="../DS/GraphAsList.html">DS::GraphAsList</a></li>
123
+
124
+ <li><a href="../DS/GraphAsMatrix.html">DS::GraphAsMatrix</a></li>
125
+
126
+ <li><a href="../DS/GraphAsTriMatrix.html">DS::GraphAsTriMatrix</a></li>
127
+
128
+ <li><a href="../DS/List.html">DS::List</a></li>
129
+
130
+ <li><a href="../DS/ListElement.html">DS::ListElement</a></li>
131
+
132
+ <li><a href="../DS/Queue.html">DS::Queue</a></li>
133
+
134
+ <li><a href="../DS/Ring.html">DS::Ring</a></li>
135
+
136
+ <li><a href="../DS/Stack.html">DS::Stack</a></li>
137
+
138
+ <li><a href="../DS/Tree.html">DS::Tree</a></li>
139
+
140
+ <li><a href="../DS/TreeWalker.html">DS::TreeWalker</a></li>
141
+
142
+ <li><a href="../DS/TriMatrix.html">DS::TriMatrix</a></li>
143
+
144
+ <li><a href="../Array.html">Array</a></li>
145
+
146
+ </ul>
147
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
148
+ </div>
149
+
150
+
151
+ </div>
152
+ </div>
153
+
154
+ <div id="documentation">
155
+ <h1 class="class">DS::ListElement</h1>
156
+
157
+ <div id="description" class="description">
158
+
159
+ <p>Container for linked lists elements.</p>
160
+
161
+ </div><!-- description -->
162
+
163
+
164
+
165
+
166
+ <div id="5Buntitled-5D" class="documentation-section">
167
+
168
+
169
+
170
+
171
+
172
+
173
+
174
+ <!-- Attributes -->
175
+ <div id="attribute-method-details" class="method-section section">
176
+ <h3 class="section-header">Attributes</h3>
177
+
178
+
179
+ <div id="data-attribute-method" class="method-detail">
180
+ <a name="data"></a>
181
+
182
+ <a name="data="></a>
183
+
184
+ <div class="method-heading attribute-method-heading">
185
+ <span class="method-name">data</span><span
186
+ class="attribute-access-type">[RW]</span>
187
+ </div>
188
+
189
+ <div class="method-description">
190
+
191
+
192
+
193
+ </div>
194
+ </div>
195
+
196
+ <div id="next-attribute-method" class="method-detail">
197
+ <a name="next"></a>
198
+
199
+ <a name="next="></a>
200
+
201
+ <div class="method-heading attribute-method-heading">
202
+ <span class="method-name">next</span><span
203
+ class="attribute-access-type">[RW]</span>
204
+ </div>
205
+
206
+ <div class="method-description">
207
+
208
+
209
+
210
+ </div>
211
+ </div>
212
+
213
+ </div><!-- attribute-method-details -->
214
+
215
+
216
+ <!-- Methods -->
217
+
218
+ <div id="public-class-method-details" class="method-section section">
219
+ <h3 class="section-header">Public Class Methods</h3>
220
+
221
+
222
+ <div id="new-method" class="method-detail ">
223
+ <a name="method-c-new"></a>
224
+
225
+
226
+ <div class="method-heading">
227
+ <span class="method-name">new</span><span
228
+ class="method-args">(x=nil)</span>
229
+ <span class="method-click-advice">click to toggle source</span>
230
+ </div>
231
+
232
+
233
+ <div class="method-description">
234
+
235
+
236
+
237
+
238
+
239
+ <div class="method-source-code" id="new-source">
240
+ <pre>
241
+ <span class="ruby-comment"># File ds/lists/list_element.rb, line 8</span>
242
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">x</span>=<span class="ruby-keyword">nil</span>)
243
+ <span class="ruby-ivar">@data</span> = <span class="ruby-identifier">x</span>
244
+ <span class="ruby-ivar">@next</span>= <span class="ruby-keyword">nil</span>
245
+ <span class="ruby-keyword">end</span></pre>
246
+ </div><!-- new-source -->
247
+
248
+ </div>
249
+
250
+
251
+
252
+
253
+ </div><!-- new-method -->
254
+
255
+
256
+ </div><!-- public-class-method-details -->
257
+
258
+ <div id="public-instance-method-details" class="method-section section">
259
+ <h3 class="section-header">Public Instance Methods</h3>
260
+
261
+
262
+ <div id="append-method" class="method-detail ">
263
+ <a name="method-i-append"></a>
264
+
265
+
266
+ <div class="method-heading">
267
+ <span class="method-name">append</span><span
268
+ class="method-args">(x)</span>
269
+ <span class="method-click-advice">click to toggle source</span>
270
+ </div>
271
+
272
+
273
+ <div class="method-description">
274
+
275
+ <p>Adds new element to list.</p>
276
+
277
+
278
+
279
+ <div class="method-source-code" id="append-source">
280
+ <pre>
281
+ <span class="ruby-comment"># File ds/lists/list_element.rb, line 14</span>
282
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">append</span>(<span class="ruby-identifier">x</span>)
283
+ <span class="ruby-identifier">elem</span> = <span class="ruby-constant">ListElement</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">x</span>)
284
+ <span class="ruby-keyword">self</span>.<span class="ruby-identifier">next</span> = <span class="ruby-identifier">elem</span>
285
+ <span class="ruby-keyword">end</span></pre>
286
+ </div><!-- append-source -->
287
+
288
+ </div>
289
+
290
+
291
+
292
+
293
+ </div><!-- append-method -->
294
+
295
+
296
+ <div id="tail-3F-method" class="method-detail ">
297
+ <a name="method-i-tail-3F"></a>
298
+
299
+
300
+ <div class="method-heading">
301
+ <span class="method-name">tail?</span><span
302
+ class="method-args">()</span>
303
+ <span class="method-click-advice">click to toggle source</span>
304
+ </div>
305
+
306
+
307
+ <div class="method-description">
308
+
309
+ <p>Checks if given element is last.</p>
310
+
311
+
312
+
313
+ <div class="method-source-code" id="tail-3F-source">
314
+ <pre>
315
+ <span class="ruby-comment"># File ds/lists/list_element.rb, line 20</span>
316
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">tail?</span>
317
+ <span class="ruby-ivar">@next</span>.<span class="ruby-identifier">nil?</span>
318
+ <span class="ruby-keyword">end</span></pre>
319
+ </div><!-- tail-3F-source -->
320
+
321
+ </div>
322
+
323
+
324
+
325
+
326
+ </div><!-- tail-3F-method -->
327
+
328
+
329
+ </div><!-- public-instance-method-details -->
330
+
331
+ </div><!-- 5Buntitled-5D -->
332
+
333
+
334
+ </div><!-- documentation -->
335
+
336
+ <div id="validator-badges">
337
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
338
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
339
+ Rdoc Generator</a> 2</small>.</p>
340
+ </div>
341
+
342
+ </body>
343
+ </html>
344
+
@@ -0,0 +1,517 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
7
+
8
+ <title>Class: DS::Queue</title>
9
+
10
+ <link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
11
+
12
+ <script src="../js/jquery.js" type="text/javascript" charset="utf-8"></script>
13
+ <script src="../js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
14
+ <script src="../js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
15
+ <script src="../js/darkfish.js" type="text/javascript" charset="utf-8"></script>
16
+
17
+ </head>
18
+ <body id="top" class="class">
19
+
20
+ <div id="metadata">
21
+ <div id="home-metadata">
22
+ <div id="home-section" class="section">
23
+ <h3 class="section-header">
24
+ <a href="../index.html">Home</a>
25
+ <a href="../index.html#classes">Classes</a>
26
+ <a href="../index.html#methods">Methods</a>
27
+ </h3>
28
+ </div>
29
+ </div>
30
+
31
+ <div id="file-metadata">
32
+ <div id="file-list-section" class="section">
33
+ <h3 class="section-header">In Files</h3>
34
+ <div class="section-body">
35
+ <ul>
36
+
37
+ <li><a href="../ds/queues/queue_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
38
+ class="thickbox" title="ds/queues/queue.rb">ds/queues/queue.rb</a></li>
39
+
40
+ </ul>
41
+ </div>
42
+ </div>
43
+
44
+
45
+ </div>
46
+
47
+ <div id="class-metadata">
48
+
49
+ <!-- Parent Class -->
50
+ <div id="parent-class-section" class="section">
51
+ <h3 class="section-header">Parent</h3>
52
+
53
+ <p class="link">Object</p>
54
+
55
+ </div>
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+ <!-- Method Quickref -->
64
+ <div id="method-list-section" class="section">
65
+ <h3 class="section-header">Methods</h3>
66
+ <ul class="link-list">
67
+
68
+ <li><a href="#method-c-create">::create</a></li>
69
+
70
+ <li><a href="#method-c-new">::new</a></li>
71
+
72
+ <li><a href="#method-i-dequeue">#dequeue</a></li>
73
+
74
+ <li><a href="#method-i-empty-3F">#empty?</a></li>
75
+
76
+ <li><a href="#method-i-enqueue">#enqueue</a></li>
77
+
78
+ <li><a href="#method-i-length">#length</a></li>
79
+
80
+ <li><a href="#method-i-peek">#peek</a></li>
81
+
82
+ <li><a href="#method-i-push">#push</a></li>
83
+
84
+ <li><a href="#method-i-shift">#shift</a></li>
85
+
86
+ </ul>
87
+ </div>
88
+
89
+
90
+
91
+ </div>
92
+
93
+ <div id="project-metadata">
94
+
95
+
96
+
97
+ <div id="classindex-section" class="section project-section">
98
+ <h3 class="section-header">Class/Module Index
99
+ <span class="search-toggle"><img src="../images/find.png"
100
+ height="16" width="16" alt="[+]"
101
+ title="show/hide quicksearch" /></span></h3>
102
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
103
+ <fieldset>
104
+ <legend>Quicksearch</legend>
105
+ <input type="text" name="quicksearch" value=""
106
+ class="quicksearch-field" />
107
+ </fieldset>
108
+ </form>
109
+
110
+ <ul class="link-list">
111
+
112
+ <li><a href="../DS.html">DS</a></li>
113
+
114
+ <li><a href="../DS/Array2D.html">DS::Array2D</a></li>
115
+
116
+ <li><a href="../DS/BinaryHeap.html">DS::BinaryHeap</a></li>
117
+
118
+ <li><a href="../DS/BinarySearchTree.html">DS::BinarySearchTree</a></li>
119
+
120
+ <li><a href="../DS/BinaryTree.html">DS::BinaryTree</a></li>
121
+
122
+ <li><a href="../DS/CompleteBinaryTree.html">DS::CompleteBinaryTree</a></li>
123
+
124
+ <li><a href="../DS/CyclicList.html">DS::CyclicList</a></li>
125
+
126
+ <li><a href="../DS/Digraph.html">DS::Digraph</a></li>
127
+
128
+ <li><a href="../DS/Edge.html">DS::Edge</a></li>
129
+
130
+ <li><a href="../DS/ExpandableArray.html">DS::ExpandableArray</a></li>
131
+
132
+ <li><a href="../DS/Graph.html">DS::Graph</a></li>
133
+
134
+ <li><a href="../DS/GraphAsList.html">DS::GraphAsList</a></li>
135
+
136
+ <li><a href="../DS/GraphAsMatrix.html">DS::GraphAsMatrix</a></li>
137
+
138
+ <li><a href="../DS/GraphAsTriMatrix.html">DS::GraphAsTriMatrix</a></li>
139
+
140
+ <li><a href="../DS/List.html">DS::List</a></li>
141
+
142
+ <li><a href="../DS/ListElement.html">DS::ListElement</a></li>
143
+
144
+ <li><a href="../DS/Queue.html">DS::Queue</a></li>
145
+
146
+ <li><a href="../DS/Ring.html">DS::Ring</a></li>
147
+
148
+ <li><a href="../DS/Stack.html">DS::Stack</a></li>
149
+
150
+ <li><a href="../DS/Tree.html">DS::Tree</a></li>
151
+
152
+ <li><a href="../DS/TreeWalker.html">DS::TreeWalker</a></li>
153
+
154
+ <li><a href="../DS/TriMatrix.html">DS::TriMatrix</a></li>
155
+
156
+ <li><a href="../Array.html">Array</a></li>
157
+
158
+ </ul>
159
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
160
+ </div>
161
+
162
+
163
+ </div>
164
+ </div>
165
+
166
+ <div id="documentation">
167
+ <h1 class="class">DS::Queue</h1>
168
+
169
+ <div id="description" class="description">
170
+
171
+ <p>Class implements queue data structure.</p>
172
+
173
+ </div><!-- description -->
174
+
175
+
176
+
177
+
178
+ <div id="5Buntitled-5D" class="documentation-section">
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+
187
+ <!-- Methods -->
188
+
189
+ <div id="public-class-method-details" class="method-section section">
190
+ <h3 class="section-header">Public Class Methods</h3>
191
+
192
+
193
+ <div id="create-method" class="method-detail ">
194
+ <a name="method-c-create"></a>
195
+
196
+
197
+ <div class="method-heading">
198
+ <span class="method-name">create</span><span
199
+ class="method-args">()</span>
200
+ <span class="method-click-advice">click to toggle source</span>
201
+ </div>
202
+
203
+
204
+ <div class="method-description">
205
+
206
+ <p>Create new queue.Internaly uses list to store elements.</p>
207
+
208
+
209
+
210
+ <div class="method-source-code" id="create-source">
211
+ <pre>
212
+ <span class="ruby-comment"># File ds/queues/queue.rb, line 17</span>
213
+ <span class="ruby-keyword">def</span> <span class="ruby-constant">Queue</span>.<span class="ruby-identifier">create</span>
214
+ <span class="ruby-identifier">new</span>(<span class="ruby-value">:list</span>)
215
+ <span class="ruby-keyword">end</span></pre>
216
+ </div><!-- create-source -->
217
+
218
+ </div>
219
+
220
+
221
+
222
+
223
+ </div><!-- create-method -->
224
+
225
+
226
+ <div id="new-method" class="method-detail ">
227
+ <a name="method-c-new"></a>
228
+
229
+
230
+ <div class="method-heading">
231
+ <span class="method-name">new</span><span
232
+ class="method-args">(store = :array)</span>
233
+ <span class="method-click-advice">click to toggle source</span>
234
+ </div>
235
+
236
+
237
+ <div class="method-description">
238
+
239
+ <p>Create new queue. First parameter determines how the queue will be
240
+ represented internally.</p>
241
+
242
+
243
+
244
+ <div class="method-source-code" id="new-source">
245
+ <pre>
246
+ <span class="ruby-comment"># File ds/queues/queue.rb, line 8</span>
247
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">store</span> = <span class="ruby-value">:array</span>)
248
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">store</span> <span class="ruby-operator">==</span> <span class="ruby-value">:array</span>
249
+ <span class="ruby-ivar">@store</span> = []
250
+ <span class="ruby-keyword">else</span>
251
+ <span class="ruby-ivar">@store</span> = <span class="ruby-constant">List</span>.<span class="ruby-identifier">new</span>
252
+ <span class="ruby-keyword">end</span>
253
+ <span class="ruby-keyword">end</span></pre>
254
+ </div><!-- new-source -->
255
+
256
+ </div>
257
+
258
+
259
+
260
+
261
+ </div><!-- new-method -->
262
+
263
+
264
+ </div><!-- public-class-method-details -->
265
+
266
+ <div id="public-instance-method-details" class="method-section section">
267
+ <h3 class="section-header">Public Instance Methods</h3>
268
+
269
+
270
+ <div id="dequeue-method" class="method-detail ">
271
+ <a name="method-i-dequeue"></a>
272
+
273
+
274
+ <div class="method-heading">
275
+ <span class="method-name">dequeue</span><span
276
+ class="method-args">()</span>
277
+ <span class="method-click-advice">click to toggle source</span>
278
+ </div>
279
+
280
+
281
+ <div class="method-description">
282
+
283
+ <p>Removes element from queue and returns it.</p>
284
+
285
+
286
+
287
+ <div class="method-source-code" id="dequeue-source">
288
+ <pre>
289
+ <span class="ruby-comment"># File ds/queues/queue.rb, line 30</span>
290
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">dequeue</span>
291
+ <span class="ruby-ivar">@store</span>.<span class="ruby-identifier">shift</span>
292
+ <span class="ruby-keyword">end</span></pre>
293
+ </div><!-- dequeue-source -->
294
+
295
+ </div>
296
+
297
+
298
+ <div class="aliases">
299
+ Also aliased as: <a href="Queue.html#method-i-shift">shift</a>
300
+ </div>
301
+
302
+
303
+
304
+ </div><!-- dequeue-method -->
305
+
306
+
307
+ <div id="empty-3F-method" class="method-detail ">
308
+ <a name="method-i-empty-3F"></a>
309
+
310
+
311
+ <div class="method-heading">
312
+ <span class="method-name">empty?</span><span
313
+ class="method-args">()</span>
314
+ <span class="method-click-advice">click to toggle source</span>
315
+ </div>
316
+
317
+
318
+ <div class="method-description">
319
+
320
+ <p>Checks if queue is empty.</p>
321
+
322
+
323
+
324
+ <div class="method-source-code" id="empty-3F-source">
325
+ <pre>
326
+ <span class="ruby-comment"># File ds/queues/queue.rb, line 47</span>
327
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">empty?</span>
328
+ <span class="ruby-ivar">@store</span>.<span class="ruby-identifier">empty?</span>
329
+ <span class="ruby-keyword">end</span></pre>
330
+ </div><!-- empty-3F-source -->
331
+
332
+ </div>
333
+
334
+
335
+
336
+
337
+ </div><!-- empty-3F-method -->
338
+
339
+
340
+ <div id="enqueue-method" class="method-detail ">
341
+ <a name="method-i-enqueue"></a>
342
+
343
+
344
+ <div class="method-heading">
345
+ <span class="method-name">enqueue</span><span
346
+ class="method-args">(x)</span>
347
+ <span class="method-click-advice">click to toggle source</span>
348
+ </div>
349
+
350
+
351
+ <div class="method-description">
352
+
353
+ <p>Adds element to queue and returns queue itself.</p>
354
+
355
+
356
+
357
+ <div class="method-source-code" id="enqueue-source">
358
+ <pre>
359
+ <span class="ruby-comment"># File ds/queues/queue.rb, line 22</span>
360
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">enqueue</span>(<span class="ruby-identifier">x</span>)
361
+ <span class="ruby-ivar">@store</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">x</span>
362
+ <span class="ruby-keyword">self</span>
363
+ <span class="ruby-keyword">end</span></pre>
364
+ </div><!-- enqueue-source -->
365
+
366
+ </div>
367
+
368
+
369
+ <div class="aliases">
370
+ Also aliased as: <a href="Queue.html#method-i-push">push</a>
371
+ </div>
372
+
373
+
374
+
375
+ </div><!-- enqueue-method -->
376
+
377
+
378
+ <div id="length-method" class="method-detail ">
379
+ <a name="method-i-length"></a>
380
+
381
+
382
+ <div class="method-heading">
383
+ <span class="method-name">length</span><span
384
+ class="method-args">()</span>
385
+ <span class="method-click-advice">click to toggle source</span>
386
+ </div>
387
+
388
+
389
+ <div class="method-description">
390
+
391
+ <p>Returns length of queue. If queue is empty returns 0.</p>
392
+
393
+
394
+
395
+ <div class="method-source-code" id="length-source">
396
+ <pre>
397
+ <span class="ruby-comment"># File ds/queues/queue.rb, line 42</span>
398
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">length</span>
399
+ <span class="ruby-ivar">@store</span>.<span class="ruby-identifier">length</span>
400
+ <span class="ruby-keyword">end</span></pre>
401
+ </div><!-- length-source -->
402
+
403
+ </div>
404
+
405
+
406
+
407
+
408
+ </div><!-- length-method -->
409
+
410
+
411
+ <div id="peek-method" class="method-detail ">
412
+ <a name="method-i-peek"></a>
413
+
414
+
415
+ <div class="method-heading">
416
+ <span class="method-name">peek</span><span
417
+ class="method-args">()</span>
418
+ <span class="method-click-advice">click to toggle source</span>
419
+ </div>
420
+
421
+
422
+ <div class="method-description">
423
+
424
+ <p>Returns element from forehead of queue.</p>
425
+
426
+
427
+
428
+ <div class="method-source-code" id="peek-source">
429
+ <pre>
430
+ <span class="ruby-comment"># File ds/queues/queue.rb, line 37</span>
431
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">peek</span>
432
+ <span class="ruby-ivar">@store</span>.<span class="ruby-identifier">first</span>
433
+ <span class="ruby-keyword">end</span></pre>
434
+ </div><!-- peek-source -->
435
+
436
+ </div>
437
+
438
+
439
+
440
+
441
+ </div><!-- peek-method -->
442
+
443
+
444
+ <div id="push-method" class="method-detail method-alias">
445
+ <a name="method-i-push"></a>
446
+
447
+
448
+ <div class="method-heading">
449
+ <span class="method-name">push</span><span
450
+ class="method-args">(x)</span>
451
+ <span class="method-click-advice">click to toggle source</span>
452
+ </div>
453
+
454
+
455
+ <div class="method-description">
456
+
457
+
458
+
459
+
460
+
461
+ </div>
462
+
463
+
464
+
465
+
466
+ <div class="aliases">
467
+ Alias for: <a href="Queue.html#method-i-enqueue">enqueue</a>
468
+ </div>
469
+
470
+ </div><!-- push-method -->
471
+
472
+
473
+ <div id="shift-method" class="method-detail method-alias">
474
+ <a name="method-i-shift"></a>
475
+
476
+
477
+ <div class="method-heading">
478
+ <span class="method-name">shift</span><span
479
+ class="method-args">()</span>
480
+ <span class="method-click-advice">click to toggle source</span>
481
+ </div>
482
+
483
+
484
+ <div class="method-description">
485
+
486
+
487
+
488
+
489
+
490
+ </div>
491
+
492
+
493
+
494
+
495
+ <div class="aliases">
496
+ Alias for: <a href="Queue.html#method-i-dequeue">dequeue</a>
497
+ </div>
498
+
499
+ </div><!-- shift-method -->
500
+
501
+
502
+ </div><!-- public-instance-method-details -->
503
+
504
+ </div><!-- 5Buntitled-5D -->
505
+
506
+
507
+ </div><!-- documentation -->
508
+
509
+ <div id="validator-badges">
510
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
511
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
512
+ Rdoc Generator</a> 2</small>.</p>
513
+ </div>
514
+
515
+ </body>
516
+ </html>
517
+