class TimeSeriesReturnCalculatorFactory {

  public static String getReturnCalculatorName(final TimeSeriesReturnCalculator calculator) {
    if (calculator == null) {
      return null;
    }
    final CalculationMode mode = calculator.getMode();
    if (mode == CalculationMode.STRICT) {
      return s_instanceStrictNames.get(calculator.getClass());
    } else if (mode == CalculationMode.LENIENT) {
      return s_instanceLenientNames.get(calculator.getClass());
    } else {
      throw new IllegalArgumentException("Do not have calculator for " + calculator.getClass().getName() + " with calculation mode " + mode);
    }
  }

}