blob: 8d3382b32b7094f881d08c1796861c9fd03ab6b5 (
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
|
/*
* SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/>
*
* SPDX-License-Identifier: EPL-2.0
*/
package tools.refinery.store.query.term.bool;
import tools.refinery.store.query.substitution.Substitution;
import tools.refinery.store.query.term.Term;
import tools.refinery.store.query.term.UnaryTerm;
public class BoolNotTerm extends UnaryTerm<Boolean, Boolean> {
protected BoolNotTerm(Term<Boolean> body) {
super(Boolean.class, Boolean.class, body);
}
@Override
protected Term<Boolean> doSubstitute(Substitution substitution, Term<Boolean> substitutedBody) {
return new BoolNotTerm(substitutedBody);
}
@Override
protected Boolean doEvaluate(Boolean bodyValue) {
return !bodyValue;
}
@Override
public String toString() {
return "(!%s)".formatted(getBody());
}
}
|