if (mode == GEOMETRIC) {
double logSum = 0.0;
int entries = 0;
for (Iterator<IntEntry> iter = index.iterator(); iter.hasNext(); entries++) {
IntEntry entry = iter.next();
Index pred = index.add(entry.getNumber(), -1);
EstimateData predData = indexMap.get(pred);
logSum += Math.log(Math.abs(predData.contribution));
}
return Math.exp(logSum / entries);
} else if (mode == MINIMUM) {
double estimate = Double.POSITIVE_INFINITY;
for (IntEntry entry : index) {
Index pred = index.add(entry.getNumber(), -1);
EstimateData predData = indexMap.get(pred);
estimate = Math.min(Math.abs(predData.contribution), estimate);
}
return estimate;
} else if (mode == MAXIMUM) {
double estimate = 0.0;
for (IntEntry entry : index) {
Index pred = index.add(entry.getNumber(), -1);
EstimateData predData = indexMap.get(pred);
estimate = Math.max(Math.abs(predData.contribution), estimate);
}
return estimate;