blob: 0e4ec5c9eff9d441ee178e94c50a669c4f275d6a (
plain) (
blame)
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
38
39
40
41
42
43
44
45
46
47
|
/*
* SPDX-FileCopyrightText: 2023 The Refinery Authors <https://refinery.tools/>
*
* SPDX-License-Identifier: EPL-2.0
*/
package tools.refinery.store.dse.transition.objectives;
import tools.refinery.store.query.dnf.AnyQuery;
import java.util.Collection;
import java.util.List;
public final class Criteria {
private Criteria() {
throw new IllegalStateException("This is a static utility class and should not be instantiated directly");
}
public static QueryCriterion whenHasMatch(AnyQuery query) {
return new QueryCriterion(query, true);
}
public static QueryCriterion whenNoMatch(AnyQuery query) {
return new QueryCriterion(query, false);
}
public static Criterion and(Criterion... criteria) {
return and(List.of(criteria));
}
public static Criterion and(Collection<? extends Criterion> criteria) {
if (criteria.size() == 1) {
return criteria.iterator().next();
}
return new AndCriterion(criteria);
}
public static Criterion or(Criterion... criteria) {
return or(List.of(criteria));
}
public static Criterion or(Collection<? extends Criterion> criteria) {
if (criteria.size() == 1) {
return criteria.iterator().next();
}
return new OrCriterion(criteria);
}
}
|