1 package com.github.javaparser.symbolsolver.resolution.typeinference.bounds; 2 3 import com.github.javaparser.resolution.types.ResolvedType; 4 import com.github.javaparser.symbolsolver.resolution.typeinference.Bound; 5 import com.github.javaparser.symbolsolver.resolution.typeinference.InferenceVariable; 6 import com.github.javaparser.symbolsolver.resolution.typeinference.InferenceVariableSubstitution; 7 8 import java.util.List; 9 import java.util.Set; 10 11 /** 12 * Capture(G<A1, ..., An>): The variables α1, ..., αn represent the result of capture conversion (§5.1.10) 13 * applied to G<A1, ..., An> (where A1, ..., An may be types or wildcards and may mention inference variables). 14 * 15 * @author Federico Tomassetti 16 */ 17 public class CapturesBound extends Bound { 18 private List<InferenceVariable> inferenceVariables; 19 private List<ResolvedType> typesOrWildcards; 20 CapturesBound(List<InferenceVariable> inferenceVariables, List<ResolvedType> typesOrWildcards)21 public CapturesBound(List<InferenceVariable> inferenceVariables, List<ResolvedType> typesOrWildcards) { 22 this.inferenceVariables = inferenceVariables; 23 this.typesOrWildcards = typesOrWildcards; 24 } 25 26 @Override isSatisfied(InferenceVariableSubstitution inferenceVariableSubstitution)27 public boolean isSatisfied(InferenceVariableSubstitution inferenceVariableSubstitution) { 28 throw new UnsupportedOperationException(); 29 } 30 31 @Override usedInferenceVariables()32 public Set<InferenceVariable> usedInferenceVariables() { 33 throw new UnsupportedOperationException(); 34 } 35 getInferenceVariables()36 public List<InferenceVariable> getInferenceVariables() { 37 return inferenceVariables; 38 } 39 getTypesOrWildcards()40 public List<ResolvedType> getTypesOrWildcards() { 41 return typesOrWildcards; 42 } 43 44 @Override equals(Object o)45 public boolean equals(Object o) { 46 if (this == o) return true; 47 if (o == null || getClass() != o.getClass()) return false; 48 49 CapturesBound that = (CapturesBound) o; 50 51 if (!inferenceVariables.equals(that.inferenceVariables)) return false; 52 return typesOrWildcards.equals(that.typesOrWildcards); 53 } 54 55 @Override hashCode()56 public int hashCode() { 57 int result = inferenceVariables.hashCode(); 58 result = 31 * result + typesOrWildcards.hashCode(); 59 return result; 60 } 61 62 @Override toString()63 public String toString() { 64 return "CapturesBound{" + 65 "inferenceVariables=" + inferenceVariables + 66 ", typesOrWildcards=" + typesOrWildcards + 67 '}'; 68 } 69 } 70