/** * Normalize the given estimates by dividing them by a number of executions. * * @param estimates that should be normalized * @param numExecutions the number execution * @return the normalized estimates (and {@code estimates} if {@code numExecution == 1} */ static CardinalityEstimate[] normalize(CardinalityEstimate[] estimates, int numExecutions) { if (numExecutions == 1 || estimates.length == 0) return estimates; CardinalityEstimate[] normalizedEstimates = new CardinalityEstimate[estimates.length]; for (int i = 0; i < estimates.length; i++) { final CardinalityEstimate estimate = estimates[i]; if (estimate != null) normalizedEstimates[i] = estimate.divideBy(numExecutions); } return normalizedEstimates; }