gedi.solutions.geode.operations.stats.BitZeroInterval Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gedi-geode-extensions-core Show documentation
Show all versions of gedi-geode-extensions-core Show documentation
GemFire Enterprise Data Integration - common development extensions powered by Apache Geode
The newest version!
package gedi.solutions.geode.operations.stats;
import java.io.PrintWriter;
abstract class BitZeroInterval extends BitInterval {
@Override
int getMemoryUsed() {
return super.getMemoryUsed() + 4;
}
abstract long getBits();
@Override
int fill(double[] values, int valueOffset, int typeCode, int skipCount) {
int fillcount = values.length - valueOffset; // space left in values
int maxCount = count - skipCount; // maximum values this interval can produce
if (fillcount > maxCount) {
fillcount = maxCount;
}
double value = GfStatsReader.bitsToDouble(typeCode, getBits());
for (int i = 0; i < fillcount; i++) {
values[valueOffset + i] = value;
}
return fillcount;
}
@Override
void dump(PrintWriter stream) {
stream.print(getBits());
if (count > 1) {
stream.print("r" + count);
}
}
BitZeroInterval(int count) {
this.count = count;
}
@Override
boolean attemptAdd(long addBits, long addInterval, int addCount) {
// addCount >= 2; count >= 2
if (addInterval == 0 && addBits == getBits()) {
count += addCount;
return true;
}
return false;
}
}