All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.java.ao.util.DoubleUtils Maven / Gradle / Ivy

Go to download

This is the core library for Active Objects. It is generic and can be embedded in any environment. As such it is generic and won't contain all connection pooling, etc.

There is a newer version: 6.1.1
Show newest version
package net.java.ao.util;

import net.java.ao.ActiveObjectsException;

/**
 * @since version
 */
public class DoubleUtils {
    public static final double MAX_VALUE = 3.40282347e+38;
    //the smallest possible ACTUAL number
    public static final double MIN_VALUE = -MAX_VALUE;

    public static Double checkDouble(Double d) {
        if (d.compareTo(MAX_VALUE) > 0) {
            throw new ActiveObjectsException("The max value of double allowed with Active Objects is " + MAX_VALUE + ", checked double is " + d);
        }

        if (d.compareTo(MIN_VALUE) < 0) {
            throw new ActiveObjectsException("The min value of double allowed with Active Objects is " + MIN_VALUE + ", checked double is " + d);
        }
        return d;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy