/**
 * redpen: a text inspection tool
 * Copyright (C) 2014 Recruit Technologies Co., Ltd. and contributors
 * (see CONTRIBUTORS.md)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.bigram.docvalidator.config;

import java.util.ArrayList;
import java.util.List;

/**
 * Contains Settings used throughout DocumentValidator.
 */
public final class Configuration {
  /**
   * Constructor.
   *
   */
  public Configuration(ValidatorConfiguration validatorConfig) {
    this(validatorConfig, new CharacterTable());
  }

  /**
   * Constructor.
   *
   * @param validatorConfig settings of validators
   * @param characterConf settings of characters and symbols
   */
  public Configuration(ValidatorConfiguration validatorConfig, CharacterTable characterConf) {
    super();
    this.characterTable = characterConf;

    // TODO tricky implementation. this code is need to refactor with ConfigurationLoader.
    for (ValidatorConfiguration config : validatorConfig.getChildren()) {
      if ("SentenceIterator".equals(config.getConfigurationName())) {
        this.sentenceValidatorConfigs.addAll(config.getChildren());
      } else if ("SectionLength".equals(config.getConfigurationName())) {
        this.sectionValidatorConfigs.add(config);
      } else if ("MaxParagraphNumber".equals(config.getConfigurationName())) {
        this.sectionValidatorConfigs.add(config);
      } else if ("ParagraphStartWith".equals(config.getConfigurationName())) {
        this.sectionValidatorConfigs.add(config);
      }
    }

  }

  /**
   * Get CharacterTable.
   *
   * @return CharacterTable
   */
  public CharacterTable getCharacterTable() {
    return characterTable;
  }

  /**
   * Get document validator configurations.
   * @return list of configurations
   */
  public List<ValidatorConfiguration> getDocumentValidatorConfigs() {
    return documentValidatorConfigs;
  }

  /**
   * Get section validator configurations.
   * @return list of configurations
   */
  public List<ValidatorConfiguration> getSectionValidatorConfigs() {
    return sectionValidatorConfigs;
  }

  /**
   * Get paragraph validator configurations.
   * @return list of configurations
   */
  public List<ValidatorConfiguration> getParagraphValidatorConfigs() {
    return paragraphValidatorConfigs;
  }
  /**
   * Get sentence validator configurations.
   * @return list of configurations
   */
  public List<ValidatorConfiguration> getSentenceValidatorConfigs() {
    return sentenceValidatorConfigs;
  }

  private final CharacterTable characterTable;

  private final List<ValidatorConfiguration> documentValidatorConfigs =
      new ArrayList<ValidatorConfiguration>();
  private final List<ValidatorConfiguration> sectionValidatorConfigs =
      new ArrayList<ValidatorConfiguration>();
  private final List<ValidatorConfiguration> paragraphValidatorConfigs =
      new ArrayList<ValidatorConfiguration>();
  private final List<ValidatorConfiguration> sentenceValidatorConfigs =
      new ArrayList<ValidatorConfiguration>();
}

@@ -775,16 +775,73 @@
 il.List;
+%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;
 %0A%0A/**%0A *
@@ -2065,24 +2065,120 @@
 dd(config);%0A
+      %7D else %7B%0A        LOG.warn(%22No validator such as '%22 +config.getConfigurationName() + %22'%22);%0A
       %7D%0A    
@@ -2179,17 +2179,16 @@
 %7D%0A    %7D%0A
-%0A
   %7D%0A%0A  /
@@ -3616,32 +3616,32 @@
 idatorConfigs =%0A
-
       new ArrayL
@@ -3670,11 +3670,100 @@
 tion%3E();
+%0A%0A  private static final Logger LOG =%0A      LoggerFactory.getLogger(Configuration.class);
 %0A%7D%0A

Add logger to handle invalid validator names