summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/ai/fdsolver/constraint/LessThanConst.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jrummikub/ai/fdsolver/constraint/LessThanConst.java')
-rw-r--r--src/jrummikub/ai/fdsolver/constraint/LessThanConst.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/jrummikub/ai/fdsolver/constraint/LessThanConst.java b/src/jrummikub/ai/fdsolver/constraint/LessThanConst.java
new file mode 100644
index 0000000..18d8827
--- /dev/null
+++ b/src/jrummikub/ai/fdsolver/constraint/LessThanConst.java
@@ -0,0 +1,18 @@
+package jrummikub.ai.fdsolver.constraint;
+
+import java.util.Collection;
+
+import jrummikub.ai.fdsolver.Propagator;
+import jrummikub.ai.fdsolver.Solver;
+import jrummikub.ai.fdsolver.Var;
+
+public class LessThanConst<T extends Comparable<T>> extends FilterConstraint<T> {
+ public LessThanConst(final boolean allowEqual, Var<T> x, final T y) {
+ super(new Filter<T>() {
+ @Override
+ public boolean accept(T value) {
+ return value.compareTo(y) < (allowEqual ? 1 : 0);
+ }
+ }, x);
+ }
+}