<commit_before>#include<string>
#include<vector>
#include "vmf/metadatastream.hpp"
#include "../com_intel_vmf_Variant.h"
#include "throwJavaException.hpp"

using namespace vmf;

/*
 * Class:     com_intel_vmf_Variant
 * Method:    n_Variant
 * Signature: ()J
 */
JNIEXPORT jlong JNICALL Java_com_intel_vmf_Variant_n_1Variant__ (JNIEnv *, jclass)
{
    std::shared_ptr <Variant>* p = new std::shared_ptr <Variant>(new Variant());
    return (jlong) p;
} 

/*
 * Class:     com_intel_vmf_Variant
 * Method:    n_Variant
 * Signature: (J)J
 */
JNIEXPORT jlong JNICALL Java_com_intel_vmf_Variant_n_1Variant__J (JNIEnv *, jclass, jlong otherAddr)
{
    std::shared_ptr <Variant>* other = (std::shared_ptr <Variant>*)otherAddr;
    std::shared_ptr <Variant>* p = new std::shared_ptr <Variant>(new Variant(**other));
    return (jlong) p;
}

/*
 * Class:     com_intel_vmf_Variant
 * Method:    n_setTo
 * Signature: (JI)V
 */
JNIEXPORT void JNICALL Java_com_intel_vmf_Variant_n_1setTo__JI (JNIEnv *env, jclass, jlong self, jint value)
{
    static const char method_name[] = "Variant::n_1setTo__JI";

    try
    {
        std::shared_ptr <Variant>* obj = (std::shared_ptr <Variant>*)self;
        (**obj) = (int)value;
    }
    catch (const std::exception &e)
    {
        throwJavaException(env, &e, method_name);
    }
    catch (...)
    {
        throwJavaException(env, 0, method_name);
    }
}

/*
 * Class:     com_intel_vmf_Variant
 * Method:    n_setTo
 * Signature: (JF)V
 */
JNIEXPORT void JNICALL Java_com_intel_vmf_Variant_n_1setTo__JF (JNIEnv *env, jclass, jlong self, jfloat value)
{
    static const char method_name[] = "Variant::n_1setTo__JF";

    try
    {
        std::shared_ptr <Variant>* obj = (std::shared_ptr <Variant>*)self;
        (**obj) = (float) value;
    }
    catch (const std::exception &e)
    {
        throwJavaException(env, &e, method_name);
    }
    catch (...)
    {
        throwJavaException(env, 0, method_name);
    }
}

/*
 * Class:     com_intel_vmf_Variant
 * Method:    n_setTo
 * Signature: (J[I)V
 */
JNIEXPORT void JNICALL Java_com_intel_vmf_Variant_n_1setTo__J_3I (JNIEnv *env, jclass, jlong self, jintArray values)
{
    static const char method_name[] = "Variant::n_1setTo__J_3I";

    try
    {
        std::shared_ptr <Variant>* obj = (std::shared_ptr <Variant>*)self;
        std::vector <int> vecValues;
        jint *cArray = env->GetIntArrayElements(values, 0);
        jsize len = env->GetArrayLength(values);

        for (int i = 0; i < len; i++)
        {
            vecValues.push_back((int)cArray[i]);
        }

        env->ReleaseIntArrayElements(values, cArray, 0);
        (**obj) = vecValues;
    }
    catch (const std::exception &e)
    {
        throwJavaException(env, &e, method_name);
    }
    catch (...)
    {
        throwJavaException(env, 0, method_name);
    }
}

/*
 * Class:     com_intel_vmf_Variant
 * Method:    n_setTo
 * Signature: (J[F)V
 */
JNIEXPORT void JNICALL Java_com_intel_vmf_Variant_n_1setTo__J_3F (JNIEnv *env, jclass, jlong self, jfloatArray values)
{
    static const char method_name[] = "Variant::n_1setTo__J_3F";

    try
    {
        std::shared_ptr <Variant>* obj = (std::shared_ptr <Variant>*)self;
        std::vector <float> vecValues;
        jfloat* array = env->GetFloatArrayElements(values, 0);
        jsize len = env->GetArrayLength(values);

        for (int i = 0; i < len; i++)
        {
            float elem = (float)array[i];
            vecValues.push_back(elem);
        }

        env->ReleaseFloatArrayElements(values, array, 0);
        (**obj) = vecValues;
    }
    catch (const std::exception &e)
    {
        throwJavaException(env, &e, method_name);
    }
    catch (...)
    {
        throwJavaException(env, 0, method_name);
    }
}

/*
 * Class:     com_intel_vmf_Variant
 * Method:    n_setTo
 * Signature: (JLjava/lang/String;)V
 */
JNIEXPORT void JNICALL Java_com_intel_vmf_Variant_n_1setTo__JLjava_lang_String_2 (JNIEnv *env, jclass, jlong self, jstring str)
{
    static const char method_name[] = "Variant::n_1setTo__JLjava_lang_String_2";

    try
    {
        std::shared_ptr <Variant>* obj = (std::shared_ptr <Variant>*)self;
        const char* tmp = env->GetStringUTFChars(str, NULL);
        std::string value(tmp);
        (**obj) = value;

        env->ReleaseStringUTFChars(str, tmp);
    }
    catch (const std::exception &e)
    {
        throwJavaException(env, &e, method_name);
    }
    catch (...)
    {
        throwJavaException(env, 0, method_name);
    }
}


/*
* Class:     com_intel_vmf_Variant
* Method:    n_setTo
* Signature: (JD)V
*/
JNIEXPORT void JNICALL Java_com_intel_vmf_Variant_n_1setTo__JD(JNIEnv *env, jclass, jlong self, jdouble value)
{
    static const char method_name[] = "Variant::n_1setTo__JD";

    try
    {
        std::shared_ptr <Variant>* obj = (std::shared_ptr <Variant>*)self;
        (**obj) = (vmf_real)value;<commit_msg>minor change for Variant JNI<commit_after>#include<string>
#include<vector>
#include "vmf/metadatastream.hpp"
#include "../com_intel_vmf_Variant.h"
#include "throwJavaException.hpp"

using namespace vmf;

/*
 * Class:     com_intel_vmf_Variant
 * Method:    n_Variant
 * Signature: ()J
 */
JNIEXPORT jlong JNICALL Java_com_intel_vmf_Variant_n_1Variant__ (JNIEnv *, jclass)
{
    std::shared_ptr <Variant>* p = new std::shared_ptr <Variant>(new Variant());
    return (jlong) p;
} 

/*
 * Class:     com_intel_vmf_Variant
 * Method:    n_Variant
 * Signature: (J)J
 */
JNIEXPORT jlong JNICALL Java_com_intel_vmf_Variant_n_1Variant__J (JNIEnv *, jclass, jlong otherAddr)
{
    std::shared_ptr <Variant>* other = (std::shared_ptr <Variant>*)otherAddr;
    std::shared_ptr <Variant>* p = new std::shared_ptr <Variant>(new Variant(**other));
    return (jlong) p;
}

/*
 * Class:     com_intel_vmf_Variant
 * Method:    n_setTo
 * Signature: (JI)V
 */
JNIEXPORT void JNICALL Java_com_intel_vmf_Variant_n_1setTo__JI (JNIEnv *env, jclass, jlong self, jint value)
{
    static const char method_name[] = "Variant::n_1setTo__JI";

    try
    {
        std::shared_ptr <Variant>* obj = (std::shared_ptr <Variant>*)self;
        (**obj) = (int)value;
    }
    catch (const std::exception &e)
    {
        throwJavaException(env, &e, method_name);
    }
    catch (...)
    {
        throwJavaException(env, 0, method_name);
    }
}

/*
 * Class:     com_intel_vmf_Variant
 * Method:    n_setTo
 * Signature: (JF)V
 */
JNIEXPORT void JNICALL Java_com_intel_vmf_Variant_n_1setTo__JF (JNIEnv *env, jclass, jlong self, jfloat value)
{
    static const char method_name[] = "Variant::n_1setTo__JF";

    try
    {
        std::shared_ptr <Variant>* obj = (std::shared_ptr <Variant>*)self;
        (**obj) = (float) value;
    }
    catch (const std::exception &e)
    {
        throwJavaException(env, &e, method_name);
    }
    catch (...)
    {
        throwJavaException(env, 0, method_name);
    }
}

/*
 * Class:     com_intel_vmf_Variant
 * Method:    n_setTo
 * Signature: (J[I)V
 */
JNIEXPORT void JNICALL Java_com_intel_vmf_Variant_n_1setTo__J_3I (JNIEnv *env, jclass, jlong self, jintArray values)
{
    static const char method_name[] = "Variant::n_1setTo__J_3I";

    try
    {
        std::shared_ptr <Variant>* obj = (std::shared_ptr <Variant>*)self;
        std::vector <int> vecValues;
        jint *cArray = env->GetIntArrayElements(values, 0);
        jsize len = env->GetArrayLength(values);

        for (int i = 0; i < len; i++)
        {
            vecValues.push_back((int)cArray[i]);
        }

        env->ReleaseIntArrayElements(values, cArray, 0);
        (**obj) = vecValues;
    }
    catch (const std::exception &e)
    {
        throwJavaException(env, &e, method_name);
    }
    catch (...)
    {
        throwJavaException(env, 0, method_name);
    }
}

/*
 * Class:     com_intel_vmf_Variant
 * Method:    n_setTo
 * Signature: (J[F)V
 */
JNIEXPORT void JNICALL Java_com_intel_vmf_Variant_n_1setTo__J_3F (JNIEnv *env, jclass, jlong self, jfloatArray values)
{
    static const char method_name[] = "Variant::n_1setTo__J_3F";

    try
    {
        std::shared_ptr <Variant>* obj = (std::shared_ptr <Variant>*)self;
        std::vector <float> vecValues;
        jfloat* array = env->GetFloatArrayElements(values, 0);
        jsize len = env->GetArrayLength(values);

        for (int i = 0; i < len; i++)
        {
            float elem = (float)array[i];
            vecValues.push_back(elem);
        }

        env->ReleaseFloatArrayElements(values, array, 0);
        (**obj) = vecValues;
    }
    catch (const std::exception &e)
    {
        throwJavaException(env, &e, method_name);
    }
    catch (...)
    {
        throwJavaException(env, 0, method_name);
    }
}

/*
 * Class:     com_intel_vmf_Variant
 * Method:    n_setTo
 * Signature: (JLjava/lang/String;)V
 */
JNIEXPORT void JNICALL Java_com_intel_vmf_Variant_n_1setTo__JLjava_lang_String_2 (JNIEnv *env, jclass, jlong self, jstring str)
{
    static const char method_name[] = "Variant::n_1setTo__JLjava_lang_String_2";

    try
    {
        std::shared_ptr <Variant>* obj = (std::shared_ptr <Variant>*)self;
        const char* tmp = env->GetStringUTFChars(str, NULL);
        vmf_string value(tmp);
        (**obj) = value;

        env->ReleaseStringUTFChars(str, tmp);
    }
    catch (const std::exception &e)
    {
        throwJavaException(env, &e, method_name);
    }
    catch (...)
    {
        throwJavaException(env, 0, method_name);
    }
}


/*
* Class:     com_intel_vmf_Variant
* Method:    n_setTo
* Signature: (JD)V
*/
JNIEXPORT void JNICALL Java_com_intel_vmf_Variant_n_1setTo__JD(JNIEnv *env, jclass, jlong self, jdouble value)
{
    static const char method_name[] = "Variant::n_1setTo__JD";

    try
    {
        std::shared_ptr <Variant>* obj = (std::shared_ptr <Variant>*)self;
        (**obj) = (vmf_real)value;
{'fraction_non_alphanumeric': 0.13329275715155203, 'fraction_numerical': 0.006289308176100629, 'mean_word_length': 3.0521989313604605, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 63, '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': '4549198', 'n_tokens_mistral': 3647, 'n_tokens_neox': 3554, 'n_words': 705}