summaryrefslogtreecommitdiff
path: root/dice/src/main/java/bjc/dicelang/dicev2/ComparePoints.java
blob: 81b5cbe91ea31e947c33d39242a39aa32f2ae1e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package bjc.dicelang.dicev2;

import java.util.function.LongPredicate;

/**
 * Utility class for creating compare points.
 * @author Ben Culkin
 *
 */
public class ComparePoints {
	/**
	 * Create a compare point for checking 'less than'
	 * @param val The value to check if we are less than.
	 * @return A compare point that does the specified check.
	 */
	public static LongPredicate isLess(long val) {
		return (arg) -> arg < val;
	}
	
	/**
	 * Create a compare point for checking 'equals'
	 * @param val The value to check if we are equal to.
	 * @return A compare point that does the specified check.
	 */
	public static LongPredicate isEqual(long val) {
		return (arg) -> arg == val;
	}
	
	/**
	 * Create a compare point for checking 'greater than'
	 * @param val The value to check if we are greater than.
	 * @return A compare point that does the specified check.
	 */
	public static LongPredicate isGreater(long val) {
		return (arg) -> arg > val;
	}
}