diff options
Diffstat (limited to 'subprojects/store-query/src/main/java/tools/refinery/store/query/term/int_/IntTerms.java')
-rw-r--r-- | subprojects/store-query/src/main/java/tools/refinery/store/query/term/int_/IntTerms.java | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/term/int_/IntTerms.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/int_/IntTerms.java new file mode 100644 index 00000000..86594deb --- /dev/null +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/term/int_/IntTerms.java | |||
@@ -0,0 +1,81 @@ | |||
1 | package tools.refinery.store.query.term.int_; | ||
2 | |||
3 | import tools.refinery.store.query.term.*; | ||
4 | |||
5 | public final class IntTerms { | ||
6 | public static final Aggregator<Integer, Integer> INT_SUM = IntSumAggregator.INSTANCE; | ||
7 | public static final Aggregator<Integer, Integer> INT_MIN = IntExtremeValueAggregator.MINIMUM; | ||
8 | public static final Aggregator<Integer, Integer> INT_MAX = IntExtremeValueAggregator.MAXIMUM; | ||
9 | |||
10 | private IntTerms() { | ||
11 | throw new IllegalArgumentException("This is a static utility class and should not be instantiated directly"); | ||
12 | } | ||
13 | |||
14 | public static ConstantTerm<Integer> constant(int value) { | ||
15 | return new ConstantTerm<>(Integer.class, value); | ||
16 | } | ||
17 | |||
18 | public static IntArithmeticUnaryTerm plus(Term<Integer> body) { | ||
19 | return new IntArithmeticUnaryTerm(ArithmeticUnaryOperator.PLUS, body); | ||
20 | } | ||
21 | |||
22 | public static IntArithmeticUnaryTerm minus(Term<Integer> body) { | ||
23 | return new IntArithmeticUnaryTerm(ArithmeticUnaryOperator.MINUS, body); | ||
24 | } | ||
25 | |||
26 | public static IntArithmeticBinaryTerm add(Term<Integer> left, Term<Integer> right) { | ||
27 | return new IntArithmeticBinaryTerm(ArithmeticBinaryOperator.ADD, left, right); | ||
28 | } | ||
29 | |||
30 | public static IntArithmeticBinaryTerm sub(Term<Integer> left, Term<Integer> right) { | ||
31 | return new IntArithmeticBinaryTerm(ArithmeticBinaryOperator.SUB, left, right); | ||
32 | } | ||
33 | |||
34 | public static IntArithmeticBinaryTerm mul(Term<Integer> left, Term<Integer> right) { | ||
35 | return new IntArithmeticBinaryTerm(ArithmeticBinaryOperator.MUL, left, right); | ||
36 | } | ||
37 | |||
38 | public static IntArithmeticBinaryTerm div(Term<Integer> left, Term<Integer> right) { | ||
39 | return new IntArithmeticBinaryTerm(ArithmeticBinaryOperator.DIV, left, right); | ||
40 | } | ||
41 | |||
42 | public static IntArithmeticBinaryTerm pow(Term<Integer> left, Term<Integer> right) { | ||
43 | return new IntArithmeticBinaryTerm(ArithmeticBinaryOperator.POW, left, right); | ||
44 | } | ||
45 | |||
46 | public static IntArithmeticBinaryTerm min(Term<Integer> left, Term<Integer> right) { | ||
47 | return new IntArithmeticBinaryTerm(ArithmeticBinaryOperator.MIN, left, right); | ||
48 | } | ||
49 | |||
50 | public static IntArithmeticBinaryTerm max(Term<Integer> left, Term<Integer> right) { | ||
51 | return new IntArithmeticBinaryTerm(ArithmeticBinaryOperator.MAX, left, right); | ||
52 | } | ||
53 | |||
54 | public static IntComparisonTerm eq(Term<Integer> left, Term<Integer> right) { | ||
55 | return new IntComparisonTerm(ComparisonOperator.EQ, left, right); | ||
56 | } | ||
57 | |||
58 | public static IntComparisonTerm notEq(Term<Integer> left, Term<Integer> right) { | ||
59 | return new IntComparisonTerm(ComparisonOperator.NOT_EQ, left, right); | ||
60 | } | ||
61 | |||
62 | public static IntComparisonTerm less(Term<Integer> left, Term<Integer> right) { | ||
63 | return new IntComparisonTerm(ComparisonOperator.LESS, left, right); | ||
64 | } | ||
65 | |||
66 | public static IntComparisonTerm lessEq(Term<Integer> left, Term<Integer> right) { | ||
67 | return new IntComparisonTerm(ComparisonOperator.LESS_EQ, left, right); | ||
68 | } | ||
69 | |||
70 | public static IntComparisonTerm greater(Term<Integer> left, Term<Integer> right) { | ||
71 | return new IntComparisonTerm(ComparisonOperator.GREATER, left, right); | ||
72 | } | ||
73 | |||
74 | public static IntComparisonTerm greaterEq(Term<Integer> left, Term<Integer> right) { | ||
75 | return new IntComparisonTerm(ComparisonOperator.GREATER_EQ, left, right); | ||
76 | } | ||
77 | |||
78 | public static RealToIntTerm asInt(Term<Double> body) { | ||
79 | return new RealToIntTerm(body); | ||
80 | } | ||
81 | } | ||