package com.github.TKnudsen.ComplexDataObject.data.uncertainty.Double;

import java.util.Collection;

import com.github.TKnudsen.ComplexDataObject.data.uncertainty.IUncertaintyQuantitative;
import com.github.TKnudsen.ComplexDataObject.model.tools.StatisticsSupport;

/**
 * <p>
 * Title: NumericalUncertainty
 * </p>
 * 
 * <p>
 * Description: data model for uncertainties of numerical values.
 * </p>
 * 
 * <p>
 * Copyright: Copyright (c) 2015-2017
 * </p>
 * 
 * @author Juergen Bernard
 * @version 1.02
 */
public class NumericalUncertainty implements IUncertaintyQuantitative<Double> {

	private Double min;
	private Double max;
	private Double representant;
	private double variation;

	public NumericalUncertainty(Collection<? extends Double> values) {
		initialize(values);
	}

	private void initialize(Collection<? extends Double> values) {
		StatisticsSupport statisticsSupport = new StatisticsSupport(values);

		this.min = statisticsSupport.getMin();
		this.max = statisticsSupport.getMax();
		this.representant = statisticsSupport.getMedian();
		this.variation = statisticsSupport.getVariance();
	}

	@Override
	public String toString() {
		return "NumericalUncertainty. min, max, representant, variation: " + min + ", " + max + ", " + representant
				+ ", " + variation;
	}

	@Override
	public Double getMostCertainRepresentant() {
		return representant;
	}

	@Override
	public Double getMinimum() {
		return min;
	}

	@Override
	public Double getMaximum() {
		return max;
	}

	@Override
	public double getVariation() {
		return variation;
	}

}

@@ -95,24 +95,112 @@
 lection;%0D%0A%0D%0A
+import com.github.TKnudsen.ComplexDataObject.data.complexDataObject.ComplexDataObject;%0D%0A
 import com.g
@@ -649,16 +649,42 @@
 rtainty 
+extends ComplexDataObject 
 implemen
@@ -920,24 +920,77 @@
 alues);%0D%0A%09%7D%0D
+%0A%09%0D%0A%09public NumericalUncertainty() %7B%0D%0A%09%09super();%0D%0A%09%7D%0D
 %0A%0D%0A%09private 

extend complexdataobject to enable de/serialization