static boolean statisticSetHasNoFields(StatisticSet statisticValues) {
   return (statisticValues == null)
       || ((statisticValues.getMaximum()) == null
           && (statisticValues.getMinimum() == null)
           && (statisticValues.getSampleCount()) == null
           && (statisticValues.getSum() == null));
 }
 static void validateValueAndStatisticSet(
     Double value, String valueName, StatisticSet statisticValues, String statisticValuesName)
     throws CloudWatchException {
   if (value == null && statisticSetHasNoFields(statisticValues)) {
     throw new MissingParameterException(
         "At least one of the parameters "
             + valueName
             + " or "
             + statisticValuesName
             + " must be specified.");
   }
   if (value != null && !statisticSetHasNoFields(statisticValues)) {
     throw new InvalidParameterCombinationException(
         "The parameters "
             + valueName
             + " and "
             + statisticValuesName
             + " are mutually exclusive and you have specified both.");
   }
   if (value != null) return; // value is set
   validateAllStatisticSetFields(statisticValues, statisticValuesName);
   if (statisticValues.getMaximum() < statisticValues.getMinimum()) {
     throw new MissingParameterException(
         "The parameter "
             + statisticValuesName
             + ".Maximum must be greater than "
             + statisticValuesName
             + ".Minimum.");
   }
   if (statisticValues.getSampleCount() < 0) {
     throw new MissingParameterException(
         "The parameter " + statisticValuesName + ".SampleCount must be greater than 0.");
   }
   if (statisticValues.getSampleCount() == 0.0) {
     throw new MissingParameterException(
         "The parameter " + statisticValuesName + ".SampleCount must not equal 0.");
   }
 }
 static void validateAllStatisticSetFields(
     StatisticSet statisticValues, String statisticValuesName) throws CloudWatchException {
   StringBuilder errors = new StringBuilder();
   boolean haveErrors = false;
   if (statisticValues == null || statisticValues.getMaximum() == null) {
     if (haveErrors) {
       errors.append("\n");
     }
     errors.append("The parameter " + statisticValuesName + ".Maximum is required.");
     haveErrors = true;
   }
   if (statisticValues == null || statisticValues.getMinimum() == null) {
     if (haveErrors) {
       errors.append("\n");
     }
     errors.append("The parameter " + statisticValuesName + ".Minimum is required.");
     haveErrors = true;
   }
   if (statisticValues == null || statisticValues.getSampleCount() == null) {
     if (haveErrors) {
       errors.append("\n");
     }
     errors.append("The parameter " + statisticValuesName + ".SampleCount is required.");
     haveErrors = true;
   }
   if (statisticValues == null || statisticValues.getSum() == null) {
     if (haveErrors) {
       errors.append("\n");
     }
     errors.append("The parameter " + statisticValuesName + ".Sum is required.");
     haveErrors = true;
   }
   if (haveErrors) {
     throw new MissingParameterException(errors.toString());
   }
 }