com.threerings.tudey.util
Class TruncatedAverage

java.lang.Object
  extended by com.threerings.media.util.TrailingAverage
      extended by com.threerings.tudey.util.TruncatedAverage

public class TruncatedAverage
extends TrailingAverage

Like TrailingAverage, but attempts to exclude outliers (caused by periodic garbage collection, e.g.) by removing the lowest and highest values.


Field Summary
protected  int _omitHighest
          The number of values to omit on the lower and higher ends.
protected  int _omitLowest
          The number of values to omit on the lower and higher ends.
protected  int[] _sorted
          An array for the sorted values.
protected  int _value
          The current value.
 
Fields inherited from class com.threerings.media.util.TrailingAverage
_history, _index
 
Constructor Summary
TruncatedAverage()
          Creates a new truncated average that records the last ten values and omits the three highest and lowest when computing the average.
TruncatedAverage(int history, int omitLowest, int omitHighest)
          Creates a new truncated average that records the specified number of values and omits the given number of values at the higher and lower ends.
 
Method Summary
 void record(int value)
           
 int value()
           
 
Methods inherited from class com.threerings.media.util.TrailingAverage
toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_omitLowest

protected int _omitLowest
The number of values to omit on the lower and higher ends.


_omitHighest

protected int _omitHighest
The number of values to omit on the lower and higher ends.


_sorted

protected int[] _sorted
An array for the sorted values.


_value

protected int _value
The current value.

Constructor Detail

TruncatedAverage

public TruncatedAverage()
Creates a new truncated average that records the last ten values and omits the three highest and lowest when computing the average.


TruncatedAverage

public TruncatedAverage(int history,
                        int omitLowest,
                        int omitHighest)
Creates a new truncated average that records the specified number of values and omits the given number of values at the higher and lower ends.

Method Detail

record

public void record(int value)
Overrides:
record in class TrailingAverage

value

public int value()
Overrides:
value in class TrailingAverage