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

com.github.paganini2008.devtools.beans.streaming.Having Maven / Gradle / Ivy

package com.github.paganini2008.devtools.beans.streaming;

import java.util.function.Predicate;

import com.github.paganini2008.devtools.Comparables;

/**
 * 
 * Having
 * 
 * @author Fred Feng
 * 
 * @version 1.0
 */
public abstract class Having {

	public static > Predicate> eq(Calculation calculation, T value) {
		return group -> {
			T result = group.summarize(calculation);
			return Comparables.eq(result, value);
		};
	}

	public static > Predicate> ne(Calculation calculation, T value) {
		return group -> {
			T result = group.summarize(calculation);
			return Comparables.ne(result, value);
		};
	}

	public static > Predicate> between(Calculation calculation, T minValue, T maxValue) {
		return group -> {
			T result = group.summarize(calculation);
			return Comparables.gte(result, minValue) && Comparables.lte(result, maxValue);
		};
	}

	public static > Predicate> lt(Calculation calculation, T value) {
		return group -> {
			T result = group.summarize(calculation);
			return Comparables.lt(result, value);
		};
	}

	public static > Predicate> lte(Calculation calculation, T value) {
		return group -> {
			T result = group.summarize(calculation);
			return Comparables.lte(result, value);
		};
	}

	public static > Predicate> gt(Calculation calculation, T value) {
		return group -> {
			T result = group.summarize(calculation);
			return Comparables.gt(result, value);
		};
	}

	public static > Predicate> gte(Calculation calculation, T value) {
		return group -> {
			T result = group.summarize(calculation);
			return Comparables.gte(result, value);
		};
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy