com.github.lwhite1.tablesaw.columns.LongColumnUtils Maven / Gradle / Ivy
package com.github.lwhite1.tablesaw.columns;
import com.github.lwhite1.tablesaw.api.LongColumn;
import com.github.lwhite1.tablesaw.filtering.LongBiPredicate;
import com.github.lwhite1.tablesaw.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 isEqualTo = (long valueToTest, long valueToCompareAgainst) -> valueToTest == valueToCompareAgainst;
LongPredicate isMissing = i -> i == LongColumn.MISSING_VALUE;
LongPredicate isNotMissing = i -> i != LongColumn.MISSING_VALUE;
}