cmake build system: visiblity support for clang
[supercollider.git] / Help / Collections / IdentityDictionary.html
blobe12e0d228b227deffab4ca1121b0b067d7d0de37
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <meta http-equiv="Content-Style-Type" content="text/css">
6 <title></title>
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: #0000bf}
13 p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #bf0000}
14 p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #000000}
15 p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica}
16 p.p7 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco; min-height: 12.0px}
17 p.p8 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica}
18 p.p9 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica; min-height: 14.0px}
19 p.p10 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #0000bf}
20 p.p11 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 14.0px Helvetica}
21 p.p12 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 14.0px Helvetica; min-height: 17.0px}
22 p.p13 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco}
23 p.p14 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
24 span.s1 {font: 18.0px Helvetica}
25 span.s2 {color: #000000}
26 span.s3 {color: #0000bf}
27 span.s4 {color: #007300}
28 span.s5 {color: #0000bf}
29 span.s6 {color: #606060}
30 span.Apple-tab-span {white-space:pre}
31 </style>
32 </head>
33 <body>
34 <p class="p1"><span class="s1"><b>IdentityDictionary<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b></span><b>associative collection mapping keys to values</b></p>
35 <p class="p2"><br></p>
36 <p class="p2"><br></p>
37 <p class="p3"><span class="s2"><b>Inherits from: </b><a href="../Core/Object.html"><b>Object</b></a><b> : </b><a href="Collection.html"><b>Collection</b></a><b> : </b><a href="Set.html"><b>Set</b></a><b> : </b><a href="Dictionary.html"><b>Dictionary</b></a></span></p>
38 <p class="p2"><br></p>
39 <p class="p1">An IdentityDictionary is an associative collection mapping keys to values.<span class="Apple-converted-space"> </span></p>
40 <p class="p1">Keys match only if they are<b> identical objects</b>. (i.e. === returns true.)</p>
41 <p class="p1">(In Dictionary, keys match if they are equal valued. This makes IdentityDictionary faster than <a href="Dictionary.html"><span class="s3">Dictionary</span></a>)</p>
42 <p class="p1">The contents of a Dictionary are <b>unordered</b>.<span class="Apple-converted-space">  </span>You must not depend on the order of items in a Dictionary.</p>
43 <p class="p2"><br></p>
44 <p class="p1">See also: <a href="Environment.html"><span class="s3">Environment</span></a>, <a href="Event.html"><span class="s3">Event</span></a> (more method documentation in superclasses)</p>
45 <p class="p2"><br></p>
46 <p class="p1">Often, the subclass Event is used as an IdentityDictionary, because there is a syntactical shortcut:</p>
47 <p class="p2"><br></p>
48 <p class="p4"><span class="s2">a = (); </span>// return a new Event.</p>
49 <p class="p5">a.put(<span class="s4">\foo</span>, 2.718);</p>
50 <p class="p5">a.at(<span class="s4">\foo</span>);</p>
51 <p class="p2"><br></p>
52 <p class="p2"><br></p>
53 <p class="p6"><b>Creation / Class Methods</b></p>
54 <p class="p7"><br></p>
55 <p class="p8"><b><span class="Apple-tab-span"> </span>*new (n, proto, parent, know)</b></p>
56 <p class="p9"><b><span class="Apple-tab-span"> </span></b></p>
57 <p class="p9"><b><span class="Apple-tab-span"> </span></b></p>
58 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>The <b>parent</b> and <b>proto</b> instance variables allow additional IdentityDictionary's to provide<span class="Apple-converted-space"> </span></p>
59 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>default values. The precedence order for determining the value of a key is the IdentityDictionary,<span class="Apple-converted-space"> </span></p>
60 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>its prototype, its parent.</p>
61 <p class="p2"><br></p>
62 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>When the instance variable <b>know </b>is <b>true</b>, the IdentityDictionary responds to unknown messages<span class="Apple-converted-space"> </span></p>
63 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>by looking up the selector and evaluating the result with the dictionary as an argument.<span class="Apple-converted-space"> </span></p>
64 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>For example:</p>
65 <p class="p2"><br></p>
66 <p class="p10"><span class="s2"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>a = </span>IdentityDictionary<span class="s2">(know: </span>true<span class="s2">);</span></p>
67 <p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>a.put(<span class="s4">\foo</span>, { <span class="s5">| x |</span> (<span class="s6">"the argument is:"</span> + x).postln });</p>
68 <p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>a.foo;</p>
69 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
70 <p class="p7"><br></p>
71 <p class="p11"><b>Accessing Instance Variables</b></p>
72 <p class="p9"><span class="Apple-tab-span"> </span></p>
73 <p class="p8"><b><span class="Apple-tab-span"> </span>proto_(IdentityDictionary)</b></p>
74 <p class="p8"><b><span class="Apple-tab-span"> </span>proto</b></p>
75 <p class="p8"><b><span class="Apple-tab-span"> </span>parent_(IdentityDictionary)</b></p>
76 <p class="p8"><b><span class="Apple-tab-span"> </span>parent</b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
77 <p class="p8"><b><span class="Apple-tab-span"> </span>know_(flag)</b></p>
78 <p class="p8"><b><span class="Apple-tab-span"> </span>know</b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
79 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
80 <p class="p11"><b>Methods</b></p>
81 <p class="p12"><br></p>
82 <p class="p8"><span class="Apple-tab-span"> </span>IdentityDictionary reimplements the following methods of <a href="Dictionary.html"><span class="s3">Dictionary</span></a>:</p>
83 <p class="p9"><span class="Apple-tab-span"> </span></p>
84 <p class="p8"><b><span class="Apple-tab-span"> </span>at (key)</b></p>
85 <p class="p8"><b><span class="Apple-tab-span"> </span>put (key, value)</b></p>
86 <p class="p8"><b><span class="Apple-tab-span"> </span>includesKey (key)</b></p>
87 <p class="p8"><b><span class="Apple-tab-span"> </span>findKeyForValue (argValue)</b></p>
88 <p class="p8"><b><span class="Apple-tab-span"> </span>scanFor (argKey)</b></p>
89 <p class="p9"><br></p>
90 <p class="p9"><b><span class="Apple-tab-span"> </span></b></p>
91 <p class="p8"><b><span class="Apple-tab-span"> </span>putGet (key, newValue)</b></p>
92 <p class="p8"><b><span class="Apple-tab-span"> </span></b><span class="Apple-tab-span"> </span>sets key to newValue, returns the previous value of key</p>
93 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>g.cleanUpMethod;</p>
94 <p class="p7"><br></p>
95 <p class="p8"><span class="Apple-tab-span"> </span>The following three methods provide support for <a href="../Scheduling/Quant.html"><span class="s3">Quant</span></a></p>
96 <p class="p8"><b><span class="Apple-tab-span"> </span>nextTimeOnGrid (clock)</b></p>
97 <p class="p8"><b><span class="Apple-tab-span"> </span>asQuant</b></p>
98 <p class="p8"><b><span class="Apple-tab-span"> </span>timingOffset</b></p>
99 <p class="p7"><br></p>
100 <p class="p7"><br></p>
101 <p class="p11"><b>Examples</b></p>
102 <p class="p9"><br></p>
103 <p class="p8"><span class="Apple-tab-span"> </span>IdentityDictionary is often used to assign names to instances of a particular class.<span class="Apple-converted-space">  </span>For example,</p>
104 <p class="p8"><span class="Apple-tab-span"> </span>the proxy classes (<a href="../Libraries/JITLib/Patterns/Pdef.html"><span class="s3">Pdef</span></a>, <a href="../Libraries/JITLib/Patterns/Pdefn.html"><span class="s3">Pdefn</span></a>, <a href="../Libraries/JITLib/Patterns/Tdef.html"><span class="s3">Tdef</span></a>, <a href="../Libraries/JITLib/nodeproxy/Ndef.html"><span class="s3">Ndef</span></a>, <a href="../Libraries/JITLib/Patterns/Fdef.html"><span class="s3">Fdef</span></a>), SynthDefLib, and <a href="../Control/NodeWatcher.html"><span class="s3">NodeWatcher</span></a> all have class</p>
105 <p class="p8"><span class="Apple-tab-span"> </span>variables named <b>all </b>implemented as IdentityDictionary's.</p>
106 <p class="p9"><span class="Apple-tab-span"> </span></p>
107 <p class="p9"><span class="Apple-tab-span"> </span></p>
108 <p class="p9"><span class="Apple-tab-span"> </span></p>
109 <p class="p14"><br></p>
110 </body>
111 </html>