private double[] getAllValuesAndWeights(double partialTraceWeight) {
   double weightedSum = 0;
   double weightedSquareSum = 0;
   double weight = partialTraceWeight;
   double instSize = (double) instances.size();
   for (ProcessInstance pi : instances) {
     double d = scale.weigh(pi);
     weightedSum += d;
     weightedSquareSum += d * d;
   }
   return new double[] {weightedSum / instSize, weightedSquareSum / instSize, weight};
 }
 /**
  * Adds a process instance to the set represented by this contributor instance.
  *
  * @param instance The new process instance to be added.
  */
 public void addInstance(ProcessInstance pi) {
   if (!instances.contains(pi)) {
     instances.add(pi);
   }
 }