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

org.dflib.range.Range Maven / Gradle / Ivy

There is a newer version: 1.0.0-RC1
Show newest version
package org.dflib.range;

/**
 * @since 0.6
 */
public class Range {

    public static void checkRange(int from, int len, int masterLen) {

        if (from < 0) {
            throw new IllegalArgumentException("Negative 'from' index: " + from);
        }

        if (len < 0) {
            throw new IllegalArgumentException("Negative 'len': " + len);
        }

        if (from > masterLen) {
            throw new IllegalArgumentException("From is out of range: " + from + " (" + masterLen + ")");
        }

        if (from + len > masterLen) {
            throw new IllegalArgumentException("Length is out of range: (" + (from + len) + " > " + masterLen + ")");
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy