Package de.monticore.types3.generics
Class TypeParameterRelations
java.lang.Object
de.monticore.types3.generics.TypeParameterRelations
- Direct Known Subclasses:
TypeParameterRelationsDefaultDelegatee
A collection of often used helper functions w.r.t. type parameters;
* Free type variables
* Bound type variables
* Inference variables
* Wildcards
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract <T extends SymTypeExpression>
T_getCaptureConverted(T type) protected abstract Map<SymTypeVariable, SymTypeInferenceVariable> _getFreeVariableReplaceMap(SymTypeExpression type, IBasicSymbolsScope enclosingScope) protected abstract List<SymTypeInferenceVariable> _getIncludedInferenceVariables(Collection<? extends SymTypeExpression> types) protected abstract booleanprotected abstract SymTypeExpression_replaceInferenceVariables(SymTypeExpression type, Map<SymTypeInferenceVariable, ? extends SymTypeExpression> replaceMap) protected abstract SymTypeExpression_replaceTypeVariables(SymTypeExpression type, Map<SymTypeVariable, ? extends SymTypeExpression> replaceMap) static <T extends SymTypeExpression>
TgetCaptureConverted(T type) Capture Conversion (s.protected static TypeParameterRelationsgetFreeVariableReplaceMap(SymTypeExpression type, IBasicSymbolsScope enclosingScope) Returns a map that can be used to replace free type variables with inference variables.static List<SymTypeInferenceVariable> returns all inference variables contained in the SymTypes.static List<SymTypeInferenceVariable> getIncludedInferenceVariables(Collection<? extends SymTypeExpression> types) static booleans.static booleanWhether the SymType contains any wildcards.static voidinit()static booleanDeprecated, for removal: This API element is subject to removal in a future version.static SymTypeExpressionreplaceFreeTypeVariables(SymTypeExpression type, IBasicSymbolsScope enclosingScope) Replaces free type variables with inference variables.static SymTypeExpressionreplaceInferenceVariables(SymTypeExpression type, Map<SymTypeInferenceVariable, ? extends SymTypeExpression> replaceMap) replaces InferenceVariables using a given map e.g.,a, {a->int,b->float} -> inte.g.,List<a>, {a->int} -> List<int>static SymTypeExpressionreplaceTypeVariables(SymTypeExpression type, Map<SymTypeVariable, ? extends SymTypeExpression> replaceMap) replaces bound TypeVariables using a given map e.g.,T, {T->int,U->float} -> inte.g.,List<T>, {T->int} -> List<int>static voidreset()protected static voidsetDelegate(TypeParameterRelations newDelegate)
-
Field Details
-
delegate
-
-
Constructor Details
-
TypeParameterRelations
public TypeParameterRelations()
-
-
Method Details
-
replaceTypeVariables
public static SymTypeExpression replaceTypeVariables(SymTypeExpression type, Map<SymTypeVariable, ? extends SymTypeExpression> replaceMap) replaces bound TypeVariables using a given map e.g.,T, {T->int,U->float} -> inte.g.,List<T>, {T->int} -> List<int> -
_replaceTypeVariables
protected abstract SymTypeExpression _replaceTypeVariables(SymTypeExpression type, Map<SymTypeVariable, ? extends SymTypeExpression> replaceMap) -
replaceInferenceVariables
public static SymTypeExpression replaceInferenceVariables(SymTypeExpression type, Map<SymTypeInferenceVariable, ? extends SymTypeExpression> replaceMap) replaces InferenceVariables using a given map e.g.,a, {a->int,b->float} -> inte.g.,List<a>, {a->int} -> List<int> -
_replaceInferenceVariables
protected abstract SymTypeExpression _replaceInferenceVariables(SymTypeExpression type, Map<SymTypeInferenceVariable, ? extends SymTypeExpression> replaceMap) -
getFreeVariableReplaceMap
public static Map<SymTypeVariable,SymTypeInferenceVariable> getFreeVariableReplaceMap(SymTypeExpression type, IBasicSymbolsScope enclosingScope) Returns a map that can be used to replace free type variables with inference variables.- Parameters:
type- the type (potentially) containing free type variablesenclosingScope- the enclosing scope used to check if the variables are free or bound
-
_getFreeVariableReplaceMap
protected abstract Map<SymTypeVariable,SymTypeInferenceVariable> _getFreeVariableReplaceMap(SymTypeExpression type, IBasicSymbolsScope enclosingScope) -
replaceFreeTypeVariables
public static SymTypeExpression replaceFreeTypeVariables(SymTypeExpression type, IBasicSymbolsScope enclosingScope) Replaces free type variables with inference variables. s.getFreeVariableReplaceMap(SymTypeExpression, IBasicSymbolsScope) -
isInferenceVariable
Deprecated, for removal: This API element is subject to removal in a future version.use type.isInferenceVariable -
getIncludedInferenceVariables
public static List<SymTypeInferenceVariable> getIncludedInferenceVariables(SymTypeExpression... types) returns all inference variables contained in the SymTypes. Inference variable can stem from 1. replacing free type variablesgetFreeVariableReplaceMap(SymTypeExpression, IBasicSymbolsScope)2. capturing wildcardsgetCaptureConverted(SymTypeExpression)In the Java Spec (v.21 chap. 18) types with inference variables would be called "improper". -
getIncludedInferenceVariables
public static List<SymTypeInferenceVariable> getIncludedInferenceVariables(Collection<? extends SymTypeExpression> types) -
_getIncludedInferenceVariables
protected abstract List<SymTypeInferenceVariable> _getIncludedInferenceVariables(Collection<? extends SymTypeExpression> types) -
hasInferenceVariables
-
hasWildcards
Whether the SymType contains any wildcards. -
_hasWildcards
-
getCaptureConverted
Capture Conversion (s. Java Spec 20 5.1.10). Replaces wildcards with fresh type variables. Hint: This is not applied recursively. If no type arguments exist, this is the identity relation. -
_getCaptureConverted
-
init
public static void init() -
reset
public static void reset() -
setDelegate
-
getDelegate
-