1 <!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
4 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8">
5 <meta http-equiv=
"Content-Style-Type" content=
"text/css">
7 <meta name=
"Generator" content=
"Cocoa HTML Writer">
8 <meta name=
"CocoaVersion" content=
"949.43">
9 <style type=
"text/css">
10 p
.p1
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
}
11 p
.p2
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; min-height: 14.0px}
12 p
.p3
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; color: #0021e7}
13 p
.p4
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica
}
14 p
.p5
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica
; min-height: 14.0px}
15 p
.p6
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco
; color: #9d1c12}
16 p
.p7
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco
}
17 p
.p8
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco
; min-height: 12.0px}
18 p
.p9
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #9d1c12}
19 p
.p10
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; min-height: 12.0px}
20 p
.p11
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
}
21 span
.s1
{font: 18.0px Helvetica
}
22 span
.s2
{color: #000000}
23 span
.s3
{color: #0026b4}
24 span
.s4
{text-decoration: underline
}
25 span
.s5
{color: #9d1c12}
26 span
.s6
{color: #3d6d1d}
27 span
.Apple-tab-span
{white-space:pre
}
31 <p class=
"p1"><span class=
"s1"><b>Order
</b></span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>an order of elements with a numerical index
</b></p>
32 <p class=
"p2"><br></p>
33 <p class=
"p3"><span class=
"s2"><b>Inherits from:
</b><a href=
"../Core/Object.html"><span class=
"s3"><b>Object
</b></span></a><b> :
</b><a href=
"Collection.html"><b>Collection
</b></a><b> :
</b><a href=
"SequenceableCollection.html"><b>SequenceableCollection
</b></a></span></p>
34 <p class=
"p2"><br></p>
35 <p class=
"p2"><br></p>
36 <p class=
"p1">Keeps elements in an order and allows to put them at arbitrary slots
<span class=
"Apple-converted-space"> </span></p>
37 <p class=
"p1">without having to allocate a large array.
<span class=
"Apple-converted-space"> </span></p>
38 <p class=
"p2"><br></p>
39 <p class=
"p3"><span class=
"s2">see also:
<a href=
"SparseArray.html"><span class=
"s4">SparseArray
</span></a></span></p>
40 <p class=
"p2"><br></p>
41 <p class=
"p1">Note:
<b>put
</b> and
<b>at
</b> are slower than in IdentityDictionary / PriorityQueue,
<b>do
</b> is faster.
</p>
42 <p class=
"p2"><br></p>
43 <p class=
"p2"><br></p>
44 <p class=
"p4"><b>*new(size)
</b></p>
45 <p class=
"p4"><b><span class=
"Apple-tab-span"> </span></b><span class=
"Apple-tab-span"> </span>create a new order.
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
46 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
47 <p class=
"p6"><span class=
"s2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>//
<span class=
"Apple-converted-space"> </span>example
</p>
48 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g =
<span class=
"s3">Order
</span>.new;
</p>
49 <p class=
"p6"><span class=
"s2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g.put(
7,
100);
</span>// put a value (
100) at index
7</p>
50 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g.clear;
<span class=
"s5">// empty
</span></p>
51 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
52 <p class=
"p1"><b>*newFromIndices(array, indices)
</b></p>
53 <p class=
"p4"><b><span class=
"Apple-tab-span"> </span></b><span class=
"Apple-tab-span"> </span>create a new order from given items and indices
</p>
54 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
55 <p class=
"p5"><br></p>
56 <p class=
"p4"><b>*doRange(function, from to)
</b></p>
57 <p class=
"p4"><b><span class=
"Apple-tab-span"> </span></b><span class=
"Apple-tab-span"> </span>iterate over a range of the order's items.
</p>
58 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
59 <p class=
"p5"><br></p>
60 <p class=
"p2"><br></p>
61 <p class=
"p9">// example
</p>
62 <p class=
"p10"><br></p>
63 <p class=
"p11">a =
<span class=
"s3">Order
</span>.new;
</p>
64 <p class=
"p10"><br></p>
65 <p class=
"p11">a[
0] =
<span class=
"s6">\z
</span>;
</p>
66 <p class=
"p11">a[
0] =
<span class=
"s6">\y
</span>;
</p>
67 <p class=
"p11">a[
5] =
<span class=
"s6">\five
</span>;
</p>
68 <p class=
"p11">a[
4] =
<span class=
"s6">\four
</span>;
</p>
69 <p class=
"p10"><br></p>
70 <p class=
"p11">a[
0] =
<span class=
"s6">\z
</span>;
</p>
71 <p class=
"p11">a[
5] =
<span class=
"s6">\five
</span>;
</p>
72 <p class=
"p11">a[
4] =
<span class=
"s6">\four
</span>;
</p>
73 <p class=
"p10"><br></p>
74 <p class=
"p11">a.indices;
</p>
75 <p class=
"p10"><br></p>
76 <p class=
"p11">a[
9] =
100;
</p>
77 <p class=
"p11">a.indices;
</p>
78 <p class=
"p10"><br></p>
79 <p class=
"p10"><br></p>