/**
   * addThreshold
   *
   * @param threshold a {@link org.opennms.netmgt.threshd.BaseThresholdDefConfigWrapper} object.
   */
  public void addThreshold(BaseThresholdDefConfigWrapper threshold) {
    ThresholdEvaluator evaluator = getEvaluatorForThreshold(threshold);
    // Get the default list of evaluators (the null key)
    List<ThresholdEvaluatorState> defaultList = m_thresholdEvaluatorStates.get(null);

    for (ThresholdEvaluatorState item : defaultList) {
      if (threshold.getType().equals(item.getThresholdConfig().getType())) {
        throw new IllegalStateException(threshold.getType() + " threshold already set.");
      }
    }

    defaultList.add(evaluator.getThresholdEvaluatorState(threshold));
  }
  private ThresholdEvaluator getEvaluatorForThreshold(BaseThresholdDefConfigWrapper threshold) {
    for (ThresholdEvaluator evaluator : getThresholdEvaluators()) {
      if (evaluator.supportsType(threshold.getType())) {
        return evaluator;
      }
    }

    String message =
        "Threshold type '"
            + threshold.getType()
            + "' for "
            + threshold.getDatasourceExpression()
            + " is not supported";
    log().warn(message);
    throw new IllegalArgumentException(message);
  }