/**
  * Copy constructor. Copies all values (except the aggregation values) of the given {@link
  * JmxSensorValueData} object into the newly created.
  *
  * @param origin object to clone
  */
 public JmxSensorValueData(JmxSensorValueData origin) {
   setId(origin.getId());
   setPlatformIdent(origin.getPlatformIdent());
   setTimeStamp(new Timestamp(origin.getTimeStamp().getTime()));
   setSensorTypeIdent(origin.getSensorTypeIdent());
   setJmxSensorDefinitionDataIdentId(origin.jmxSensorDefinitionDataIdentId);
   setValue(origin.value);
 }
  /** {@inheritDoc} */
  public void aggregate(JmxSensorValueData data) {
    if (!data.isBooleanOrNumeric()) {
      throw new RuntimeException("The given JMX data can not be aggregated.");
    }
    aggregationCount++;

    double valueToAggregate = data.getValueAsDouble();

    minValue = Math.min(minValue, valueToAggregate);
    maxValue = Math.max(maxValue, valueToAggregate);
    totalValue += valueToAggregate;
  }