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

io.deephaven.engine.util.NullSafeAddition Maven / Gradle / Ivy

There is a newer version: 0.37.1
Show newest version
/**
 * Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
 */
package io.deephaven.engine.util;

import io.deephaven.util.QueryConstants;

public class NullSafeAddition {
    public static long plusLong(long a, long b) {
        if (a == QueryConstants.NULL_LONG) {
            return b;
        } else if (b == QueryConstants.NULL_LONG) {
            return a;
        } else {
            return a + b;
        }
    }

    public static long minusLong(long a, long b) {
        if (a == QueryConstants.NULL_LONG) {
            return -b;
        } else if (b == QueryConstants.NULL_LONG) {
            return a;
        } else {
            return a - b;
        }
    }

    public static double plusDouble(double a, double b) {
        if (a == QueryConstants.NULL_DOUBLE) {
            return b;
        } else if (b == QueryConstants.NULL_DOUBLE) {
            return a;
        } else {
            return a + b;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy