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

org.datavec.dataframe.columns.LongColumnUtils Maven / Gradle / Ivy

Go to download

High-performance Java Dataframe with integrated columnar storage (fork of tablesaw)

There is a newer version: 0.9.1
Show newest version
package org.datavec.dataframe.columns;

import org.datavec.dataframe.api.LongColumn;
import org.datavec.dataframe.filtering.LongBiPredicate;
import org.datavec.dataframe.filtering.LongPredicate;
import it.unimi.dsi.fastutil.longs.LongIterable;

/**
 * Pre-made predicates for common
 * integer use cases, and
 * other helpful things
 */
public interface LongColumnUtils extends Column, LongIterable {

    LongPredicate isZero = i -> i == 0;

    LongPredicate isNegative = i -> i < 0;

    LongPredicate isPositive = i -> i > 0;

    LongPredicate isNonNegative = i -> i >= 0;

    LongPredicate isEven = i -> (i & 1) == 0;

    LongPredicate isOdd = i -> (i & 1) != 0;

    LongBiPredicate isGreaterThan = (valueToTest, valueToCompareAgainst) -> valueToTest > valueToCompareAgainst;

    LongBiPredicate isGreaterThanOrEqualTo = (valueToTest, valueToCompareAgainst) -> valueToTest >= valueToCompareAgainst;

    LongBiPredicate isLessThan = (valueToTest, valueToCompareAgainst) -> valueToTest < valueToCompareAgainst;

    LongBiPredicate isLessThanOrEqualTo = (valueToTest, valueToCompareAgainst) -> valueToTest <= valueToCompareAgainst;

    LongBiPredicate isNotEqualTo = (long valueToTest, long valueToCompareAgainst) -> valueToTest != valueToCompareAgainst;


    LongBiPredicate isEqualTo = (long valueToTest, long valueToCompareAgainst) -> valueToTest == valueToCompareAgainst;

    LongPredicate isMissing = i -> i == LongColumn.MISSING_VALUE;
    LongPredicate isNotMissing = i -> i != LongColumn.MISSING_VALUE;

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy