blob: 23c6893cd6baa37ace22a340bb61c2ba59df418c (
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.logic.term.real;
import tools.refinery.logic.term.UnaryTerm;
import tools.refinery.logic.substitution.Substitution;
import tools.refinery.logic.term.Term;
public class IntToRealTerm extends UnaryTerm<Double, Integer> {
protected IntToRealTerm(Term<Integer> body) {
super(Double.class, Integer.class, body);
}
@Override
protected Term<Double> doSubstitute(Substitution substitution, Term<Integer> substitutedBody) {
return new IntToRealTerm(substitutedBody);
}
@Override
protected Double doEvaluate(Integer bodyValue) {
return bodyValue.doubleValue();
}
@Override
public String toString() {
return "(%s as real)".formatted(getBody());
}
}
|