Subversion Repositories AndroidProjects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1107 chris 1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2
<!-- NewPage -->
3
<html lang="en">
4
<head>
5
<!-- Generated by javadoc (version 1.7.0_17) on Sun Nov 03 15:35:44 CET 2013 -->
6
<title>Pool (libgdx API)</title>
7
<meta name="date" content="2013-11-03">
8
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
9
</head>
10
<body>
11
<script type="text/javascript"><!--
12
    if (location.href.indexOf('is-external=true') == -1) {
13
        parent.document.title="Pool (libgdx API)";
14
    }
15
//-->
16
</script>
17
<noscript>
18
<div>JavaScript is disabled on your browser.</div>
19
</noscript>
20
<!-- ========= START OF TOP NAVBAR ======= -->
21
<div class="topNav"><a name="navbar_top">
22
<!--   -->
23
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
24
<!--   -->
25
</a>
26
<ul class="navList" title="Navigation">
27
<li><a href="../../../../overview-summary.html">Overview</a></li>
28
<li><a href="package-summary.html">Package</a></li>
29
<li class="navBarCell1Rev">Class</li>
30
<li><a href="class-use/Pool.html">Use</a></li>
31
<li><a href="package-tree.html">Tree</a></li>
32
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
33
<li><a href="../../../../index-all.html">Index</a></li>
34
<li><a href="../../../../help-doc.html">Help</a></li>
35
</ul>
36
<div class="aboutLanguage"><em>
37
                                libgdx API
38
                                <style>
39
                                body, td, th { font-family:Helvetica, Tahoma, Arial, sans-serif; font-size:10pt }
40
                                pre, code, tt { font-size:9pt; font-family:Lucida Console, Courier New, sans-serif }
41
                                h1, h2, h3, .FrameTitleFont, .FrameHeadingFont, .TableHeadingColor font { font-size:105%;  font-weight:bold }
42
                                .TableHeadingColor { background:#EEEEFF; }
43
                                a { text-decoration:none }
44
                                a:hover { text-decoration:underline }
45
                                a:link, a:visited { color:blue }
46
                                table { border:0px }
47
                                .TableRowColor td:first-child { border-left:1px solid black }
48
                                .TableRowColor td { border:0px; border-bottom:1px solid black; border-right:1px solid black }
49
                                hr { border:0px; border-bottom:1px solid #333366; }
50
                                </style>
51
                        </em></div>
52
</div>
53
<div class="subNav">
54
<ul class="navList">
55
<li><a href="../../../../com/badlogic/gdx/utils/PerformanceCounters.html" title="class in com.badlogic.gdx.utils"><span class="strong">Prev Class</span></a></li>
56
<li><a href="../../../../com/badlogic/gdx/utils/Pool.Poolable.html" title="interface in com.badlogic.gdx.utils"><span class="strong">Next Class</span></a></li>
57
</ul>
58
<ul class="navList">
59
<li><a href="../../../../index.html?com/badlogic/gdx/utils/Pool.html" target="_top">Frames</a></li>
60
<li><a href="Pool.html" target="_top">No Frames</a></li>
61
</ul>
62
<ul class="navList" id="allclasses_navbar_top">
63
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
64
</ul>
65
<div>
66
<script type="text/javascript"><!--
67
  allClassesLink = document.getElementById("allclasses_navbar_top");
68
  if(window==top) {
69
    allClassesLink.style.display = "block";
70
  }
71
  else {
72
    allClassesLink.style.display = "none";
73
  }
74
  //-->
75
</script>
76
</div>
77
<div>
78
<ul class="subNavList">
79
<li>Summary:&nbsp;</li>
80
<li><a href="#nested_class_summary">Nested</a>&nbsp;|&nbsp;</li>
81
<li><a href="#field_summary">Field</a>&nbsp;|&nbsp;</li>
82
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
83
<li><a href="#method_summary">Method</a></li>
84
</ul>
85
<ul class="subNavList">
86
<li>Detail:&nbsp;</li>
87
<li><a href="#field_detail">Field</a>&nbsp;|&nbsp;</li>
88
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
89
<li><a href="#method_detail">Method</a></li>
90
</ul>
91
</div>
92
<a name="skip-navbar_top">
93
<!--   -->
94
</a></div>
95
<!-- ========= END OF TOP NAVBAR ========= -->
96
<!-- ======== START OF CLASS DATA ======== -->
97
<div class="header">
98
<div class="subTitle">com.badlogic.gdx.utils</div>
99
<h2 title="Class Pool" class="title">Class Pool&lt;T&gt;</h2>
100
</div>
101
<div class="contentContainer">
102
<ul class="inheritance">
103
<li>java.lang.Object</li>
104
<li>
105
<ul class="inheritance">
106
<li>com.badlogic.gdx.utils.Pool&lt;T&gt;</li>
107
</ul>
108
</li>
109
</ul>
110
<div class="description">
111
<ul class="blockList">
112
<li class="blockList">
113
<dl>
114
<dt>Direct Known Subclasses:</dt>
115
<dd><a href="../../../../com/badlogic/gdx/graphics/g2d/ParticleEffectPool.html" title="class in com.badlogic.gdx.graphics.g2d">ParticleEffectPool</a>, <a href="../../../../com/badlogic/gdx/utils/ReflectionPool.html" title="class in com.badlogic.gdx.utils">ReflectionPool</a></dd>
116
</dl>
117
<hr>
118
<br>
119
<pre>public abstract class <span class="strong">Pool&lt;T&gt;</span>
120
extends java.lang.Object</pre>
121
<div class="block">A pool of objects that can be reused to avoid allocation.</div>
122
<dl><dt><span class="strong">Author:</span></dt>
123
  <dd>Nathan Sweet</dd></dl>
124
</li>
125
</ul>
126
</div>
127
<div class="summary">
128
<ul class="blockList">
129
<li class="blockList">
130
<!-- ======== NESTED CLASS SUMMARY ======== -->
131
<ul class="blockList">
132
<li class="blockList"><a name="nested_class_summary">
133
<!--   -->
134
</a>
135
<h3>Nested Class Summary</h3>
136
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Nested Class Summary table, listing nested classes, and an explanation">
137
<caption><span>Nested Classes</span><span class="tabEnd">&nbsp;</span></caption>
138
<tr>
139
<th class="colFirst" scope="col">Modifier and Type</th>
140
<th class="colLast" scope="col">Class and Description</th>
141
</tr>
142
<tr class="altColor">
143
<td class="colFirst"><code>static interface&nbsp;</code></td>
144
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/utils/Pool.Poolable.html" title="interface in com.badlogic.gdx.utils">Pool.Poolable</a></strong></code>
145
<div class="block">Objects implementing this interface will have <a href="../../../../com/badlogic/gdx/utils/Pool.Poolable.html#reset()"><code>Pool.Poolable.reset()</code></a> called when passed to <a href="../../../../com/badlogic/gdx/utils/Pool.html#free(T)"><code>free(Object)</code></a>.</div>
146
</td>
147
</tr>
148
</table>
149
</li>
150
</ul>
151
<!-- =========== FIELD SUMMARY =========== -->
152
<ul class="blockList">
153
<li class="blockList"><a name="field_summary">
154
<!--   -->
155
</a>
156
<h3>Field Summary</h3>
157
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
158
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
159
<tr>
160
<th class="colFirst" scope="col">Modifier and Type</th>
161
<th class="colLast" scope="col">Field and Description</th>
162
</tr>
163
<tr class="altColor">
164
<td class="colFirst"><code>int</code></td>
165
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/utils/Pool.html#max">max</a></strong></code>
166
<div class="block">The maximum number of objects that will be pooled.</div>
167
</td>
168
</tr>
169
<tr class="rowColor">
170
<td class="colFirst"><code>int</code></td>
171
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/utils/Pool.html#peak">peak</a></strong></code>
172
<div class="block">The highest number of free objects.</div>
173
</td>
174
</tr>
175
</table>
176
</li>
177
</ul>
178
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
179
<ul class="blockList">
180
<li class="blockList"><a name="constructor_summary">
181
<!--   -->
182
</a>
183
<h3>Constructor Summary</h3>
184
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
185
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
186
<tr>
187
<th class="colOne" scope="col">Constructor and Description</th>
188
</tr>
189
<tr class="altColor">
190
<td class="colOne"><code><strong><a href="../../../../com/badlogic/gdx/utils/Pool.html#Pool()">Pool</a></strong>()</code>
191
<div class="block">Creates a pool with an initial capacity of 16 and no maximum.</div>
192
</td>
193
</tr>
194
<tr class="rowColor">
195
<td class="colOne"><code><strong><a href="../../../../com/badlogic/gdx/utils/Pool.html#Pool(int)">Pool</a></strong>(int&nbsp;initialCapacity)</code>
196
<div class="block">Creates a pool with the specified initial capacity and no maximum.</div>
197
</td>
198
</tr>
199
<tr class="altColor">
200
<td class="colOne"><code><strong><a href="../../../../com/badlogic/gdx/utils/Pool.html#Pool(int, int)">Pool</a></strong>(int&nbsp;initialCapacity,
201
    int&nbsp;max)</code>&nbsp;</td>
202
</tr>
203
</table>
204
</li>
205
</ul>
206
<!-- ========== METHOD SUMMARY =========== -->
207
<ul class="blockList">
208
<li class="blockList"><a name="method_summary">
209
<!--   -->
210
</a>
211
<h3>Method Summary</h3>
212
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
213
<caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
214
<tr>
215
<th class="colFirst" scope="col">Modifier and Type</th>
216
<th class="colLast" scope="col">Method and Description</th>
217
</tr>
218
<tr class="altColor">
219
<td class="colFirst"><code>void</code></td>
220
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/utils/Pool.html#clear()">clear</a></strong>()</code>
221
<div class="block">Removes all free objects from this pool.</div>
222
</td>
223
</tr>
224
<tr class="rowColor">
225
<td class="colFirst"><code>void</code></td>
226
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/utils/Pool.html#free(T)">free</a></strong>(<a href="../../../../com/badlogic/gdx/utils/Pool.html" title="type parameter in Pool">T</a>&nbsp;object)</code>
227
<div class="block">Puts the specified object in the pool, making it eligible to be returned by <a href="../../../../com/badlogic/gdx/utils/Pool.html#obtain()"><code>obtain()</code></a>.</div>
228
</td>
229
</tr>
230
<tr class="altColor">
231
<td class="colFirst"><code>void</code></td>
232
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/utils/Pool.html#freeAll(com.badlogic.gdx.utils.Array)">freeAll</a></strong>(<a href="../../../../com/badlogic/gdx/utils/Array.html" title="class in com.badlogic.gdx.utils">Array</a>&lt;<a href="../../../../com/badlogic/gdx/utils/Pool.html" title="type parameter in Pool">T</a>&gt;&nbsp;objects)</code>
233
<div class="block">Puts the specified objects in the pool.</div>
234
</td>
235
</tr>
236
<tr class="rowColor">
237
<td class="colFirst"><code>int</code></td>
238
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/utils/Pool.html#getFree()">getFree</a></strong>()</code>
239
<div class="block">The number of objects available to be obtained.</div>
240
</td>
241
</tr>
242
<tr class="altColor">
243
<td class="colFirst"><code>protected abstract <a href="../../../../com/badlogic/gdx/utils/Pool.html" title="type parameter in Pool">T</a></code></td>
244
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/utils/Pool.html#newObject()">newObject</a></strong>()</code>&nbsp;</td>
245
</tr>
246
<tr class="rowColor">
247
<td class="colFirst"><code><a href="../../../../com/badlogic/gdx/utils/Pool.html" title="type parameter in Pool">T</a></code></td>
248
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/utils/Pool.html#obtain()">obtain</a></strong>()</code>
249
<div class="block">Returns an object from this pool.</div>
250
</td>
251
</tr>
252
</table>
253
<ul class="blockList">
254
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
255
<!--   -->
256
</a>
257
<h3>Methods inherited from class&nbsp;java.lang.Object</h3>
258
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
259
</ul>
260
</li>
261
</ul>
262
</li>
263
</ul>
264
</div>
265
<div class="details">
266
<ul class="blockList">
267
<li class="blockList">
268
<!-- ============ FIELD DETAIL =========== -->
269
<ul class="blockList">
270
<li class="blockList"><a name="field_detail">
271
<!--   -->
272
</a>
273
<h3>Field Detail</h3>
274
<a name="max">
275
<!--   -->
276
</a>
277
<ul class="blockList">
278
<li class="blockList">
279
<h4>max</h4>
280
<pre>public final&nbsp;int max</pre>
281
<div class="block">The maximum number of objects that will be pooled.</div>
282
</li>
283
</ul>
284
<a name="peak">
285
<!--   -->
286
</a>
287
<ul class="blockListLast">
288
<li class="blockList">
289
<h4>peak</h4>
290
<pre>public&nbsp;int peak</pre>
291
<div class="block">The highest number of free objects. Can be reset any time.</div>
292
</li>
293
</ul>
294
</li>
295
</ul>
296
<!-- ========= CONSTRUCTOR DETAIL ======== -->
297
<ul class="blockList">
298
<li class="blockList"><a name="constructor_detail">
299
<!--   -->
300
</a>
301
<h3>Constructor Detail</h3>
302
<a name="Pool()">
303
<!--   -->
304
</a>
305
<ul class="blockList">
306
<li class="blockList">
307
<h4>Pool</h4>
308
<pre>public&nbsp;Pool()</pre>
309
<div class="block">Creates a pool with an initial capacity of 16 and no maximum.</div>
310
</li>
311
</ul>
312
<a name="Pool(int)">
313
<!--   -->
314
</a>
315
<ul class="blockList">
316
<li class="blockList">
317
<h4>Pool</h4>
318
<pre>public&nbsp;Pool(int&nbsp;initialCapacity)</pre>
319
<div class="block">Creates a pool with the specified initial capacity and no maximum.</div>
320
</li>
321
</ul>
322
<a name="Pool(int, int)">
323
<!--   -->
324
</a>
325
<ul class="blockListLast">
326
<li class="blockList">
327
<h4>Pool</h4>
328
<pre>public&nbsp;Pool(int&nbsp;initialCapacity,
329
    int&nbsp;max)</pre>
330
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>max</code> - The maximum number of free objects to store in this pool.</dd></dl>
331
</li>
332
</ul>
333
</li>
334
</ul>
335
<!-- ============ METHOD DETAIL ========== -->
336
<ul class="blockList">
337
<li class="blockList"><a name="method_detail">
338
<!--   -->
339
</a>
340
<h3>Method Detail</h3>
341
<a name="newObject()">
342
<!--   -->
343
</a>
344
<ul class="blockList">
345
<li class="blockList">
346
<h4>newObject</h4>
347
<pre>protected abstract&nbsp;<a href="../../../../com/badlogic/gdx/utils/Pool.html" title="type parameter in Pool">T</a>&nbsp;newObject()</pre>
348
</li>
349
</ul>
350
<a name="obtain()">
351
<!--   -->
352
</a>
353
<ul class="blockList">
354
<li class="blockList">
355
<h4>obtain</h4>
356
<pre>public&nbsp;<a href="../../../../com/badlogic/gdx/utils/Pool.html" title="type parameter in Pool">T</a>&nbsp;obtain()</pre>
357
<div class="block">Returns an object from this pool. The object may be new (from <a href="../../../../com/badlogic/gdx/utils/Pool.html#newObject()"><code>newObject()</code></a>) or reused (previously
358
 <a href="../../../../com/badlogic/gdx/utils/Pool.html#free(T)"><code>freed</code></a>).</div>
359
</li>
360
</ul>
361
<a name="free(java.lang.Object)">
362
<!--   -->
363
</a><a name="free(T)">
364
<!--   -->
365
</a>
366
<ul class="blockList">
367
<li class="blockList">
368
<h4>free</h4>
369
<pre>public&nbsp;void&nbsp;free(<a href="../../../../com/badlogic/gdx/utils/Pool.html" title="type parameter in Pool">T</a>&nbsp;object)</pre>
370
<div class="block">Puts the specified object in the pool, making it eligible to be returned by <a href="../../../../com/badlogic/gdx/utils/Pool.html#obtain()"><code>obtain()</code></a>. If the pool already contains
371
 <a href="../../../../com/badlogic/gdx/utils/Pool.html#max"><code>max</code></a> free objects, the specified object is reset but not added to the pool.</div>
372
</li>
373
</ul>
374
<a name="freeAll(com.badlogic.gdx.utils.Array)">
375
<!--   -->
376
</a>
377
<ul class="blockList">
378
<li class="blockList">
379
<h4>freeAll</h4>
380
<pre>public&nbsp;void&nbsp;freeAll(<a href="../../../../com/badlogic/gdx/utils/Array.html" title="class in com.badlogic.gdx.utils">Array</a>&lt;<a href="../../../../com/badlogic/gdx/utils/Pool.html" title="type parameter in Pool">T</a>&gt;&nbsp;objects)</pre>
381
<div class="block">Puts the specified objects in the pool. Null objects within the array are silently ignored.</div>
382
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../com/badlogic/gdx/utils/Pool.html#free(T)"><code>free(Object)</code></a></dd></dl>
383
</li>
384
</ul>
385
<a name="clear()">
386
<!--   -->
387
</a>
388
<ul class="blockList">
389
<li class="blockList">
390
<h4>clear</h4>
391
<pre>public&nbsp;void&nbsp;clear()</pre>
392
<div class="block">Removes all free objects from this pool.</div>
393
</li>
394
</ul>
395
<a name="getFree()">
396
<!--   -->
397
</a>
398
<ul class="blockListLast">
399
<li class="blockList">
400
<h4>getFree</h4>
401
<pre>public&nbsp;int&nbsp;getFree()</pre>
402
<div class="block">The number of objects available to be obtained.</div>
403
</li>
404
</ul>
405
</li>
406
</ul>
407
</li>
408
</ul>
409
</div>
410
</div>
411
<!-- ========= END OF CLASS DATA ========= -->
412
<!-- ======= START OF BOTTOM NAVBAR ====== -->
413
<div class="bottomNav"><a name="navbar_bottom">
414
<!--   -->
415
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
416
<!--   -->
417
</a>
418
<ul class="navList" title="Navigation">
419
<li><a href="../../../../overview-summary.html">Overview</a></li>
420
<li><a href="package-summary.html">Package</a></li>
421
<li class="navBarCell1Rev">Class</li>
422
<li><a href="class-use/Pool.html">Use</a></li>
423
<li><a href="package-tree.html">Tree</a></li>
424
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
425
<li><a href="../../../../index-all.html">Index</a></li>
426
<li><a href="../../../../help-doc.html">Help</a></li>
427
</ul>
428
<div class="aboutLanguage"><em>libgdx API</em></div>
429
</div>
430
<div class="subNav">
431
<ul class="navList">
432
<li><a href="../../../../com/badlogic/gdx/utils/PerformanceCounters.html" title="class in com.badlogic.gdx.utils"><span class="strong">Prev Class</span></a></li>
433
<li><a href="../../../../com/badlogic/gdx/utils/Pool.Poolable.html" title="interface in com.badlogic.gdx.utils"><span class="strong">Next Class</span></a></li>
434
</ul>
435
<ul class="navList">
436
<li><a href="../../../../index.html?com/badlogic/gdx/utils/Pool.html" target="_top">Frames</a></li>
437
<li><a href="Pool.html" target="_top">No Frames</a></li>
438
</ul>
439
<ul class="navList" id="allclasses_navbar_bottom">
440
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
441
</ul>
442
<div>
443
<script type="text/javascript"><!--
444
  allClassesLink = document.getElementById("allclasses_navbar_bottom");
445
  if(window==top) {
446
    allClassesLink.style.display = "block";
447
  }
448
  else {
449
    allClassesLink.style.display = "none";
450
  }
451
  //-->
452
</script>
453
</div>
454
<div>
455
<ul class="subNavList">
456
<li>Summary:&nbsp;</li>
457
<li><a href="#nested_class_summary">Nested</a>&nbsp;|&nbsp;</li>
458
<li><a href="#field_summary">Field</a>&nbsp;|&nbsp;</li>
459
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
460
<li><a href="#method_summary">Method</a></li>
461
</ul>
462
<ul class="subNavList">
463
<li>Detail:&nbsp;</li>
464
<li><a href="#field_detail">Field</a>&nbsp;|&nbsp;</li>
465
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
466
<li><a href="#method_detail">Method</a></li>
467
</ul>
468
</div>
469
<a name="skip-navbar_bottom">
470
<!--   -->
471
</a></div>
472
<!-- ======== END OF BOTTOM NAVBAR ======= -->
473
<p class="legalCopy"><small>
474
                                <div style="font-size:9pt"><i>
475
                                Copyright &copy; 2010-2013 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)
476
                                </i></div>
477
                        </small></p>
478
</body>
479
</html>