Subversion Repositories AndroidProjects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
356 chris 1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2
<!--NewPage-->
3
<HTML>
4
<HEAD>
5
<!-- Generated by javadoc (build 1.6.0_26) on Sun Jan 27 20:37:07 CET 2013 -->
6
<TITLE>
7
WindowedMean (libgdx API)
8
</TITLE>
9
 
10
<META NAME="date" CONTENT="2013-01-27">
11
 
12
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
13
 
14
<SCRIPT type="text/javascript">
15
function windowTitle()
16
{
17
    if (location.href.indexOf('is-external=true') == -1) {
18
        parent.document.title="WindowedMean (libgdx API)";
19
    }
20
}
21
</SCRIPT>
22
<NOSCRIPT>
23
</NOSCRIPT>
24
 
25
</HEAD>
26
 
27
<BODY BGCOLOR="white" onload="windowTitle();">
28
<HR>
29
 
30
 
31
<!-- ========= START OF TOP NAVBAR ======= -->
32
<A NAME="navbar_top"><!-- --></A>
33
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
34
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
35
<TR>
36
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
37
<A NAME="navbar_top_firstrow"><!-- --></A>
38
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
39
  <TR ALIGN="center" VALIGN="top">
40
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
41
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
42
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
43
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/WindowedMean.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
44
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
45
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
46
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
47
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
48
  </TR>
49
</TABLE>
50
</TD>
51
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
52
 
53
                                libgdx API
54
                                <style>
55
                                body, td, th { font-family:Helvetica, Tahoma, Arial, sans-serif; font-size:10pt }
56
                                pre, code, tt { font-size:9pt; font-family:Lucida Console, Courier New, sans-serif }
57
                                h1, h2, h3, .FrameTitleFont, .FrameHeadingFont, .TableHeadingColor font { font-size:105%;  font-weight:bold }
58
                                .TableHeadingColor { background:#EEEEFF; }
59
                                a { text-decoration:none }
60
                                a:hover { text-decoration:underline }
61
                                a:link, a:visited { color:blue }
62
                                table { border:0px }
63
                                .TableRowColor td:first-child { border-left:1px solid black }
64
                                .TableRowColor td { border:0px; border-bottom:1px solid black; border-right:1px solid black }
65
                                hr { border:0px; border-bottom:1px solid #333366; }
66
                                </style>
67
                        </EM>
68
</TD>
69
</TR>
70
 
71
<TR>
72
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
73
&nbsp;<A HREF="../../../../com/badlogic/gdx/math/Vector3.html" title="class in com.badlogic.gdx.math"><B>PREV CLASS</B></A>&nbsp;
74
&nbsp;NEXT CLASS</FONT></TD>
75
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
76
  <A HREF="../../../../index.html?com/badlogic/gdx/math/WindowedMean.html" target="_top"><B>FRAMES</B></A>  &nbsp;
77
&nbsp;<A HREF="WindowedMean.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
78
&nbsp;<SCRIPT type="text/javascript">
79
  <!--
80
  if(window==top) {
81
    document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
82
  }
83
  //-->
84
</SCRIPT>
85
<NOSCRIPT>
86
  <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
87
</NOSCRIPT>
88
 
89
 
90
</FONT></TD>
91
</TR>
92
<TR>
93
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
94
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
95
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
96
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
97
</TR>
98
</TABLE>
99
<A NAME="skip-navbar_top"></A>
100
<!-- ========= END OF TOP NAVBAR ========= -->
101
 
102
<HR>
103
<!-- ======== START OF CLASS DATA ======== -->
104
<H2>
105
<FONT SIZE="-1">
106
com.badlogic.gdx.math</FONT>
107
<BR>
108
Class WindowedMean</H2>
109
<PRE>
110
java.lang.Object
111
  <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>com.badlogic.gdx.math.WindowedMean</B>
112
</PRE>
113
<HR>
114
<DL>
115
<DT><PRE>public final class <B>WindowedMean</B><DT>extends java.lang.Object</DL>
116
</PRE>
117
 
118
<P>
119
A simple class keeping track of the mean of a stream of values within a certain window. the WindowedMean will only return a
120
 value in case enough data has been sampled. After enough data has been sampled the oldest sample will be replaced by the newest
121
 in case a new sample is added.
122
<P>
123
 
124
<P>
125
<DL>
126
<DT><B>Author:</B></DT>
127
  <DD>badlogicgames@gmail.com</DD>
128
</DL>
129
<HR>
130
 
131
<P>
132
 
133
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
134
 
135
<A NAME="constructor_summary"><!-- --></A>
136
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
137
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
138
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
139
<B>Constructor Summary</B></FONT></TH>
140
</TR>
141
<TR BGCOLOR="white" CLASS="TableRowColor">
142
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/WindowedMean.html#WindowedMean(int)">WindowedMean</A></B>(int&nbsp;window_size)</CODE>
143
 
144
<BR>
145
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;constructor, window_size specifies the number of samples we will continuously get the mean and variance from.</TD>
146
</TR>
147
</TABLE>
148
&nbsp;
149
<!-- ========== METHOD SUMMARY =========== -->
150
 
151
<A NAME="method_summary"><!-- --></A>
152
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
153
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
154
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
155
<B>Method Summary</B></FONT></TH>
156
</TR>
157
<TR BGCOLOR="white" CLASS="TableRowColor">
158
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
159
<CODE>&nbsp;void</CODE></FONT></TD>
160
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/WindowedMean.html#addValue(float)">addValue</A></B>(float&nbsp;value)</CODE>
161
 
162
<BR>
163
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;adds a new sample to this mean.</TD>
164
</TR>
165
<TR BGCOLOR="white" CLASS="TableRowColor">
166
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
167
<CODE>&nbsp;void</CODE></FONT></TD>
168
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/WindowedMean.html#clear()">clear</A></B>()</CODE>
169
 
170
<BR>
171
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;clears this WindowedMean.</TD>
172
</TR>
173
<TR BGCOLOR="white" CLASS="TableRowColor">
174
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
175
<CODE>&nbsp;float</CODE></FONT></TD>
176
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/WindowedMean.html#getLatest()">getLatest</A></B>()</CODE>
177
 
178
<BR>
179
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
180
</TR>
181
<TR BGCOLOR="white" CLASS="TableRowColor">
182
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
183
<CODE>&nbsp;float</CODE></FONT></TD>
184
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/WindowedMean.html#getMean()">getMean</A></B>()</CODE>
185
 
186
<BR>
187
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;returns the mean of the samples added to this instance.</TD>
188
</TR>
189
<TR BGCOLOR="white" CLASS="TableRowColor">
190
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
191
<CODE>&nbsp;float</CODE></FONT></TD>
192
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/WindowedMean.html#getOldest()">getOldest</A></B>()</CODE>
193
 
194
<BR>
195
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
196
</TR>
197
<TR BGCOLOR="white" CLASS="TableRowColor">
198
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
199
<CODE>&nbsp;boolean</CODE></FONT></TD>
200
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/WindowedMean.html#hasEnoughData()">hasEnoughData</A></B>()</CODE>
201
 
202
<BR>
203
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
204
</TR>
205
<TR BGCOLOR="white" CLASS="TableRowColor">
206
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
207
<CODE>&nbsp;float</CODE></FONT></TD>
208
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/WindowedMean.html#standardDeviation()">standardDeviation</A></B>()</CODE>
209
 
210
<BR>
211
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
212
</TR>
213
</TABLE>
214
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
215
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
216
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
217
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
218
</TR>
219
<TR BGCOLOR="white" CLASS="TableRowColor">
220
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
221
</TR>
222
</TABLE>
223
&nbsp;
224
<P>
225
 
226
<!-- ========= CONSTRUCTOR DETAIL ======== -->
227
 
228
<A NAME="constructor_detail"><!-- --></A>
229
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
230
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
231
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
232
<B>Constructor Detail</B></FONT></TH>
233
</TR>
234
</TABLE>
235
 
236
<A NAME="WindowedMean(int)"><!-- --></A><H3>
237
WindowedMean</H3>
238
<PRE>
239
public <B>WindowedMean</B>(int&nbsp;window_size)</PRE>
240
<DL>
241
<DD>constructor, window_size specifies the number of samples we will continuously get the mean and variance from. the class will
242
 only return meaning full values if at least window_size values have been added.
243
<P>
244
<DL>
245
<DT><B>Parameters:</B><DD><CODE>window_size</CODE> - size of the sample window</DL>
246
</DL>
247
 
248
<!-- ============ METHOD DETAIL ========== -->
249
 
250
<A NAME="method_detail"><!-- --></A>
251
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
252
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
253
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
254
<B>Method Detail</B></FONT></TH>
255
</TR>
256
</TABLE>
257
 
258
<A NAME="hasEnoughData()"><!-- --></A><H3>
259
hasEnoughData</H3>
260
<PRE>
261
public boolean <B>hasEnoughData</B>()</PRE>
262
<DL>
263
<DD><DL>
264
 
265
<DT><B>Returns:</B><DD>whether the value returned will be meaningfull</DL>
266
</DD>
267
</DL>
268
<HR>
269
 
270
<A NAME="clear()"><!-- --></A><H3>
271
clear</H3>
272
<PRE>
273
public void <B>clear</B>()</PRE>
274
<DL>
275
<DD>clears this WindowedMean. The class will only return meaningfull values after enough data has been added again.
276
<P>
277
<DD><DL>
278
</DL>
279
</DD>
280
</DL>
281
<HR>
282
 
283
<A NAME="addValue(float)"><!-- --></A><H3>
284
addValue</H3>
285
<PRE>
286
public void <B>addValue</B>(float&nbsp;value)</PRE>
287
<DL>
288
<DD>adds a new sample to this mean. in case the window is full the oldest value will be replaced by this new value.
289
<P>
290
<DD><DL>
291
<DT><B>Parameters:</B><DD><CODE>value</CODE> - The value to add</DL>
292
</DD>
293
</DL>
294
<HR>
295
 
296
<A NAME="getMean()"><!-- --></A><H3>
297
getMean</H3>
298
<PRE>
299
public float <B>getMean</B>()</PRE>
300
<DL>
301
<DD>returns the mean of the samples added to this instance. only returns meaningfull results when at least window_size samples
302
 as specified in the constructor have been added.
303
<P>
304
<DD><DL>
305
 
306
<DT><B>Returns:</B><DD>the mean</DL>
307
</DD>
308
</DL>
309
<HR>
310
 
311
<A NAME="getOldest()"><!-- --></A><H3>
312
getOldest</H3>
313
<PRE>
314
public float <B>getOldest</B>()</PRE>
315
<DL>
316
<DD><DL>
317
 
318
<DT><B>Returns:</B><DD>the oldest value in the window</DL>
319
</DD>
320
</DL>
321
<HR>
322
 
323
<A NAME="getLatest()"><!-- --></A><H3>
324
getLatest</H3>
325
<PRE>
326
public float <B>getLatest</B>()</PRE>
327
<DL>
328
<DD><DL>
329
 
330
<DT><B>Returns:</B><DD>the value last added</DL>
331
</DD>
332
</DL>
333
<HR>
334
 
335
<A NAME="standardDeviation()"><!-- --></A><H3>
336
standardDeviation</H3>
337
<PRE>
338
public float <B>standardDeviation</B>()</PRE>
339
<DL>
340
<DD><DL>
341
 
342
<DT><B>Returns:</B><DD>The standard deviation</DL>
343
</DD>
344
</DL>
345
<!-- ========= END OF CLASS DATA ========= -->
346
<HR>
347
 
348
 
349
<!-- ======= START OF BOTTOM NAVBAR ====== -->
350
<A NAME="navbar_bottom"><!-- --></A>
351
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
352
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
353
<TR>
354
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
355
<A NAME="navbar_bottom_firstrow"><!-- --></A>
356
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
357
  <TR ALIGN="center" VALIGN="top">
358
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
359
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
360
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
361
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/WindowedMean.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
362
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
363
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
364
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
365
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
366
  </TR>
367
</TABLE>
368
</TD>
369
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
370
libgdx API</EM>
371
</TD>
372
</TR>
373
 
374
<TR>
375
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
376
&nbsp;<A HREF="../../../../com/badlogic/gdx/math/Vector3.html" title="class in com.badlogic.gdx.math"><B>PREV CLASS</B></A>&nbsp;
377
&nbsp;NEXT CLASS</FONT></TD>
378
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
379
  <A HREF="../../../../index.html?com/badlogic/gdx/math/WindowedMean.html" target="_top"><B>FRAMES</B></A>  &nbsp;
380
&nbsp;<A HREF="WindowedMean.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
381
&nbsp;<SCRIPT type="text/javascript">
382
  <!--
383
  if(window==top) {
384
    document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
385
  }
386
  //-->
387
</SCRIPT>
388
<NOSCRIPT>
389
  <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
390
</NOSCRIPT>
391
 
392
 
393
</FONT></TD>
394
</TR>
395
<TR>
396
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
397
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
398
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
399
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
400
</TR>
401
</TABLE>
402
<A NAME="skip-navbar_bottom"></A>
403
<!-- ======== END OF BOTTOM NAVBAR ======= -->
404
 
405
<HR>
406
 
407
                                <div style="font-size:9pt"><i>
408
                                Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)
409
                                </i></div>
410
 
411
</BODY>
412
</HTML>