<commit_before>/**
 * Copyright (C) 2012 - present by OpenGamma Inc. and the OpenGamma group of companies
 *
 * Please see distribution for license.
 */
package com.opengamma.financial.analytics.ircurve.calcconfig;

import com.opengamma.core.config.ConfigSource;
import com.opengamma.engine.function.FunctionCompilationContext;
import com.opengamma.engine.function.FunctionDefinition;
import com.opengamma.financial.config.AbstractConfigChangeProvider;
import com.opengamma.id.VersionCorrection;
import com.opengamma.util.ArgumentChecker;

/**
 *
 */
public class ConfigDBCurveCalculationConfigSource implements CurveCalculationConfigSource {

  private final ConfigSource _configSource;
  private final VersionCorrection _lockedVersionCorrection;

  public ConfigDBCurveCalculationConfigSource(final ConfigSource configSource, final VersionCorrection versionCorrection) {
    ArgumentChecker.notNull(configSource, "configuration source");
    _configSource = configSource;
    _lockedVersionCorrection = versionCorrection;
  }

  public static void reinitOnChanges(final FunctionCompilationContext context, final FunctionDefinition function) {
    AbstractConfigChangeProvider.reinitOnChanges(context, function, MultiCurveCalculationConfig.class);
  }

  @Override
  public MultiCurveCalculationConfig getConfig(final String name) {
    return getConfig(name, _lockedVersionCorrection);
  }

  @Override
  public MultiCurveCalculationConfig getConfig(final String name, final VersionCorrection versionCorrection) {
    return _configSource.getSingle(MultiCurveCalculationConfig.class, name, versionCorrection);
  }

}
<commit_msg>[PLAT-3807] Provide deprecated constructor to support previous use cases<commit_after>/**
 * Copyright (C) 2012 - present by OpenGamma Inc. and the OpenGamma group of companies
 *
 * Please see distribution for license.
 */
package com.opengamma.financial.analytics.ircurve.calcconfig;

import com.opengamma.core.config.ConfigSource;
import com.opengamma.engine.function.FunctionCompilationContext;
import com.opengamma.engine.function.FunctionDefinition;
import com.opengamma.financial.config.AbstractConfigChangeProvider;
import com.opengamma.id.VersionCorrection;
import com.opengamma.util.ArgumentChecker;

/**
 *
 */
public class ConfigDBCurveCalculationConfigSource implements CurveCalculationConfigSource {

  private final ConfigSource _configSource;
  private final VersionCorrection _lockedVersionCorrection;

  public ConfigDBCurveCalculationConfigSource(final ConfigSource configSource, final VersionCorrection versionCorrection) {
    ArgumentChecker.notNull(configSource, "configuration source");
    _configSource = configSource;
    _lockedVersionCorrection = versionCorrection;
  }

  @Deprecated
  public ConfigDBCurveCalculationConfigSource(final ConfigSource configSource) {
    this(configSource, VersionCorrection.LATEST);
  }

  public static void reinitOnChanges(final FunctionCompilationContext context, final FunctionDefinition function) {
    AbstractConfigChangeProvider.reinitOnChanges(context, function, MultiCurveCalculationConfig.class);
  }

  @Override
  public MultiCurveCalculationConfig getConfig(final String name) {
    return getConfig(name, _lockedVersionCorrection);
  }

  @Override
  public MultiCurveCalculationConfig getConfig(final String name, final VersionCorrection versionCorrection) {
    return _configSource.getSingle(MultiCurveCalculationConfig.class, name, versionCorrection);
  }

}

{'fraction_non_alphanumeric': 0.06712762892538174, 'fraction_numerical': 0.003457216940363008, 'mean_word_length': 6.531453362255966, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5650408', 'n_tokens_mistral': 924, 'n_tokens_neox': 910, 'n_words': 203}