<commit_before>/**
 * DocumentValidator
 * Copyright (c) 2013-, <NAME>, All rights reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3.0 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library.
 */
package org.unigram.docvalidator.util;

import org.unigram.docvalidator.store.Sentence;

/**
 * Error to report invalid point from Validators.
 */
public class ValidationError {

  /**
   * Constructor.
   *
   * @param errorMessage error message
   */
  public ValidationError(String errorMessage) {
    super();
    this.lineNumber = -1;
    this.message = errorMessage;
    this.fileName = "";
    this.sentence = null;
  }

  /**
   * Constructor.
   *
   * @param errorLineNumber error position (line number)
   * @param errorMessage    error message
   */
  public ValidationError(int errorLineNumber, String errorMessage) {
    this(errorMessage);
    this.lineNumber = errorLineNumber;
    this.fileName = "";
  }

  /**
   * Constructor.
   *
   * @param errorMessage error message
   * @param sentenceWithError sentence containing validation error
   */
  public ValidationError(String errorMessage,
                         Sentence sentenceWithError) {
    this(sentenceWithError.position, errorMessage);
    this.sentence = sentenceWithError;
  }

  /**
   * Constructor.
   *
   * @param errorLineNumber error position (line number)
   * @param errorMessage    error message
   * @param errorFileName   file name in which the error occurs
   */
  public ValidationError(int errorLineNumber, String errorMessage,
                         String errorFileName) {
    this(errorLineNumber, errorMessage);
    this.fileName = errorFileName;
  }

  /**
   * Constructor.
   *
   * @param errorMessage  error message
   * @param sentenceWithError sentence containing validation error
   * @param errorFileName file name in which the error occurs
   */
  public ValidationError(String errorMessage,
                         Sentence sentenceWithError, String errorFileName) {
    this(sentenceWithError.position, errorMessage);
    this.sentence = sentenceWithError;
    this.fileName = errorFileName;
  }

  /**
   * Get line number in which the error occurs.
   *
   * @return
   */
  public int getLineNumber() {
    return lineNumber;
  }

  /**
   * Set the line number in which error occurs.
   *
   * @param errorLineNumber
   */
  public void setLineNumber(int errorLineNumber) {
    this.lineNumber = errorLineNumber;
  }

  /**
   * Get error message.
   *
   * @return error message
   */
  public String getMessage() {
    return message;
  }

  /**
   * Set error message.
   *
   * @param errorMessage
   */
  public void setMessage(String errorMessage) {
    this.message = errorMessage;
  }

  /**
   * Get file name.
   *
   * @return file name
   */
  public String getFileName() {
    return fileName;
  }

  /**
   * Set file name
   *
   * @param errorFileName
   */
  public void setFileName(String errorFileName) {
    this.fileName = errorFileName;
  }

  /**
   * Get sentence containing the error.
   *
   * @return sentence
   */
  public Sentence getSentence() {
    return sentence;
  }

  /**
   * Set sentenceWithError contains the error.
   *
   * @param sentenceWithError sentenceWithError containing validation error
   */
  public void setSentence(Sentence sentenceWithError) {
    this.sentence = sentenceWithError;
  }

  @Override
  public String toString() {
    StringBuilder str = new StringBuilder();
    if (this.fileName == null || this.fileName.equals("")) {<commit_msg>Add a period in the first sentence of a javadoc header<commit_after>/**
 * DocumentValidator
 * Copyright (c) 2013-, <NAME>, All rights reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3.0 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library.
 */
package org.unigram.docvalidator.util;

import org.unigram.docvalidator.store.Sentence;

/**
 * Error to report invalid point from Validators.
 */
public class ValidationError {

  /**
   * Constructor.
   *
   * @param errorMessage error message
   */
  public ValidationError(String errorMessage) {
    super();
    this.lineNumber = -1;
    this.message = errorMessage;
    this.fileName = "";
    this.sentence = null;
  }

  /**
   * Constructor.
   *
   * @param errorLineNumber error position (line number)
   * @param errorMessage    error message
   */
  public ValidationError(int errorLineNumber, String errorMessage) {
    this(errorMessage);
    this.lineNumber = errorLineNumber;
    this.fileName = "";
  }

  /**
   * Constructor.
   *
   * @param errorMessage error message
   * @param sentenceWithError sentence containing validation error
   */
  public ValidationError(String errorMessage,
                         Sentence sentenceWithError) {
    this(sentenceWithError.position, errorMessage);
    this.sentence = sentenceWithError;
  }

  /**
   * Constructor.
   *
   * @param errorLineNumber error position (line number)
   * @param errorMessage    error message
   * @param errorFileName   file name in which the error occurs
   */
  public ValidationError(int errorLineNumber, String errorMessage,
                         String errorFileName) {
    this(errorLineNumber, errorMessage);
    this.fileName = errorFileName;
  }

  /**
   * Constructor.
   *
   * @param errorMessage  error message
   * @param sentenceWithError sentence containing validation error
   * @param errorFileName file name in which the error occurs
   */
  public ValidationError(String errorMessage,
                         Sentence sentenceWithError, String errorFileName) {
    this(sentenceWithError.position, errorMessage);
    this.sentence = sentenceWithError;
    this.fileName = errorFileName;
  }

  /**
   * Get line number in which the error occurs.
   *
   * @return
   */
  public int getLineNumber() {
    return lineNumber;
  }

  /**
   * Set the line number in which error occurs.
   *
   * @param errorLineNumber
   */
  public void setLineNumber(int errorLineNumber) {
    this.lineNumber = errorLineNumber;
  }

  /**
   * Get error message.
   *
   * @return error message
   */
  public String getMessage() {
    return message;
  }

  /**
   * Set error message.
   *
   * @param errorMessage
   */
  public void setMessage(String errorMessage) {
    this.message = errorMessage;
  }

  /**
   * Get file name.
   *
   * @return file name
   */
  public String getFileName() {
    return fileName;
  }

  /**
   * Set file name.
   *
   * @param errorFileName
   */
  public void setFileName(String errorFileName) {
    this.fileName = errorFileName;
  }

  /**
   * Get sentence containing the error.
   *
   * @return sentence
   */
  public Sentence getSentence() {
    return sentence;
  }

  /**
   * Set sentenceWithError contains the error.
   *
   * @param sentenceWithError sentenceWithError containing validation error
   */
  public void setSentence(Sentence sentenceWithError) {
    this.sentence = sentenceWithError;
  }

  @Override
  public String toString() {
    StringBuilder str = new StringBuilder();
    if (this.fileName == null || this.fileName.equals("")) {
{'fraction_non_alphanumeric': 0.08790263093189082, 'fraction_numerical': 0.0017211703958691911, 'mean_word_length': 2.866444866920152, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '684060', 'n_tokens_mistral': 2255, 'n_tokens_neox': 2202, 'n_words': 722}