com.googlecode.compressingcircularbuffers
Class ThinningCompressionMethod

java.lang.Object
  extended by com.googlecode.compressingcircularbuffers.ThinningCompressionMethod
All Implemented Interfaces:
CompressionMethod

public class ThinningCompressionMethod
extends java.lang.Object
implements CompressionMethod

Compresses by simply eliminating intermediary values.


Constructor Summary
ThinningCompressionMethod()
           
 
Method Summary
 double getCompressedValue()
          Compressed value representing all updates since last reset of this compression method.
 int getCount()
          Returns number of samples (updates) in current compressed value.
 double mergeValues(double older, double newer)
          Combines two adjacent n-compressed values to form a single 2n-compressed value.
 void reset()
          Eliminates the impact of previously seen data from the compression method.
 void update(double value)
          Modifies compressed value to reflect one additional sample value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThinningCompressionMethod

public ThinningCompressionMethod()
Method Detail

update

public void update(double value)
Description copied from interface: CompressionMethod
Modifies compressed value to reflect one additional sample value.

Specified by:
update in interface CompressionMethod
Parameters:
value - sampled value used to update the compressed value.

reset

public void reset()
Description copied from interface: CompressionMethod
Eliminates the impact of previously seen data from the compression method. Each time a new compressed value is formed, it is recorded within CompressionCircularBuffer's buffer, and this method is then called to make way for a fresh chunk of data.

Specified by:
reset in interface CompressionMethod

getCompressedValue

public double getCompressedValue()
Description copied from interface: CompressionMethod
Compressed value representing all updates since last reset of this compression method.

Specified by:
getCompressedValue in interface CompressionMethod
Returns:
current compressed value associated with this compression method.

mergeValues

public double mergeValues(double older,
                          double newer)
Description copied from interface: CompressionMethod
Combines two adjacent n-compressed values to form a single 2n-compressed value.

Specified by:
mergeValues in interface CompressionMethod
Parameters:
older - the older of the two adjacent values.
newer - the newer of the two adjacent values.
Returns:
single value that combines the two values. For example, an averaging compression method would return (older+newer)/2, whereas a maximizing compression method would return max(older,newer).

getCount

public int getCount()
Description copied from interface: CompressionMethod
Returns number of samples (updates) in current compressed value.

Specified by:
getCount in interface CompressionMethod
Returns:
number of samples since this compression method was last reset.