ds 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/README.rdoc +490 -0
- data/Rakefile +1 -1
- data/lib/ds.rb +17 -19
- data/lib/ds/ext/array_x.rb +35 -0
- data/lib/ds/graphs/graph.rb +36 -32
- data/lib/ds/graphs/graph_as_matrix.rb +22 -23
- data/lib/ds/graphs/graph_as_tri_matrix.rb +1 -2
- data/lib/ds/lists/list.rb +18 -21
- data/lib/ds/matrixes/array_2d.rb +4 -0
- data/lib/ds/pair.rb +14 -0
- data/lib/ds/queues/priority_queue.rb +36 -0
- data/lib/ds/queues/queue.rb +1 -1
- data/lib/ds/sets/ordered_set.rb +32 -0
- data/lib/ds/trees/binary_heap.rb +45 -14
- data/lib/ds/trees/binary_search_tree.rb +3 -1
- data/lib/ds/trees/binary_tree.rb +11 -5
- data/lib/ds/trees/complete_binary_tree.rb +24 -16
- data/lib/ds/trees/tree.rb +3 -3
- data/lib/ds/trees/tree_walker.rb +7 -6
- data/lib/ds/trees/trie.rb +14 -20
- data/lib/ds/version.rb +1 -1
- data/test/help.rb +12 -3
- data/test/test_array2d.rb +14 -4
- data/test/test_array_x.rb +27 -7
- data/test/test_binary_heap.rb +19 -1
- data/test/test_binary_search_tree.rb +8 -1
- data/test/test_binary_tree.rb +7 -1
- data/test/test_complete_binary_tree.rb +34 -6
- data/test/test_digraph.rb +1 -1
- data/test/test_graph.rb +10 -1
- data/test/test_list.rb +59 -2
- data/test/test_ordered_set.rb +28 -0
- data/test/test_pair.rb +26 -0
- data/test/test_priority_queue.rb +134 -0
- data/test/test_queue.rb +3 -3
- data/test/test_stack.rb +0 -2
- data/test/test_tree.rb +32 -9
- data/test/test_tree_walker.rb +22 -0
- data/test/test_trie.rb +20 -2
- metadata +13 -81
- data/doc/Array.html +0 -264
- data/doc/DS.html +0 -292
- data/doc/DS/Array2D.html +0 -345
- data/doc/DS/BinaryHeap.html +0 -493
- data/doc/DS/BinarySearchTree.html +0 -313
- data/doc/DS/BinaryTree.html +0 -433
- data/doc/DS/CompleteBinaryTree.html +0 -550
- data/doc/DS/CyclicList.html +0 -234
- data/doc/DS/Digraph.html +0 -299
- data/doc/DS/Edge.html +0 -283
- data/doc/DS/ExpandableArray.html +0 -316
- data/doc/DS/Graph.html +0 -739
- data/doc/DS/GraphAsList.html +0 -361
- data/doc/DS/GraphAsMatrix.html +0 -633
- data/doc/DS/GraphAsTriMatrix.html +0 -274
- data/doc/DS/List.html +0 -1263
- data/doc/DS/ListElement.html +0 -344
- data/doc/DS/Queue.html +0 -517
- data/doc/DS/Ring.html +0 -323
- data/doc/DS/Stack.html +0 -407
- data/doc/DS/Tree.html +0 -770
- data/doc/DS/TreeWalker.html +0 -561
- data/doc/DS/TriMatrix.html +0 -338
- data/doc/created.rid +0 -25
- data/doc/ds/graphs/digraph_rb.html +0 -52
- data/doc/ds/graphs/edge_rb.html +0 -52
- data/doc/ds/graphs/graph_as_list_rb.html +0 -52
- data/doc/ds/graphs/graph_as_matrix_rb.html +0 -52
- data/doc/ds/graphs/graph_as_tri_matrix_rb.html +0 -52
- data/doc/ds/graphs/graph_rb.html +0 -52
- data/doc/ds/lists/cyclic_list_rb.html +0 -52
- data/doc/ds/lists/list_element_rb.html +0 -52
- data/doc/ds/lists/list_rb.html +0 -52
- data/doc/ds/lists/ring_rb.html +0 -52
- data/doc/ds/matrixes/array_2d_rb.html +0 -52
- data/doc/ds/matrixes/expandable_array_rb.html +0 -52
- data/doc/ds/matrixes/tri_matrix_rb.html +0 -52
- data/doc/ds/queues/queue_rb.html +0 -52
- data/doc/ds/stacks/stack_rb.html +0 -52
- data/doc/ds/trees/binary_heap_rb.html +0 -52
- data/doc/ds/trees/binary_search_tree_rb.html +0 -52
- data/doc/ds/trees/binary_tree_rb.html +0 -52
- data/doc/ds/trees/complete_binary_tree_rb.html +0 -52
- data/doc/ds/trees/tree_rb.html +0 -52
- data/doc/ds/trees/tree_walker_rb.html +0 -52
- data/doc/ds/version_rb.html +0 -52
- data/doc/ds_rb.html +0 -98
- data/doc/ext/ext_rb.html +0 -52
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +0 -375
- data/doc/js/darkfish.js +0 -116
- data/doc/js/jquery.js +0 -32
- data/doc/js/quicksearch.js +0 -114
- data/doc/js/thickbox-compressed.js +0 -10
- data/doc/rdoc.css +0 -763
- data/lib/ds/ext/ext.rb +0 -36
- data/lib/ds/graphs/graph_as_list.rb +0 -48
data/doc/DS/Edge.html
DELETED
@@ -1,283 +0,0 @@
|
|
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::Edge</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/graphs/edge_rb.html?TB_iframe=true&height=550&width=785"
|
38
|
-
class="thickbox" title="ds/graphs/edge.rb">ds/graphs/edge.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
|
-
</ul>
|
71
|
-
</div>
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
</div>
|
76
|
-
|
77
|
-
<div id="project-metadata">
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
<div id="classindex-section" class="section project-section">
|
82
|
-
<h3 class="section-header">Class/Module Index
|
83
|
-
<span class="search-toggle"><img src="../images/find.png"
|
84
|
-
height="16" width="16" alt="[+]"
|
85
|
-
title="show/hide quicksearch" /></span></h3>
|
86
|
-
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
87
|
-
<fieldset>
|
88
|
-
<legend>Quicksearch</legend>
|
89
|
-
<input type="text" name="quicksearch" value=""
|
90
|
-
class="quicksearch-field" />
|
91
|
-
</fieldset>
|
92
|
-
</form>
|
93
|
-
|
94
|
-
<ul class="link-list">
|
95
|
-
|
96
|
-
<li><a href="../DS.html">DS</a></li>
|
97
|
-
|
98
|
-
<li><a href="../DS/Array2D.html">DS::Array2D</a></li>
|
99
|
-
|
100
|
-
<li><a href="../DS/BinaryHeap.html">DS::BinaryHeap</a></li>
|
101
|
-
|
102
|
-
<li><a href="../DS/BinarySearchTree.html">DS::BinarySearchTree</a></li>
|
103
|
-
|
104
|
-
<li><a href="../DS/BinaryTree.html">DS::BinaryTree</a></li>
|
105
|
-
|
106
|
-
<li><a href="../DS/CompleteBinaryTree.html">DS::CompleteBinaryTree</a></li>
|
107
|
-
|
108
|
-
<li><a href="../DS/CyclicList.html">DS::CyclicList</a></li>
|
109
|
-
|
110
|
-
<li><a href="../DS/Digraph.html">DS::Digraph</a></li>
|
111
|
-
|
112
|
-
<li><a href="../DS/Edge.html">DS::Edge</a></li>
|
113
|
-
|
114
|
-
<li><a href="../DS/ExpandableArray.html">DS::ExpandableArray</a></li>
|
115
|
-
|
116
|
-
<li><a href="../DS/Graph.html">DS::Graph</a></li>
|
117
|
-
|
118
|
-
<li><a href="../DS/GraphAsList.html">DS::GraphAsList</a></li>
|
119
|
-
|
120
|
-
<li><a href="../DS/GraphAsMatrix.html">DS::GraphAsMatrix</a></li>
|
121
|
-
|
122
|
-
<li><a href="../DS/GraphAsTriMatrix.html">DS::GraphAsTriMatrix</a></li>
|
123
|
-
|
124
|
-
<li><a href="../DS/List.html">DS::List</a></li>
|
125
|
-
|
126
|
-
<li><a href="../DS/ListElement.html">DS::ListElement</a></li>
|
127
|
-
|
128
|
-
<li><a href="../DS/Queue.html">DS::Queue</a></li>
|
129
|
-
|
130
|
-
<li><a href="../DS/Ring.html">DS::Ring</a></li>
|
131
|
-
|
132
|
-
<li><a href="../DS/Stack.html">DS::Stack</a></li>
|
133
|
-
|
134
|
-
<li><a href="../DS/Tree.html">DS::Tree</a></li>
|
135
|
-
|
136
|
-
<li><a href="../DS/TreeWalker.html">DS::TreeWalker</a></li>
|
137
|
-
|
138
|
-
<li><a href="../DS/TriMatrix.html">DS::TriMatrix</a></li>
|
139
|
-
|
140
|
-
<li><a href="../Array.html">Array</a></li>
|
141
|
-
|
142
|
-
</ul>
|
143
|
-
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
144
|
-
</div>
|
145
|
-
|
146
|
-
|
147
|
-
</div>
|
148
|
-
</div>
|
149
|
-
|
150
|
-
<div id="documentation">
|
151
|
-
<h1 class="class">DS::Edge</h1>
|
152
|
-
|
153
|
-
<div id="description" class="description">
|
154
|
-
|
155
|
-
</div><!-- description -->
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
<div id="5Buntitled-5D" class="documentation-section">
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
<!-- Attributes -->
|
169
|
-
<div id="attribute-method-details" class="method-section section">
|
170
|
-
<h3 class="section-header">Attributes</h3>
|
171
|
-
|
172
|
-
|
173
|
-
<div id="from-attribute-method" class="method-detail">
|
174
|
-
<a name="from"></a>
|
175
|
-
|
176
|
-
<a name="from="></a>
|
177
|
-
|
178
|
-
<div class="method-heading attribute-method-heading">
|
179
|
-
<span class="method-name">from</span><span
|
180
|
-
class="attribute-access-type">[RW]</span>
|
181
|
-
</div>
|
182
|
-
|
183
|
-
<div class="method-description">
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
</div>
|
188
|
-
</div>
|
189
|
-
|
190
|
-
<div id="to-attribute-method" class="method-detail">
|
191
|
-
<a name="to"></a>
|
192
|
-
|
193
|
-
<a name="to="></a>
|
194
|
-
|
195
|
-
<div class="method-heading attribute-method-heading">
|
196
|
-
<span class="method-name">to</span><span
|
197
|
-
class="attribute-access-type">[RW]</span>
|
198
|
-
</div>
|
199
|
-
|
200
|
-
<div class="method-description">
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
</div>
|
205
|
-
</div>
|
206
|
-
|
207
|
-
<div id="weight-attribute-method" class="method-detail">
|
208
|
-
<a name="weight"></a>
|
209
|
-
|
210
|
-
<a name="weight="></a>
|
211
|
-
|
212
|
-
<div class="method-heading attribute-method-heading">
|
213
|
-
<span class="method-name">weight</span><span
|
214
|
-
class="attribute-access-type">[RW]</span>
|
215
|
-
</div>
|
216
|
-
|
217
|
-
<div class="method-description">
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
</div>
|
222
|
-
</div>
|
223
|
-
|
224
|
-
</div><!-- attribute-method-details -->
|
225
|
-
|
226
|
-
|
227
|
-
<!-- Methods -->
|
228
|
-
|
229
|
-
<div id="public-class-method-details" class="method-section section">
|
230
|
-
<h3 class="section-header">Public Class Methods</h3>
|
231
|
-
|
232
|
-
|
233
|
-
<div id="new-method" class="method-detail ">
|
234
|
-
<a name="method-c-new"></a>
|
235
|
-
|
236
|
-
|
237
|
-
<div class="method-heading">
|
238
|
-
<span class="method-name">new</span><span
|
239
|
-
class="method-args">(from,to,weight=1)</span>
|
240
|
-
<span class="method-click-advice">click to toggle source</span>
|
241
|
-
</div>
|
242
|
-
|
243
|
-
|
244
|
-
<div class="method-description">
|
245
|
-
|
246
|
-
<p>Create new edge.</p>
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
<div class="method-source-code" id="new-source">
|
251
|
-
<pre>
|
252
|
-
<span class="ruby-comment"># File ds/graphs/edge.rb, line 7</span>
|
253
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">from</span>,<span class="ruby-identifier">to</span>,<span class="ruby-identifier">weight</span>=<span class="ruby-value">1</span>)
|
254
|
-
<span class="ruby-ivar">@from</span> = <span class="ruby-identifier">from</span>
|
255
|
-
<span class="ruby-ivar">@to</span> = <span class="ruby-identifier">to</span>
|
256
|
-
<span class="ruby-ivar">@weight</span> = <span class="ruby-identifier">weight</span>
|
257
|
-
<span class="ruby-keyword">end</span></pre>
|
258
|
-
</div><!-- new-source -->
|
259
|
-
|
260
|
-
</div>
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
</div><!-- new-method -->
|
266
|
-
|
267
|
-
|
268
|
-
</div><!-- public-class-method-details -->
|
269
|
-
|
270
|
-
</div><!-- 5Buntitled-5D -->
|
271
|
-
|
272
|
-
|
273
|
-
</div><!-- documentation -->
|
274
|
-
|
275
|
-
<div id="validator-badges">
|
276
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
277
|
-
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
278
|
-
Rdoc Generator</a> 2</small>.</p>
|
279
|
-
</div>
|
280
|
-
|
281
|
-
</body>
|
282
|
-
</html>
|
283
|
-
|
data/doc/DS/ExpandableArray.html
DELETED
@@ -1,316 +0,0 @@
|
|
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::ExpandableArray</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/matrixes/expandable_array_rb.html?TB_iframe=true&height=550&width=785"
|
38
|
-
class="thickbox" title="ds/matrixes/expandable_array.rb">ds/matrixes/expandable_array.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"><a href="../Array.html">Array</a></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-5B-5D">#[]</a></li>
|
71
|
-
|
72
|
-
<li><a href="#method-i-5B-5D-3D">#[]=</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::ExpandableArray</h1>
|
156
|
-
|
157
|
-
<div id="description" class="description">
|
158
|
-
|
159
|
-
<p>Class provides access to any element in array. If index i is greter than
|
160
|
-
array size then elements from size to i are filled with extender.</p>
|
161
|
-
|
162
|
-
</div><!-- description -->
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
<div id="5Buntitled-5D" class="documentation-section">
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
<!-- Methods -->
|
177
|
-
|
178
|
-
<div id="public-class-method-details" class="method-section section">
|
179
|
-
<h3 class="section-header">Public Class Methods</h3>
|
180
|
-
|
181
|
-
|
182
|
-
<div id="new-method" class="method-detail ">
|
183
|
-
<a name="method-c-new"></a>
|
184
|
-
|
185
|
-
|
186
|
-
<div class="method-heading">
|
187
|
-
<span class="method-name">new</span><span
|
188
|
-
class="method-args">(size=0,extender=0)</span>
|
189
|
-
<span class="method-click-advice">click to toggle source</span>
|
190
|
-
</div>
|
191
|
-
|
192
|
-
|
193
|
-
<div class="method-description">
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
<div class="method-source-code" id="new-source">
|
200
|
-
<pre>
|
201
|
-
<span class="ruby-comment"># File ds/matrixes/expandable_array.rb, line 7</span>
|
202
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">size</span>=<span class="ruby-value">0</span>,<span class="ruby-identifier">extender</span>=<span class="ruby-value">0</span>)
|
203
|
-
<span class="ruby-ivar">@extender</span> = <span class="ruby-identifier">extender</span>
|
204
|
-
<span class="ruby-keyword">super</span>(<span class="ruby-identifier">size</span>,<span class="ruby-identifier">extender</span>)
|
205
|
-
<span class="ruby-keyword">end</span></pre>
|
206
|
-
</div><!-- new-source -->
|
207
|
-
|
208
|
-
</div>
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
</div><!-- new-method -->
|
214
|
-
|
215
|
-
|
216
|
-
</div><!-- public-class-method-details -->
|
217
|
-
|
218
|
-
<div id="public-instance-method-details" class="method-section section">
|
219
|
-
<h3 class="section-header">Public Instance Methods</h3>
|
220
|
-
|
221
|
-
|
222
|
-
<div id="5B-5D-method" class="method-detail ">
|
223
|
-
<a name="method-i-5B-5D"></a>
|
224
|
-
|
225
|
-
|
226
|
-
<div class="method-heading">
|
227
|
-
<span class="method-name">[]</span><span
|
228
|
-
class="method-args">(x)</span>
|
229
|
-
<span class="method-click-advice">click to toggle source</span>
|
230
|
-
</div>
|
231
|
-
|
232
|
-
|
233
|
-
<div class="method-description">
|
234
|
-
|
235
|
-
<p>Returns element at index. If index is greater than size of array then
|
236
|
-
elements from size to index are filled with extender.</p>
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
<div class="method-source-code" id="5B-5D-source">
|
241
|
-
<pre>
|
242
|
-
<span class="ruby-comment"># File ds/matrixes/expandable_array.rb, line 14</span>
|
243
|
-
<span class="ruby-keyword">def</span> <span class="ruby-operator">[]</span>(<span class="ruby-identifier">x</span>)
|
244
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">x</span> <span class="ruby-operator">>=</span><span class="ruby-identifier">size</span>
|
245
|
-
<span class="ruby-keyword">for</span> <span class="ruby-identifier">i</span> <span class="ruby-keyword">in</span> <span class="ruby-identifier">size</span><span class="ruby-operator">..</span><span class="ruby-identifier">x</span>
|
246
|
-
<span class="ruby-keyword">self</span>[<span class="ruby-identifier">i</span>]=<span class="ruby-ivar">@extender</span>
|
247
|
-
<span class="ruby-keyword">end</span>
|
248
|
-
<span class="ruby-keyword">end</span>
|
249
|
-
<span class="ruby-keyword">super</span>(<span class="ruby-identifier">x</span>)
|
250
|
-
<span class="ruby-keyword">end</span></pre>
|
251
|
-
</div><!-- 5B-5D-source -->
|
252
|
-
|
253
|
-
</div>
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
</div><!-- 5B-5D-method -->
|
259
|
-
|
260
|
-
|
261
|
-
<div id="5B-5D-3D-method" class="method-detail ">
|
262
|
-
<a name="method-i-5B-5D-3D"></a>
|
263
|
-
|
264
|
-
|
265
|
-
<div class="method-heading">
|
266
|
-
<span class="method-name">[]=</span><span
|
267
|
-
class="method-args">(x,v)</span>
|
268
|
-
<span class="method-click-advice">click to toggle source</span>
|
269
|
-
</div>
|
270
|
-
|
271
|
-
|
272
|
-
<div class="method-description">
|
273
|
-
|
274
|
-
<p>Sets the element at index. If index is greater than size of array then
|
275
|
-
elements from size to index are filled with extender.</p>
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
<div class="method-source-code" id="5B-5D-3D-source">
|
280
|
-
<pre>
|
281
|
-
<span class="ruby-comment"># File ds/matrixes/expandable_array.rb, line 25</span>
|
282
|
-
<span class="ruby-keyword">def</span> <span class="ruby-operator">[]=</span>(<span class="ruby-identifier">x</span>,<span class="ruby-identifier">v</span>)
|
283
|
-
<span class="ruby-identifier">max</span> = <span class="ruby-identifier">size</span>
|
284
|
-
<span class="ruby-keyword">super</span>(<span class="ruby-identifier">x</span>,<span class="ruby-identifier">v</span>)
|
285
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">size</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">max</span> <span class="ruby-operator">></span><span class="ruby-value">1</span>
|
286
|
-
(<span class="ruby-identifier">max</span><span class="ruby-operator">..</span><span class="ruby-identifier">size</span><span class="ruby-operator">-</span><span class="ruby-value">2</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
|
287
|
-
<span class="ruby-keyword">self</span>[<span class="ruby-identifier">i</span>] = <span class="ruby-ivar">@extender</span>
|
288
|
-
<span class="ruby-keyword">end</span>
|
289
|
-
<span class="ruby-keyword">end</span>
|
290
|
-
<span class="ruby-keyword">end</span></pre>
|
291
|
-
</div><!-- 5B-5D-3D-source -->
|
292
|
-
|
293
|
-
</div>
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
</div><!-- 5B-5D-3D-method -->
|
299
|
-
|
300
|
-
|
301
|
-
</div><!-- public-instance-method-details -->
|
302
|
-
|
303
|
-
</div><!-- 5Buntitled-5D -->
|
304
|
-
|
305
|
-
|
306
|
-
</div><!-- documentation -->
|
307
|
-
|
308
|
-
<div id="validator-badges">
|
309
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
310
|
-
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
311
|
-
Rdoc Generator</a> 2</small>.</p>
|
312
|
-
</div>
|
313
|
-
|
314
|
-
</body>
|
315
|
-
</html>
|
316
|
-
|