com.googlecode.compressingcircularbuffers
Interface CompressionMethod

All Known Implementing Classes:
AveragingCompressionMethod, MaximizingCompressionMethod, MinimizingCompressionMethod, RandomSamplingCompressionMethod, SummingCompressionMethod, ThinningCompressionMethod

public interface CompressionMethod

A compression method defines how 2k adjacent samples get transformed into a single compressed value.

Rather than implement this interface, most applications can use one of the predefined compression methods listed below.

See Also:
ThinningCompressionMethod, AveragingCompressionMethod, SummingCompressionMethod, MinimizingCompressionMethod, MaximizingCompressionMethod, RandomSamplingCompressionMethod

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.
 

Method Detail

update

void update(double value)
Modifies compressed value to reflect one additional sample value.

Parameters:
value - sampled value used to update the compressed value.

mergeValues

double mergeValues(double older,
                   double newer)
Combines two adjacent n-compressed values to form a single 2n-compressed value.

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).

reset

void reset()
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.


getCompressedValue

double getCompressedValue()
Compressed value representing all updates since last reset of this compression method.

Returns:
current compressed value associated with this compression method.

getCount

int getCount()
Returns number of samples (updates) in current compressed value.

Returns:
number of samples since this compression method was last reset.