-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
InferenceVariableSubstitution.java
36 lines (27 loc) · 1.13 KB
/
InferenceVariableSubstitution.java
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
package com.github.javaparser.symbolsolver.resolution.typeinference;
import com.github.javaparser.resolution.types.ResolvedType;
import java.util.LinkedList;
import java.util.List;
/**
* @author Federico Tomassetti
*/
public class InferenceVariableSubstitution {
private final static InferenceVariableSubstitution EMPTY = new InferenceVariableSubstitution();
private List<InferenceVariable> inferenceVariables;
private List<ResolvedType> types;
public static InferenceVariableSubstitution empty() {
return EMPTY;
}
private InferenceVariableSubstitution() {
this.inferenceVariables = new LinkedList<>();
this.types = new LinkedList<>();
}
public InferenceVariableSubstitution withPair(InferenceVariable inferenceVariable, ResolvedType type) {
InferenceVariableSubstitution newInstance = new InferenceVariableSubstitution();
newInstance.inferenceVariables.addAll(this.inferenceVariables);
newInstance.types.addAll(this.types);
newInstance.inferenceVariables.add(inferenceVariable);
newInstance.types.add(type);
return newInstance;
}
}