Package de.monticore.types3.util
Class FunctionRelations
- java.lang.Object
-
- de.monticore.types3.util.FunctionRelations
-
public class FunctionRelations extends java.lang.Objectcalculates, e.g., whether a function can be called given specified arguments, one may assume this functionality ought to be in SymTypeOfFunction, however, it relies on other functionality in SymTypeRelations, and the behaviour of SymTypeClasses should not be dependent on the current type system (or one would need to pass the SymTypeRelations to the SymTypes) delegate of SymTypeRelations
-
-
Field Summary
Fields Modifier and Type Field Description protected static FunctionRelationsdelegateprotected static java.lang.StringLOG_NAME
-
Constructor Summary
Constructors Constructor Description FunctionRelations()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean_canBeCalledWith(SymTypeOfFunction func, java.util.List<SymTypeExpression> args)protected java.util.Optional<SymTypeOfFunction>_getMostSpecificFunction(java.util.Collection<SymTypeOfFunction> funcs)protected java.util.Optional<SymTypeOfFunction>_getMostSpecificFunctionOrLogError(java.util.Collection<SymTypeOfFunction> funcs)protected boolean_internal_canPotentiallyBeCalledWith(SymTypeOfFunction func, PartialFunctionInfo target)static booleancanBeCalledWith(SymTypeOfFunction func, java.util.List<SymTypeExpression> args)whether the function can be called with the given arguments.protected static FunctionRelationsgetDelegate()static java.util.Optional<SymTypeOfFunction>getMostSpecificFunction(java.util.Collection<SymTypeOfFunction> funcs)s.static java.util.Optional<SymTypeOfFunction>getMostSpecificFunctionOrLogError(java.util.Collection<SymTypeOfFunction> funcs)for overloaded and applicable(!) functions, selects the best fitting one we expect inferred arities (no elliptic functions) simplified version (which can be extended) of: * Java spec v.20 15.12.2.5 * Java spec v.20 18.5.4protected java.util.List<SymTypeOfFunction>getMostSpecificFunctions(java.util.Collection<SymTypeOfFunction> funcs)calculates the most specific functionS(!).static voidinit()static booleaninternal_canPotentiallyBeCalledWith(SymTypeOfFunction func, PartialFunctionInfo target)static booleaninternal_canPotentiallyBeCalledWith(SymTypeOfFunction func, java.util.List<SymTypeExpression> args)does not check the argument types for generic methods s.a.protected java.lang.StringprintFunctionForLog(SymTypeOfFunction func)static voidreset()protected static voidsetDelegate(FunctionRelations newDelegate)
-
-
-
Field Detail
-
LOG_NAME
protected static final java.lang.String LOG_NAME
- See Also:
- Constant Field Values
-
delegate
protected static FunctionRelations delegate
-
-
Method Detail
-
canBeCalledWith
public static boolean canBeCalledWith(SymTypeOfFunction func, java.util.List<SymTypeExpression> args)
whether the function can be called with the given arguments.
-
_canBeCalledWith
protected boolean _canBeCalledWith(SymTypeOfFunction func, java.util.List<SymTypeExpression> args)
-
getMostSpecificFunctionOrLogError
public static java.util.Optional<SymTypeOfFunction> getMostSpecificFunctionOrLogError(java.util.Collection<SymTypeOfFunction> funcs)
for overloaded and applicable(!) functions, selects the best fitting one we expect inferred arities (no elliptic functions) simplified version (which can be extended) of: * Java spec v.20 15.12.2.5 * Java spec v.20 18.5.4
-
getMostSpecificFunction
public static java.util.Optional<SymTypeOfFunction> getMostSpecificFunction(java.util.Collection<SymTypeOfFunction> funcs)
s.getMostSpecificFunctionOrLogError(Collection), does not Log errors
-
_getMostSpecificFunctionOrLogError
protected java.util.Optional<SymTypeOfFunction> _getMostSpecificFunctionOrLogError(java.util.Collection<SymTypeOfFunction> funcs)
-
_getMostSpecificFunction
protected java.util.Optional<SymTypeOfFunction> _getMostSpecificFunction(java.util.Collection<SymTypeOfFunction> funcs)
-
getMostSpecificFunctions
protected java.util.List<SymTypeOfFunction> getMostSpecificFunctions(java.util.Collection<SymTypeOfFunction> funcs)
calculates the most specific functionS(!). This is never required (one only ever needs THE most specific function), except to give better log messages.
-
internal_canPotentiallyBeCalledWith
public static boolean internal_canPotentiallyBeCalledWith(SymTypeOfFunction func, java.util.List<SymTypeExpression> args)
does not check the argument types for generic methods s.a. Java spec 21 15.12.2.1 ignores "potential compatibility" poly expressions
-
internal_canPotentiallyBeCalledWith
public static boolean internal_canPotentiallyBeCalledWith(SymTypeOfFunction func, PartialFunctionInfo target)
-
_internal_canPotentiallyBeCalledWith
protected boolean _internal_canPotentiallyBeCalledWith(SymTypeOfFunction func, PartialFunctionInfo target)
-
printFunctionForLog
protected java.lang.String printFunctionForLog(SymTypeOfFunction func)
-
init
public static void init()
-
reset
public static void reset()
-
setDelegate
protected static void setDelegate(FunctionRelations newDelegate)
-
getDelegate
protected static FunctionRelations getDelegate()
-
-