-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy pathFunctionDeclarationImpl.java
More file actions
70 lines (62 loc) · 2.1 KB
/
FunctionDeclarationImpl.java
File metadata and controls
70 lines (62 loc) · 2.1 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// This file is part of JavaSMT,
// an API wrapper for a collection of SMT solvers:
// https://github.com/sosy-lab/java-smt
//
// SPDX-FileCopyrightText: 2026 Dirk Beyer <https://www.sosy-lab.org>
//
// SPDX-License-Identifier: Apache-2.0
package org.sosy_lab.java_smt.basicimpl;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.collect.ImmutableList;
import com.google.errorprone.annotations.Immutable;
import java.util.List;
import org.sosy_lab.java_smt.api.Formula;
import org.sosy_lab.java_smt.api.FormulaType;
import org.sosy_lab.java_smt.api.FunctionDeclaration;
import org.sosy_lab.java_smt.api.FunctionDeclarationKind;
/** Declaration of a function. */
@Immutable(containerOf = "T")
public record FunctionDeclarationImpl<F extends Formula, T>(
FunctionDeclarationKind getKind,
String getName,
ImmutableList<Integer> getIndices,
FormulaType<F> getType,
ImmutableList<FormulaType<?>> getArgumentTypes,
T getSolverDeclaration)
implements FunctionDeclaration<F> {
public FunctionDeclarationImpl {
checkNotNull(getKind);
checkNotNull(getName);
checkNotNull(getIndices);
checkNotNull(getType);
checkNotNull(getArgumentTypes);
checkNotNull(getSolverDeclaration);
}
public static <F extends Formula, T> FunctionDeclarationImpl<F, T> of(
String name,
FunctionDeclarationKind kind,
List<Integer> pIndices,
List<FormulaType<?>> pArgumentTypes,
FormulaType<F> pReturnType,
T pDeclaration) {
return new FunctionDeclarationImpl<>(
kind,
name,
ImmutableList.copyOf(pIndices),
pReturnType,
ImmutableList.copyOf(pArgumentTypes),
pDeclaration);
}
public static <F extends Formula, T> FunctionDeclaration<F> of(
String name,
FunctionDeclarationKind kind,
List<FormulaType<?>> pArgumentTypes,
FormulaType<F> pReturnType,
T pDeclaration) {
return of(name, kind, ImmutableList.of(), pArgumentTypes, pReturnType, pDeclaration);
}
@Override
public String toString() {
return "%s (%s)".formatted(getKind(), getName());
}
}