<commit_before>/**
 * CoreUtils.h
 * 
 * Module for including any core-specific common utilities
 *
 * Copyright(c) 2007 Vettalabs
 * All rights reserved.
 */

#ifndef _CORE_UTILS_H_
#define _CORE_UTILS_H_

#include "types.h"
#include "HandleMap.h"
#include "exceptions.h"

template<class T>
class CoreUtils
{
public:    

    /**
     * This method is used to translate an old handle to a new one mapped
     * in a hash table.
     *
     * @param Handle which will be translated.
     * @param Table that maps from old to new handles.
     */
    static void updateHandle(Handle *, HandleMap<T> *) throw (RuntimeException);
    
    /**
     * Handle sort criterion used by qsort. It returns a negative value,
     * zero or a positive value if the first argument is respectively
     * smaller than, equal to, or larger then the second argument.
     *
     * @param The pointer to the first handle element.
     * @param The pointer to the second handle element.
     * @return A negative value, zero or a positive value if the first
     * argument is respectively smaller than, equal to, or larger than the
     * second argument.
     */
    static int handleCompare(const void*, const void*);

    /**
     * Returns a negative value, zero or a positive value if the first 
     * argument is respectively smaller than, equal to, or larger than 
     * the second argument.
     *
     * @param The first handle element.
     * @param The second handle element.
     * @return A negative value, zero or a positive value if the first
     * argument is respectively smaller than, equal to, or larger then the
     * second argument.
     */
    static int compare(Handle, Handle);
    
    class HandleComparison {
        public:
        bool operator()(const Handle& h1, const Handle& h2) const;
    };
<commit_msg>split into a templated and a non-templated class.<commit_after>/**
 * CoreUtils.h
 * 
 * Module for including any core-specific common utilities
 *
 * Copyright(c) 2007 Vettalabs
 * All rights reserved.
 */

#ifndef _CORE_UTILS_H_
#define _CORE_UTILS_H_

#include "types.h"
#include "HandleMap.h"
#include "exceptions.h"

template<class T>
class CoreMapUtils
{
public:    

    /**
     * This method is used to translate an old handle to a new one mapped
     * in a hash table.
     *
     * @param Handle which will be translated.
     * @param Table that maps from old to new handles.
     */
    static void updateHandle(Handle *, HandleMap<T> *) throw (RuntimeException);
};
    
class CoreUtils
{
public:    
    /**
     * Handle sort criterion used by qsort. It returns a negative value,
     * zero or a positive value if the first argument is respectively
     * smaller than, equal to, or larger then the second argument.
     *
     * @param The pointer to the first handle element.
     * @param The pointer to the second handle element.
     * @return A negative value, zero or a positive value if the first
     * argument is respectively smaller than, equal to, or larger than the
     * second argument.
     */
    static int handleCompare(const void*, const void*);

    /**
     * Returns a negative value, zero or a positive value if the first 
     * argument is respectively smaller than, equal to, or larger than 
     * the second argument.
     *
     * @param The first handle element.
     * @param The second handle element.
     * @return A negative value, zero or a positive value if the first
     * argument is respectively smaller than, equal to, or larger then the
     * second argument.
     */
    static int compare(Handle, Handle);
    
    class HandleComparison {
        public:
        bool operator()(const Handle& h1, const Handle& h2) const;
    };
{'fraction_non_alphanumeric': 0.07632356893308251, 'fraction_numerical': 0.0032249395323837677, 'mean_word_length': 2.677865612648221, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '4707328', 'n_tokens_mistral': 1021, 'n_tokens_neox': 997, 'n_words': 456}