linux: shared memory interface - link with librt
[supercollider.git] / HelpSource / Classes / Order.schelp
blob7d998ddbda2607d45dfd75c50e4d85f7a53ddebd
1 CLASS::Order
2 summary::an order of elements with a numerical index
3 related::Classes/SparseArray
4 categories:: Collections>Ordered
6 DESCRIPTION::
7 Keeps elements in an order and allows to put them at arbitrary slots
8 without having to allocate a large array.
10 note::
11 link::#-put:: and link::#-at:: are slower than in link::Classes/IdentityDictionary:: / link::Classes/PriorityQueue::, link::#-do:: is faster.
14 CLASSMETHODS::
16 method::new
17 Create a new order.
18 code::
19 g = Order.new;
20 g.put(7, 100); // put a value (100) at index 7
21 g.clear; // empty
24 method::newFromIndices
25 Create a new order from given items and indices.
27 INSTANCEMETHODS::
29 private::resetIndices, nextSlotFor, slotFor, prPutSlot
31 method::doRange
32 Iterate over a range of the order's items.
34 method::pos
35 Return the current write position.
37 EXAMPLES::
39 code::
40 a = Order.new;
42 a[0] = \z;
43 a[0] = \y;
44 a[5] = \five;
45 a[4] = \four;
47 a[0] = \z;
48 a[5] = \five;
49 a[4] = \four;
51 a.indices;
53 a[9] = 100;
54 a.indices;