// Path: src/org/joml/jre/java/text/DecimalFormat.java
// public class DecimalFormat extends NumberFormat {
// 
//     public DecimalFormat() {
//     }
//     public DecimalFormat(String pattern) {
//     }
//     public DecimalFormat (String pattern, DecimalFormatSymbols symbols) {
//     }
// 
//     public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) {
//         return null;
//     }
//     public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) {
//         return null;
//     }
//     public Number parse(String source, ParsePosition parsePosition) {
//         return null;
//     }
//     public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) {
//         return null;
//     }
//     public Object parseObject(String source, ParsePosition pos) {
//         return null;
//     }
// 
// }
// 
// Path: src/org/joml/jre/java/text/NumberFormat.java
// public abstract class NumberFormat extends Format {
//     public final String format(double number) {
//         return Double.toString(number);
//     }
//     public final String format(long number) {
//         return Long.toString(number);
//     }
// }


import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Arrays;
import java.util.Locale;
/*
 * The MIT License
 *
 * Copyright (c) 2016-2021 JOML
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package org.joml;

//#ifndef __GWT__
//#endif

/**
 * Utility class for reading system properties.
 * 
 * @author Kai Burjack
 */
public final class Options {

    /**
     * Whether certain debugging checks should be made, such as that only direct NIO Buffers are used when Unsafe is active,
     * and a proxy should be created on calls to readOnlyView().
     */
    public static final boolean DEBUG = hasOption(System.getProperty("joml.debug", "false"));

//#ifdef __HAS_UNSAFE__
    /**
     * Whether <i>not</i> to use sun.misc.Unsafe when copying memory with MemUtil.
     */
    public static final boolean NO_UNSAFE = hasOption(System.getProperty("joml.nounsafe", "false"));
    /**
     * Whether to <i>force</i> the use of sun.misc.Unsafe when copying memory with MemUtil.
     */
    public static final boolean FORCE_UNSAFE = hasOption(System.getProperty("joml.forceUnsafe", "false"));
//#endif

    /**
     * Whether fast approximations of some java.lang.Math operations should be used.
     */
    public static final boolean FASTMATH = hasOption(System.getProperty("joml.fastmath", "false"));

    /**
     * When {@link #FASTMATH} is <code>true</code>, whether to use a lookup table for sin/cos.
     */
    public static final boolean SIN_LOOKUP = hasOption(System.getProperty("joml.sinLookup", "false"));

    /**
     * When {@link #SIN_LOOKUP} is <code>true</code>, this determines the table size.
     */
    public static final int SIN_LOOKUP_BITS = Integer.parseInt(System.getProperty("joml.sinLookup.bits", "14"));

//#ifndef __GWT__
    /**
     * Whether to use a {@link NumberFormat} producing scientific notation output when formatting matrix,
     * vector and quaternion components to strings.
     */
    public static final boolean useNumberFormat = hasOption(System.getProperty("joml.format", "true"));
//#endif

//#ifdef __HAS_MATH_FMA__
    /**
     * Whether to try using java.lang.Math.fma() in most matrix/vector/quaternion operations if it is available.
     * If the CPU does <i>not</i> support it, it will be a lot slower than `a*b+c` and potentially generate a lot of memory allocations
     * for the emulation with `java.util.BigDecimal`, though.
     */
    public static final boolean USE_MATH_FMA = hasOption(System.getProperty("joml.useMathFma", "false"));
//#endif

//#ifndef __GWT__
    /**
     * When {@link #useNumberFormat} is <code>true</code> then this determines the number of decimal digits
     * produced in the formatted numbers.
     */
//#else
    /**
     * Determines the number of decimal digits produced in the formatted numbers.
     */
//#endif
    public static final int numberFormatDecimals = Integer.parseInt(System.getProperty("joml.format.decimals", "3"));

    /**
     * The {@link NumberFormat} used to format all numbers throughout all JOML classes.
     */
// Path: src/org/joml/jre/java/text/DecimalFormat.java
// public class DecimalFormat extends NumberFormat {
// 
//     public DecimalFormat() {
//     }
//     public DecimalFormat(String pattern) {
//     }
//     public DecimalFormat (String pattern, DecimalFormatSymbols symbols) {
//     }
// 
//     public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) {
//         return null;
//     }
//     public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) {
//         return null;
//     }
//     public Number parse(String source, ParsePosition parsePosition) {
//         return null;
//     }
//     public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) {
//         return null;
//     }
//     public Object parseObject(String source, ParsePosition pos) {
//         return null;
//     }
// 
// }
// 
// Path: src/org/joml/jre/java/text/NumberFormat.java
// public abstract class NumberFormat extends Format {
//     public final String format(double number) {
//         return Double.toString(number);
//     }
//     public final String format(long number) {
//         return Long.toString(number);
//     }
// }


// Path: src/org/joml/Options.java
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Arrays;
import java.util.Locale;

/*
 * The MIT License
 *
 * Copyright (c) 2016-2021 JOML
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package org.joml;

//#ifndef __GWT__
//#endif

/**
 * Utility class for reading system properties.
 * 
 * @author Kai Burjack
 */
public final class Options {

    /**
     * Whether certain debugging checks should be made, such as that only direct NIO Buffers are used when Unsafe is active,
     * and a proxy should be created on calls to readOnlyView().
     */
    public static final boolean DEBUG = hasOption(System.getProperty("joml.debug", "false"));

//#ifdef __HAS_UNSAFE__
    /**
     * Whether <i>not</i> to use sun.misc.Unsafe when copying memory with MemUtil.
     */
    public static final boolean NO_UNSAFE = hasOption(System.getProperty("joml.nounsafe", "false"));
    /**
     * Whether to <i>force</i> the use of sun.misc.Unsafe when copying memory with MemUtil.
     */
    public static final boolean FORCE_UNSAFE = hasOption(System.getProperty("joml.forceUnsafe", "false"));
//#endif

    /**
     * Whether fast approximations of some java.lang.Math operations should be used.
     */
    public static final boolean FASTMATH = hasOption(System.getProperty("joml.fastmath", "false"));

    /**
     * When {@link #FASTMATH} is <code>true</code>, whether to use a lookup table for sin/cos.
     */
    public static final boolean SIN_LOOKUP = hasOption(System.getProperty("joml.sinLookup", "false"));

    /**
     * When {@link #SIN_LOOKUP} is <code>true</code>, this determines the table size.
     */
    public static final int SIN_LOOKUP_BITS = Integer.parseInt(System.getProperty("joml.sinLookup.bits", "14"));

//#ifndef __GWT__
    /**
     * Whether to use a {@link NumberFormat} producing scientific notation output when formatting matrix,
     * vector and quaternion components to strings.
     */
    public static final boolean useNumberFormat = hasOption(System.getProperty("joml.format", "true"));
//#endif

//#ifdef __HAS_MATH_FMA__
    /**
     * Whether to try using java.lang.Math.fma() in most matrix/vector/quaternion operations if it is available.
     * If the CPU does <i>not</i> support it, it will be a lot slower than `a*b+c` and potentially generate a lot of memory allocations
     * for the emulation with `java.util.BigDecimal`, though.
     */
    public static final boolean USE_MATH_FMA = hasOption(System.getProperty("joml.useMathFma", "false"));
//#endif

//#ifndef __GWT__
    /**
     * When {@link #useNumberFormat} is <code>true</code> then this determines the number of decimal digits
     * produced in the formatted numbers.
     */
//#else
    /**
     * Determines the number of decimal digits produced in the formatted numbers.
     */
//#endif
    public static final int numberFormatDecimals = Integer.parseInt(System.getProperty("joml.format.decimals", "3"));

    /**
     * The {@link NumberFormat} used to format all numbers throughout all JOML classes.
     */
    public static final NumberFormat NUMBER_FORMAT = decimalFormat();