diff options
Diffstat (limited to 'subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/construction/quasitree/TieBreaker.java')
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/construction/quasitree/TieBreaker.java | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/construction/quasitree/TieBreaker.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/construction/quasitree/TieBreaker.java new file mode 100644 index 00000000..7d015cd4 --- /dev/null +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/construction/quasitree/TieBreaker.java | |||
@@ -0,0 +1,30 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010-2014, Bergmann Gabor, Istvan Rath and Daniel Varro | ||
3 | * This program and the accompanying materials are made available under the | ||
4 | * terms of the Eclipse Public License v. 2.0 which is available at | ||
5 | * http://www.eclipse.org/legal/epl-v20.html. | ||
6 | * | ||
7 | * SPDX-License-Identifier: EPL-2.0 | ||
8 | *******************************************************************************/ | ||
9 | package tools.refinery.interpreter.rete.construction.quasitree; | ||
10 | |||
11 | import java.util.Comparator; | ||
12 | |||
13 | import tools.refinery.interpreter.matchers.psystem.PConstraint; | ||
14 | import tools.refinery.interpreter.rete.util.LexicographicComparator; | ||
15 | |||
16 | /** | ||
17 | * Class providing comparators for breaking ties somewhat more deterministically. | ||
18 | * @author Bergmann Gabor | ||
19 | * | ||
20 | */ | ||
21 | public class TieBreaker { | ||
22 | |||
23 | private TieBreaker() {/*Utility class constructor*/} | ||
24 | |||
25 | public static final Comparator<PConstraint> CONSTRAINT_COMPARATOR = (arg0, arg1) -> arg0.getMonotonousID() - arg1.getMonotonousID(); | ||
26 | |||
27 | public static final Comparator<Iterable<? extends PConstraint>> CONSTRAINT_LIST_COMPARATOR = | ||
28 | new LexicographicComparator<PConstraint>(CONSTRAINT_COMPARATOR); | ||
29 | |||
30 | } | ||