From 9c2e5cd65a33879ef5561f7864f2b944e198a593 Mon Sep 17 00:00:00 2001 From: mudathirmahgoub Date: Sun, 24 Oct 2021 15:59:26 -0500 Subject: [PATCH] Delete redundant file option_Info.cpp (#7477) --- src/api/java/jni/option_Info.cpp | 345 ------------------------------- 1 file changed, 345 deletions(-) delete mode 100644 src/api/java/jni/option_Info.cpp diff --git a/src/api/java/jni/option_Info.cpp b/src/api/java/jni/option_Info.cpp deleted file mode 100644 index 4c6025357..000000000 --- a/src/api/java/jni/option_Info.cpp +++ /dev/null @@ -1,345 +0,0 @@ -/****************************************************************************** - * Top contributors (to current version): - * Mudathir Mohamed - * - * This file is part of the cvc5 project. - * - * Copyright (c) 2009-2021 by the authors listed in the file AUTHORS - * in the top-level source directory and their institutional affiliations. - * All rights reserved. See the file COPYING in the top-level source - * directory for licensing information. - * **************************************************************************** - * - * The cvc5 Java API. - */ - -#include "api/cpp/cvc5.h" -#include "api_utilities.h" -#include "io_github_cvc5_api_OptionInfo.h" - -using namespace cvc5::api; - -/* - * Class: io_github_cvc5_api_OptionInfo - * Method: deletePointer - * Signature: (J)V - */ -JNIEXPORT void JNICALL -Java_io_github_cvc5_api_OptionInfo_deletePointer(JNIEnv*, jclass, jlong pointer) -{ - delete reinterpret_cast(pointer); -} - -/* - * Class: io_github_cvc5_api_OptionInfo - * Method: toString - * Signature: (J)Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL -Java_io_github_cvc5_api_OptionInfo_toString(JNIEnv* env, jobject, jlong pointer) -{ - CVC5_JAVA_API_TRY_CATCH_BEGIN; - OptionInfo* current = reinterpret_cast(pointer); - std::stringstream ss; - ss << *current; - return env->NewStringUTF(ss.str().c_str()); - CVC5_JAVA_API_TRY_CATCH_END_RETURN(env, nullptr); -} - -/* - * Class: io_github_cvc5_api_OptionInfo - * Method: getName - * Signature: (J)Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL -Java_io_github_cvc5_api_OptionInfo_getName(JNIEnv* env, jobject, jlong pointer) -{ - CVC5_JAVA_API_TRY_CATCH_BEGIN; - OptionInfo* current = reinterpret_cast(pointer); - return env->NewStringUTF(current->name.c_str()); - CVC5_JAVA_API_TRY_CATCH_END_RETURN(env, nullptr); -} - -/* - * Class: io_github_cvc5_api_OptionInfo - * Method: getAliases - * Signature: (J)[Ljava/lang/String; - */ -JNIEXPORT jobjectArray JNICALL Java_io_github_cvc5_api_OptionInfo_getAliases( - JNIEnv* env, jobject, jlong pointer) -{ - CVC5_JAVA_API_TRY_CATCH_BEGIN; - OptionInfo* current = reinterpret_cast(pointer); - jobjectArray ret = getStringArrayFromStringVector(env, current->aliases); - return ret; - CVC5_JAVA_API_TRY_CATCH_END_RETURN(env, nullptr); -} - -/* - * Class: io_github_cvc5_api_OptionInfo - * Method: getSetByUser - * Signature: (J)Z - */ -JNIEXPORT jboolean JNICALL Java_io_github_cvc5_api_OptionInfo_getSetByUser( - JNIEnv* env, jobject, jlong pointer) -{ - CVC5_JAVA_API_TRY_CATCH_BEGIN; - OptionInfo* current = reinterpret_cast(pointer); - return static_cast(current->setByUser); - CVC5_JAVA_API_TRY_CATCH_END_RETURN(env, static_cast(false)); -} - -/** - * Convert OptionInfo::NumberInfo cpp object to OptionInfo.NumberInfo java - * object - * @tparam T cpp integer types int64_t, uint64_t, etc - * @param env jni environment - * @param optionInfo a java object for this OptionInfo - * @param numberInfoClass the java class for OptionInfo.NumberInfo - * @param methodId a constructor for OptionInfo.NumberInfo - * @param info the cpp OptionInfo::NumberInfo object - * @return a java object of class OptionInfo.NumberInfo - */ -template -jobject getNumberInfoFromInteger(JNIEnv* env, - const _jobject* optionInfo, - jclass numberInfoClass, - jmethodID methodId, - const OptionInfo::NumberInfo& info) -{ - jobject defaultValue = getBigIntegerObject(env, info.defaultValue); - jobject currentValue = getBigIntegerObject(env, info.currentValue); - jobject minimum = nullptr; - if (info.minimum) - { - minimum = getBigIntegerObject(env, *info.minimum); - } - jobject maximum = nullptr; - if (info.maximum) - { - maximum = getBigIntegerObject(env, *info.maximum); - } - jobject ret = env->NewObject(numberInfoClass, - methodId, - optionInfo, - defaultValue, - currentValue, - minimum, - maximum); - - return ret; -} - -template -jobject getNumberInfoFromInteger(JNIEnv* env, - const _jobject* optionInfo, - jclass numberInfoClass, - jmethodID methodId, - const OptionInfo::NumberInfo& info); - -template -jobject getNumberInfoFromInteger(JNIEnv* env, - const _jobject* optionInfo, - jclass numberInfoClass, - jmethodID methodId, - const OptionInfo::NumberInfo& info); - -/* - * Class: io_github_cvc5_api_OptionInfo - * Method: getBaseInfo - * Signature: (J)Lio/github/cvc5/api/BaseInfo; - */ -JNIEXPORT jobject JNICALL Java_io_github_cvc5_api_OptionInfo_getBaseInfo( - JNIEnv* env, jobject optionInfo, jlong pointer) -{ - CVC5_JAVA_API_TRY_CATCH_BEGIN; - OptionInfo* current = reinterpret_cast(pointer); - std::variant, - OptionInfo::ValueInfo, - OptionInfo::NumberInfo, - OptionInfo::NumberInfo, - OptionInfo::NumberInfo, - OptionInfo::ModeInfo> - v = current->valueInfo; - - if (std::holds_alternative(v)) - { - jclass voidInfoClass = - env->FindClass("io/github/cvc5/api/OptionInfo$VoidInfo"); - jmethodID methodId = env->GetMethodID( - voidInfoClass, "", "(Lio/github/cvc5/api/OptionInfo;)V"); - jobject ret = env->NewObject(voidInfoClass, methodId, optionInfo); - return ret; - } - - if (std::holds_alternative>(v) - || std::holds_alternative>(v)) - { - jclass valueInfoClass = - env->FindClass("io/github/cvc5/api/OptionInfo$ValueInfo"); - jmethodID methodId = - env->GetMethodID(valueInfoClass, - "", - "(Lio/github/cvc5/api/OptionInfo;Ljava/lang/" - "Object;Ljava/lang/Object;)V"); - - if (std::holds_alternative>(v)) - { - auto info = std::get>(v); - jobject currentValue = getBooleanObject(env, info.currentValue); - jobject defaultValue = getBooleanObject(env, info.defaultValue); - jobject ret = env->NewObject( - valueInfoClass, methodId, optionInfo, defaultValue, currentValue); - return ret; - } - - if (std::holds_alternative>(v)) - { - auto info = std::get>(v); - jstring defaultValue = env->NewStringUTF(info.defaultValue.c_str()); - jstring currentValue = env->NewStringUTF(info.currentValue.c_str()); - jobject ret = env->NewObject( - valueInfoClass, methodId, optionInfo, defaultValue, currentValue); - return ret; - } - } - - if (std::holds_alternative>(v) - || std::holds_alternative>(v) - || std::holds_alternative>(v)) - { - jclass numberInfoClass = - env->FindClass("io/github/cvc5/api/OptionInfo$NumberInfo"); - jmethodID methodId = env->GetMethodID( - numberInfoClass, - "", - "(Lio/github/cvc5/api/OptionInfo;Ljava/lang/Object;Ljava/lang/" - "Object;Ljava/lang/Object;Ljava/lang/Object;)V"); - - if (std::holds_alternative>(v)) - { - auto info = std::get>(v); - return getNumberInfoFromInteger( - env, optionInfo, numberInfoClass, methodId, info); - } - - if (std::holds_alternative>(v)) - { - auto info = std::get>(v); - return getNumberInfoFromInteger( - env, optionInfo, numberInfoClass, methodId, info); - } - - if (std::holds_alternative>(v)) - { - auto info = std::get>(v); - jobject defaultValue = getDoubleObject(env, info.defaultValue); - jobject currentValue = getDoubleObject(env, info.currentValue); - jobject minimum = nullptr; - if (info.minimum) - { - minimum = getDoubleObject(env, *info.minimum); - } - jobject maximum = nullptr; - if (info.maximum) - { - maximum = getDoubleObject(env, *info.maximum); - } - jobject ret = env->NewObject(numberInfoClass, - methodId, - optionInfo, - defaultValue, - currentValue, - minimum, - maximum); - return ret; - } - } - - if (std::holds_alternative(v)) - { - jclass modeInfoClass = - env->FindClass("io/github/cvc5/api/OptionInfo$ModeInfo"); - jmethodID methodId = env->GetMethodID( - modeInfoClass, - "", - "(Lio/github/cvc5/api/OptionInfo;Ljava/lang/String;Ljava/lang/" - "String;[Ljava/lang/String;)V"); - - auto info = std::get(v); - jstring defaultValue = env->NewStringUTF(info.defaultValue.c_str()); - jstring currentValue = env->NewStringUTF(info.currentValue.c_str()); - jobject stringArray = getStringArrayFromStringVector(env, info.modes); - jobject ret = env->NewObject(modeInfoClass, - methodId, - optionInfo, - defaultValue, - currentValue, - stringArray); - return ret; - } - - return nullptr; - CVC5_JAVA_API_TRY_CATCH_END_RETURN(env, nullptr); -} - -/* - * Class: io_github_cvc5_api_OptionInfo - * Method: booleanValue - * Signature: (J)Z - */ -JNIEXPORT jboolean JNICALL Java_io_github_cvc5_api_OptionInfo_booleanValue( - JNIEnv* env, jobject, jlong pointer) -{ - CVC5_JAVA_API_TRY_CATCH_BEGIN; - OptionInfo* current = reinterpret_cast(pointer); - return static_cast(current->boolValue()); - CVC5_JAVA_API_TRY_CATCH_END_RETURN(env, static_cast(false)); -} - -/* - * Class: io_github_cvc5_api_OptionInfo - * Method: stringValue - * Signature: (J)Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL Java_io_github_cvc5_api_OptionInfo_stringValue( - JNIEnv* env, jobject, jlong pointer) -{ - CVC5_JAVA_API_TRY_CATCH_BEGIN; - OptionInfo* current = reinterpret_cast(pointer); - std::string ret = current->stringValue(); - return env->NewStringUTF(ret.c_str()); - CVC5_JAVA_API_TRY_CATCH_END_RETURN(env, nullptr); -} - -/* - * Class: io_github_cvc5_api_OptionInfo - * Method: intValue - * Signature: (J)Ljava/math/BigInteger; - */ -JNIEXPORT jobject JNICALL -Java_io_github_cvc5_api_OptionInfo_intValue(JNIEnv* env, jobject, jlong pointer) -{ - CVC5_JAVA_API_TRY_CATCH_BEGIN; - OptionInfo* current = reinterpret_cast(pointer); - std::int64_t value = current->intValue(); - jobject ret = getBigIntegerObject(env, value); - return ret; - CVC5_JAVA_API_TRY_CATCH_END_RETURN(env, nullptr); -} - -/* - * Class: io_github_cvc5_api_OptionInfo - * Method: doubleValue - * Signature: (J)D - */ -JNIEXPORT jdouble JNICALL Java_io_github_cvc5_api_OptionInfo_doubleValue( - JNIEnv* env, jobject, jlong pointer) -{ - CVC5_JAVA_API_TRY_CATCH_BEGIN; - OptionInfo* current = reinterpret_cast(pointer); - double ret = current->doubleValue(); - return static_cast(ret); - CVC5_JAVA_API_TRY_CATCH_END_RETURN(env, static_cast(0.0)); -} -- 2.30.2