public static StatsEstimate calculateMean(StatsEstimate min,StatsEstimate max){
  Money meanAverageCpc=calculateMean(min.getAverageCpc(),max.getAverageCpc());
  Double meanAveragePosition=calculateMean(min.getAveragePosition(),max.getAveragePosition());
  Double meanClicks=calculateMean(min.getClicksPerDay(),max.getClicksPerDay());
  Double meanImpressions=calculateMean(min.getImpressionsPerDay(),max.getImpressionsPerDay());
  Double meanCtr=calculateMean(min.getClickThroughRate(),max.getClickThroughRate());
  Money meanTotalCost=calculateMean(min.getTotalCost(),max.getTotalCost());
  StatsEstimate mean=new StatsEstimate();
  if (meanAverageCpc != null) {
    mean.setAverageCpc(meanAverageCpc);
  }
  if (meanAveragePosition != null) {
    mean.setAveragePosition(meanAveragePosition);
  }
  if (meanClicks != null) {
    mean.setClicksPerDay(meanClicks.floatValue());
  }
  if (meanImpressions != null) {
    mean.setImpressionsPerDay(meanImpressions.floatValue());
  }
  if (meanCtr != null) {
    mean.setClickThroughRate(meanCtr);
  }
  if (meanTotalCost != null) {
    mean.setTotalCost(meanTotalCost);
  }
  return mean;
}

public static StatsEstimate calculateMean ( StatsEstimate min , StatsEstimate max ) { Money meanAverageCpc = calculateMean ( min . getAverageCpc ( ) , max . getAverageCpc ( ) ) ; Double meanAveragePosition = calculateMean ( min . getAveragePosition ( ) , max . getAveragePosition ( ) ) ; Double meanClicks = calculateMean ( min . getClicksPerDay ( ) , max . getClicksPerDay ( ) ) ; Double meanImpressions = calculateMean ( min . getImpressionsPerDay ( ) , max . getImpressionsPerDay ( ) ) ; Double meanCtr = calculateMean ( min . getClickThroughRate ( ) , max . getClickThroughRate ( ) ) ; Money meanTotalCost = calculateMean ( min . getTotalCost ( ) , max . getTotalCost ( ) ) ; StatsEstimate mean = new StatsEstimate ( ) ; if ( meanAverageCpc != null ) { mean . setAverageCpc ( meanAverageCpc ) ; } if ( meanAveragePosition != null ) { mean . setAveragePosition ( meanAveragePosition ) ; } if ( meanClicks != null ) { mean . setClicksPerDay ( meanClicks . floatValue ( ) ) ; } if ( meanImpressions != null ) { mean . setImpressionsPerDay ( meanImpressions . floatValue ( ) ) ; } if ( meanCtr != null ) { mean . setClickThroughRate ( meanCtr ) ; } if ( meanTotalCost != null ) { mean . setTotalCost ( meanTotalCost ) ; } return mean ; }
calculates the mean estimated statistics based on minimum and maximum values .
