<commit_before>/*
 * Copyright 2011 Revelytix Inc.
 *
 * 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 spark.spi;

import java.math.BigInteger;
import java.util.Date;

/**
 * Class of convenience conversions from lexical string representation to the 
 * various XSD data type native Java representations.
 */
public final class Conversions {

  private Conversions() {}

  /**
   * Convert from lexical to BigInteger (xsd:integer)
   * @param lexicalBigInteger Lexical representation
   * @return Converted value
   */
  public static BigInteger toBigInteger(String lexicalBigInteger) {
    return new BigInteger(lexicalBigInteger);
  }
  
  /**
   * Convert from lexical to int (xsd:int)
   * @param lexicalInteger Lexical representation
   * @return Converted value
   */
  public static int toInteger(String lexicalInteger) {
    return Integer.parseInt(lexicalInteger);
  }
  
  /**
   * Convert from lexical to boolean (xsd:boolean)
   * @param lexicalBoolean Lexical representation
   * @return Converted value
   */
  public static boolean toBoolean(String lexicalBoolean) {
    return Boolean.parseBoolean(lexicalBoolean);
  }

  /**
   * Convert from lexical to float (xsd:float)
   * @param lexicalFloat Lexical representation
   * @return Converted value
   */
  public static float toFloat(String lexicalFloat) {
    return Float.parseFloat(lexicalFloat);
  }
  
  /**
   * Convert from lexical to double (xsd:double)
   * @param lexicalDouble Lexical representation
   * @return Converted value
   */
  public static double toDouble(String lexicalDouble) {
    return Double.parseDouble(lexicalDouble);
  }

  /**
   * Convert from lexical to Date (xsd:dateTime)
   * @param lexicalDate Lexical representation
   * @return Converted value
   */
  public static Date toDateTime(String lexicalDate) {
    // TODO
    return null;
  }
}<commit_msg>Use new DateTime utility for xsd:dateTime conversions<commit_after>/*
 * Copyright 2011 Revelytix Inc.
 *
 * 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 spark.spi;

import java.math.BigInteger;
import java.util.Date;

import spark.spi.util.DateTime;

/**
 * Class of convenience conversions from lexical string representation to the 
 * various XSD data type native Java representations.
 */
public final class Conversions {

  private Conversions() {}

  /**
   * Convert from lexical to BigInteger (xsd:integer)
   * @param lexicalBigInteger Lexical representation
   * @return Converted value
   */
  public static BigInteger toBigInteger(String lexicalBigInteger) {
    return new BigInteger(lexicalBigInteger);
  }
  
  /**
   * Convert from lexical to int (xsd:int)
   * @param lexicalInteger Lexical representation
   * @return Converted value
   */
  public static int toInteger(String lexicalInteger) {
    return Integer.parseInt(lexicalInteger);
  }
  
  /**
   * Convert from lexical to boolean (xsd:boolean)
   * @param lexicalBoolean Lexical representation
   * @return Converted value
   */
  public static boolean toBoolean(String lexicalBoolean) {
    return Boolean.parseBoolean(lexicalBoolean);
  }

  /**
   * Convert from lexical to float (xsd:float)
   * @param lexicalFloat Lexical representation
   * @return Converted value
   */
  public static float toFloat(String lexicalFloat) {
    return Float.parseFloat(lexicalFloat);
  }
  
  /**
   * Convert from lexical to double (xsd:double)
   * @param lexicalDouble Lexical representation
   * @return Converted value
   */
  public static double toDouble(String lexicalDouble) {
    return Double.parseDouble(lexicalDouble);
  }

  /**
   * Convert from lexical to Date (xsd:dateTime)
   * @param lexicalDate Lexical representation
   * @return Converted value
   */
  public static Date toDateTime(String lexicalDate) {
    return DateTime.parse(lexicalDate);
  }
}
{'fraction_non_alphanumeric': 0.08026479106330162, 'fraction_numerical': 0.0033098882912701694, 'mean_word_length': 3.6941747572815533, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '366040', 'n_tokens_mistral': 1373, 'n_tokens_neox': 1298, 'n_words': 475}