/** {@inheritDoc} */
  @Override
  protected void updateMinMax(Number min, Number max) {
    // we always use the double values, because that way the response Object class is
    // consistent regardless of whether we only have 1 value or many that we min/max
    //
    // TODO: would be nice to have subclasses for each type of Number ... breaks backcompat

    if (computeMin) { // nested if to encourage JIT to optimize aware final var?
      if (null != min) {
        double minD = min.doubleValue();
        if (null == this.min || minD < this.minD) {
          // Double for result & cached primitive doulbe to minimize unboxing in future comparisons
          this.min = this.minD = minD;
        }
      }
    }
    if (computeMax) { // nested if to encourage JIT to optimize aware final var?
      if (null != max) {
        double maxD = max.doubleValue();
        if (null == this.max || this.maxD < maxD) {
          // Double for result & cached primitive doulbe to minimize unboxing in future comparisons
          this.max = this.maxD = maxD;
        }
      }
    }
  }
 /** {@inheritDoc} */
 @Override
 public void updateTypeSpecificStats(Number v, int count) {
   double value = v.doubleValue();
   if (computeSumOfSquares) {
     sumOfSquares += (value * value * count); // for std deviation
   }
   if (computeSum) {
     sum += value * count;
   }
   if (computePercentiles) {
     tdigest.add(value, count);
   }
 }
 @Override
 public long hash(Number v) {
   // have to use a bit of reflection to ensure good hash values since
   // we don't have truely type specific stats
   if (v instanceof Long) {
     return hasher.hashLong(v.longValue()).asLong();
   } else if (v instanceof Integer) {
     return hasher.hashInt(v.intValue()).asLong();
   } else if (v instanceof Double) {
     return hasher.hashLong(Double.doubleToRawLongBits(v.doubleValue())).asLong();
   } else if (v instanceof Float) {
     return hasher.hashInt(Float.floatToRawIntBits(v.floatValue())).asLong();
   } else if (v instanceof Byte) {
     return hasher.newHasher().putByte(v.byteValue()).hash().asLong();
   } else if (v instanceof Short) {
     return hasher.newHasher().putShort(v.shortValue()).hash().asLong();
   }
   // else...
   throw new SolrException(
       SolrException.ErrorCode.SERVER_ERROR,
       "Unsupported Numeric Type (" + v.getClass() + ") for hashing: " + statsField);
 }
 /** {@inheritDoc} */
 @Override
 protected void updateMinMax(Number min, Number max) {
   this.min = Math.min(this.min.doubleValue(), min.doubleValue());
   this.max = Math.max(this.max.doubleValue(), max.doubleValue());
 }
 /** {@inheritDoc} */
 @Override
 public void updateTypeSpecificStats(Number v, int count) {
   double value = v.doubleValue();
   sumOfSquares += (value * value * count); // for std deviation
   sum += value * count;
 }