<commit_before>/*
 * $Id$
 */
package org.xins.server;

import org.apache.log4j.Logger;
import org.xins.util.MandatoryArgumentChecker;

/**
 * A result code. Result codes are either generic or API-specific. Result
 * codes do not automatically apply to all functions of an API if they have
 * been defined for that API.
 *
 * @version $Revision$ $Date$
 * @author <NAME> (<a href="mailto:<EMAIL>"><EMAIL></a>)
 */
final class ResultCode
extends Object {

   //-------------------------------------------------------------------------
   // Class fields
   //-------------------------------------------------------------------------

   //-------------------------------------------------------------------------
   // Class functions
   //-------------------------------------------------------------------------

   //-------------------------------------------------------------------------
   // Constructors
   //-------------------------------------------------------------------------

   /**
    * Constructs a new <code>ResultCode</code> for the specified API.
    *
    * @param api
    *    the API to which this result code belongs, not <code>null</code>.
    *
    * @param name
    *    the symbolic name, can be <code>null</code>.
    *
    * @param value
    *    the actual value of this code, not <code>null</code>.
    *
    * @throws IllegalArgumentException
    *    if <code>api == null || value == null</code>.
    */
   protected ResultCode(API api, String name, String value)
   throws IllegalArgumentException {

      // Check argument
      MandatoryArgumentChecker.check("api", api, "value", value);

      _log     = Logger.getLogger(getClass().getName());
      _api     = api;
      _name    = name;
      _value   = value;

      // TODO: _api.resultCodeAdded(this);
   }


   //-------------------------------------------------------------------------
   // Fields
   //-------------------------------------------------------------------------

   /**
    * The logger used by this <code>ResultCode</code> instance. This field is
    * initialized by the constructor and set to a non-<code>null</code> value.
    */
   private final Logger _log;

   /**
    * The API implementation this result code is defined within. Cannot be
    * <code>null</code>.
    */<commit_msg>Added constructor that takes only name and value.<commit_after>/*
 * $Id$
 */
package org.xins.server;

import org.apache.log4j.Logger;
import org.xins.util.MandatoryArgumentChecker;

/**
 * A result code. Result codes are either generic or API-specific. Result
 * codes do not automatically apply to all functions of an API if they have
 * been defined for that API.
 *
 * @version $Revision$ $Date$
 * @author <NAME> (<a href="mailto:<EMAIL>"><EMAIL></a>)
 */
final class ResultCode
extends Object {

   //-------------------------------------------------------------------------
   // Class fields
   //-------------------------------------------------------------------------

   //-------------------------------------------------------------------------
   // Class functions
   //-------------------------------------------------------------------------

   //-------------------------------------------------------------------------
   // Constructors
   //-------------------------------------------------------------------------

   /**
    * Constructs a new generic <code>ResultCode</code>. This constructor can
    * only be called by classes in the same package.
    *
    * @param name
    *    the symbolic name, can be <code>null</code>.
    *
    * @param value
    *    the actual value of this code, not <code>null</code>.
    *
    * @throws IllegalArgumentException
    *    if <code>value == null</code>.
    */
   ResultCode(String name, String value)
   throws IllegalArgumentException {

      // Check preconditions
      MandatoryArgumentChecker.check("value", value);

      _log     = Logger.getLogger(getClass().getName());
      _api     = null;
      _name    = name;
      _value   = value;
   }

   /**
    * Constructs a new <code>ResultCode</code> for the specified API.
    *
    * @param api
    *    the API to which this result code belongs, not <code>null</code>.
    *
    * @param name
    *    the symbolic name, can be <code>null</code>.
    *
    * @param value
    *    the actual value of this code, not <code>null</code>.
    *
    * @throws IllegalArgumentException
    *    if <code>api == null || value == null</code>.
    */
   public ResultCode(API api, String name, String value)
   throws IllegalArgumentException {

      // Check preconditions
      MandatoryArgumentChecker.check("api", api, "value", value);

      _log     = Logger.getLogger(getClass().getName());
      _api     = api;
      _name    = name;
      _value   = value;

      // TODO: Remove _log ?
      // TODO: _api.resultCodeAdded(this);
   }


   //-------------------------------------------------------------------------
   // Fields
   //-------------------------------------------------------------------------

   /**
    * The logger used by this <code>ResultCode</code> instance. This field is
    * initialized by the constructor and set to a non-<code>null</code> value.
    */
   private final Logger _log;

   /**
    * The API implementation this result code is defined within. Cannot be
    * <code>null</code>.
    */
{'fraction_non_alphanumeric': 0.31576005961251863, 'fraction_numerical': 0.00037257824143070045, 'mean_word_length': 1.2004098360655737, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 53, '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': '1886841', 'n_tokens_mistral': 1292, 'n_tokens_neox': 1266, 'n_words': 394}