@Test void resolve_function_signature_exactly_match() { when(functionSignature.match(exactlyMatchFS)).thenReturn(WideningTypeRule.TYPE_EQUAL); FunctionResolver resolver = new FunctionResolver(functionName, ImmutableMap.of(exactlyMatchFS, exactlyMatchBuilder)); assertEquals(exactlyMatchBuilder, resolver.resolve(functionSignature)); }
public FunctionBuilder resolve(FunctionSignature unresolvedSignature) { PriorityQueue<Map.Entry<Integer, FunctionSignature>> functionMatchQueue = new PriorityQueue<>( Map.Entry.comparingByKey()); for (FunctionSignature functionSignature : functionBundle.keySet()) { functionMatchQueue.add( new AbstractMap.SimpleEntry<>(unresolvedSignature.match(functionSignature), functionSignature)); } Map.Entry<Integer, FunctionSignature> bestMatchEntry = functionMatchQueue.peek(); if (FunctionSignature.NOT_MATCH.equals(bestMatchEntry.getKey())) { throw new ExpressionEvaluationException( String.format("%s function expected %s, but get %s", functionName, formatFunctions(functionBundle.keySet()), unresolvedSignature.formatTypes() )); } else { return functionBundle.get(bestMatchEntry.getValue()); } }
FunctionResolver { public FunctionBuilder resolve(FunctionSignature unresolvedSignature) { PriorityQueue<Map.Entry<Integer, FunctionSignature>> functionMatchQueue = new PriorityQueue<>( Map.Entry.comparingByKey()); for (FunctionSignature functionSignature : functionBundle.keySet()) { functionMatchQueue.add( new AbstractMap.SimpleEntry<>(unresolvedSignature.match(functionSignature), functionSignature)); } Map.Entry<Integer, FunctionSignature> bestMatchEntry = functionMatchQueue.peek(); if (FunctionSignature.NOT_MATCH.equals(bestMatchEntry.getKey())) { throw new ExpressionEvaluationException( String.format("%s function expected %s, but get %s", functionName, formatFunctions(functionBundle.keySet()), unresolvedSignature.formatTypes() )); } else { return functionBundle.get(bestMatchEntry.getValue()); } } }
FunctionResolver { public FunctionBuilder resolve(FunctionSignature unresolvedSignature) { PriorityQueue<Map.Entry<Integer, FunctionSignature>> functionMatchQueue = new PriorityQueue<>( Map.Entry.comparingByKey()); for (FunctionSignature functionSignature : functionBundle.keySet()) { functionMatchQueue.add( new AbstractMap.SimpleEntry<>(unresolvedSignature.match(functionSignature), functionSignature)); } Map.Entry<Integer, FunctionSignature> bestMatchEntry = functionMatchQueue.peek(); if (FunctionSignature.NOT_MATCH.equals(bestMatchEntry.getKey())) { throw new ExpressionEvaluationException( String.format("%s function expected %s, but get %s", functionName, formatFunctions(functionBundle.keySet()), unresolvedSignature.formatTypes() )); } else { return functionBundle.get(bestMatchEntry.getValue()); } }  }
FunctionResolver { public FunctionBuilder resolve(FunctionSignature unresolvedSignature) { PriorityQueue<Map.Entry<Integer, FunctionSignature>> functionMatchQueue = new PriorityQueue<>( Map.Entry.comparingByKey()); for (FunctionSignature functionSignature : functionBundle.keySet()) { functionMatchQueue.add( new AbstractMap.SimpleEntry<>(unresolvedSignature.match(functionSignature), functionSignature)); } Map.Entry<Integer, FunctionSignature> bestMatchEntry = functionMatchQueue.peek(); if (FunctionSignature.NOT_MATCH.equals(bestMatchEntry.getKey())) { throw new ExpressionEvaluationException( String.format("%s function expected %s, but get %s", functionName, formatFunctions(functionBundle.keySet()), unresolvedSignature.formatTypes() )); } else { return functionBundle.get(bestMatchEntry.getValue()); } }  FunctionBuilder resolve(FunctionSignature unresolvedSignature); }
FunctionResolver { public FunctionBuilder resolve(FunctionSignature unresolvedSignature) { PriorityQueue<Map.Entry<Integer, FunctionSignature>> functionMatchQueue = new PriorityQueue<>( Map.Entry.comparingByKey()); for (FunctionSignature functionSignature : functionBundle.keySet()) { functionMatchQueue.add( new AbstractMap.SimpleEntry<>(unresolvedSignature.match(functionSignature), functionSignature)); } Map.Entry<Integer, FunctionSignature> bestMatchEntry = functionMatchQueue.peek(); if (FunctionSignature.NOT_MATCH.equals(bestMatchEntry.getKey())) { throw new ExpressionEvaluationException( String.format("%s function expected %s, but get %s", functionName, formatFunctions(functionBundle.keySet()), unresolvedSignature.formatTypes() )); } else { return functionBundle.get(bestMatchEntry.getValue()); } }  FunctionBuilder resolve(FunctionSignature unresolvedSignature);  }