auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public List<TransactionInfo> getTransactionsForSegments(Address destination, int requestTopologyId, Set<Integer> segments) throws InterruptedException { if (trace) { log.tracef("Received request for transactions from node %s for segments %s of cache %s with topology id %d", destination, segments, cacheName, requestTopologyId); } final CacheTopology cacheTopology = getCacheTopology(requestTopologyId, destination, true); final ConsistentHash readCh = cacheTopology.getReadConsistentHash(); Set<Integer> ownedSegments = readCh.getSegmentsForOwner(rpcManager.getAddress()); if (!ownedSegments.containsAll(segments)) { segments.removeAll(ownedSegments); throw new IllegalArgumentException("Segments " + segments + " are not owned by " + rpcManager.getAddress()); } List<TransactionInfo> transactions = new ArrayList<TransactionInfo>(); if (configuration.transaction().transactionMode().isTransactional()) { if (!configuration.transaction().transactionProtocol().isTotalOrder()) { collectTransactionsToTransfer(transactions, transactionTable.getRemoteTransactions(), segments, cacheTopology); collectTransactionsToTransfer(transactions, transactionTable.getLocalTransactions(), segments, cacheTopology); } if (trace) { log.tracef("Found %d transaction(s) to transfer", transactions.size()); } } return transactions; }

Target:
public List<TransactionInfo> getTransactionsForSegments(Address destination, int requestTopologyId, Set<Integer> segments) throws InterruptedException { if (trace) { log.tracef("Received request for transactions from node %s for segments %s of cache %s with topology id %d", destination, segments, cacheName, requestTopologyId); } final CacheTopology cacheTopology = getCacheTopology(requestTopologyId, destination, true); final ConsistentHash readCh = cacheTopology.getReadConsistentHash(); Set<Integer> ownedSegments = readCh.getSegmentsForOwner(rpcManager.getAddress()); if (!ownedSegments.containsAll(segments)) { segments.removeAll(ownedSegments); throw new IllegalArgumentException("Segments " + segments + " are not owned by " + rpcManager.getAddress()); } List<TransactionInfo> transactions = new ArrayList<TransactionInfo>(); if (configuration.transaction().transactionMode().isTransactional()) { collectTransactionsToTransfer(transactions, transactionTable.getRemoteTransactions(), segments, cacheTopology); collectTransactionsToTransfer(transactions, transactionTable.getLocalTransactions(), segments, cacheTopology); if (trace) { log.tracef("Found %d transaction(s) to transfer", transactions.size()); } } return transactions; }
Source:
public void registerDataSetObserver(DataSetObserver observer) { try { mDataSetObservable.registerObserver(observer); } catch (IllegalStateException e) { } }

Target:
public void registerDataSetObserver(DataSetObserver observer) { try { mDataSetObservable.registerObserver(observer); } catch (IllegalStateException e) { Log.e(TAG, "Observer " + observer.getClass().getSimpleName() + " could not be registered to " + mDataSetObservable.getClass().getSimpleName()); } }
Source:
void assertNrOfEventListeners(int extra) { Collection<GerritEventListener> gerritEventListeners = getGerritEventListeners(); int nbrOfListeners = extra; nbrOfListeners++; nbrOfListeners++; nbrOfListeners++; nbrOfListeners++; assertEquals(nbrOfListeners, gerritEventListeners.size()); }

Target:
void assertNrOfEventListeners(int extra) { Collection<GerritEventListener> gerritEventListeners = getGerritEventListeners(); int nbrOfListeners = extra; nbrOfListeners++; nbrOfListeners++; nbrOfListeners++; GerritServer server = PluginImpl.getServer_(PluginImpl.DEFAULT_SERVER_NAME); if (server.isConnected() && server.getConfig().isEnableProjectAutoCompletion() && server.isProjectCreatedEventsSupported()) { nbrOfListeners++; } assertEquals(nbrOfListeners, gerritEventListeners.size()); }
Source:
public boolean isSelectQuestionNumberEnabled(int qnNumber) { WebElement qnNumSelect = browser.driver.findElement(By.id("questionnum-" + qnNumber)); return qnNumSelect.isEnabled(); }

Target:
public boolean isSelectQuestionNumberEnabled(int qnNumber) { WebElement qnNumSelect = getSelectQuestionNumberDropdown(qnNumber); return qnNumSelect.isEnabled(); }
Source:
public void stop() { new Thread( "Shutdown Thread" ) { @Override @SuppressFBWarnings("DM_EXIT") @SuppressWarnings("TooBroadCatch") public void run() { BungeeCord.this.isRunning = false; stopListeners(); getLogger().info( "Closing pending connections" ); connectionLock.readLock().lock(); try { getLogger().log( Level.INFO, "Disconnecting {0} connections", connections.size() ); for ( UserConnection user : connections.values() ) { user.disconnect( getTranslation( "restart" ) ); } } finally { connectionLock.readLock().unlock(); } getLogger().info( "Closing IO threads" ); eventLoops.shutdownGracefully(); try { eventLoops.awaitTermination( Long.MAX_VALUE, TimeUnit.NANOSECONDS ); } catch ( InterruptedException ex ) { } if ( reconnectHandler != null ) { getLogger().info( "Saving reconnect locations" ); reconnectHandler.save(); reconnectHandler.close(); } saveThread.cancel(); metricsThread.cancel(); getLogger().info( "Disabling plugins" ); pluginManager.disablePlugins(); getLogger().info( "Thank you and goodbye" ); for ( Handler handler : getLogger().getHandlers() ) { handler.close(); } System.exit( 0 ); } }.start(); }

Target:
public void stop() { new Thread( "Shutdown Thread" ) { @Override @SuppressFBWarnings("DM_EXIT") @SuppressWarnings("TooBroadCatch") public void run() { BungeeCord.this.isRunning = false; stopListeners(); getLogger().info( "Closing pending connections" ); connectionLock.readLock().lock(); try { getLogger().log( Level.INFO, "Disconnecting {0} connections", connections.size() ); for ( UserConnection user : connections.values() ) { user.disconnect( getTranslation( "restart" ) ); } } finally { connectionLock.readLock().unlock(); } getLogger().info( "Closing IO threads" ); eventLoops.shutdownGracefully(); try { eventLoops.awaitTermination( Long.MAX_VALUE, TimeUnit.NANOSECONDS ); } catch ( InterruptedException ex ) { } if ( reconnectHandler != null ) { getLogger().info( "Saving reconnect locations" ); reconnectHandler.save(); reconnectHandler.close(); } saveThread.cancel(); metricsThread.cancel(); getLogger().info( "Disabling plugins" ); for ( Plugin plugin : Lists.reverse( new ArrayList<>( pluginManager.getPlugins() ) ) ) { try { plugin.onDisable(); for ( Handler handler : plugin.getLogger().getHandlers() ) { handler.close(); } } catch ( Throwable t ) { getLogger().log( Level.SEVERE, "Exception disabling plugin " + plugin.getDescription().getName(), t ); } getScheduler().cancel( plugin ); plugin.getExecutorService().shutdownNow(); } getLogger().info( "Thank you and goodbye" ); for ( Handler handler : getLogger().getHandlers() ) { handler.close(); } System.exit( 0 ); } }.start(); }
Source:
public boolean supports(HttpServletRequest request) { String authHeader = request.getHeader(AUTHORIZATION_HEADER); boolean hasCookie = false; if (request.getCookies() != null) { hasCookie = Arrays.stream(request.getCookies()) .anyMatch(c -> c.getName() .equals(AUTHORIZATION_COOKIE)); } if ((authHeader != null && authHeader.startsWith(BEARER_AUTHORIZATION_PREFIX)) || hasCookie) { return true; } return false; }

Target:
public boolean supports(HttpServletRequest request) { boolean hasHeader = false; boolean hasCookie = false; if(request.getHeader(AUTHORIZATION_HEADER) != null) { String authHeader = request.getHeader(AUTHORIZATION_HEADER); hasHeader = StringUtils.isNotBlank(authHeader) && authHeader.startsWith(BEARER_AUTHORIZATION_PREFIX); } else if (request.getCookies() != null) { hasCookie = Arrays.stream(request.getCookies()) .anyMatch(c -> c.getName() .equals(AUTHORIZATION_COOKIE)); } if (hasHeader || hasCookie) { return true; } return false; }
Source:
public LogParserGlobalConfig(JenkinsConfig context) { super(context, "/hudson-plugins-logparser-LogParserPublisher/log-parser"); addButton = control("repeatable-add"); }

Target:
public LogParserGlobalConfig(JenkinsConfig context) { super(context, "/hudson-plugins-logparser-LogParserPublisher/log-parser"); }
Source:
private static boolean matches(@Nonnull Class<?>[] parameterTypes, @Nonnull Object[] parameters, boolean varargs) { if (varargs) { int fixedLen = parameterTypes.length - 1; Class<?> componentType = parameterTypes[fixedLen].getComponentType(); assert componentType != null; int arrayLength = parameters.length - fixedLen; if (arrayLength >= 0) { if (arrayLength == 1 && parameterTypes[fixedLen].isInstance(parameters[fixedLen])) { } else { Object array = Array.newInstance(componentType, arrayLength); for (int i = 0; i < arrayLength; i++) { Array.set(array, i, parameters[fixedLen + i]); } Object[] parameters2 = new Object[fixedLen + 1]; System.arraycopy(parameters, 0, parameters2, 0, fixedLen); parameters2[fixedLen] = array; parameters = parameters2; } } } if (parameters.length != parameterTypes.length) { return false; } for (int i = 0; i < parameterTypes.length; i++) { if (parameters[i] == null) { if (parameterTypes[i].isPrimitive()) { return false; } else { continue; } } if (parameterTypes[i].isInstance(parameters[i])) { continue; } if ( parameterTypes[i].isPrimitive() && parameters[i] != null && isInstancePrimitive(ClassUtils.primitiveToWrapper(parameterTypes[i]), parameters[i]) ) { continue; } if (parameterTypes[i] == String.class && parameters[i] instanceof GString) { continue; } return false; } return true; }

Target:
private static boolean matches(@Nonnull Class<?>[] parameterTypes, @Nonnull Object[] parameters, boolean varargs) { if (varargs) { parameters = parametersForVarargs(parameterTypes, parameters); } if (parameters.length != parameterTypes.length) { return false; } for (int i = 0; i < parameterTypes.length; i++) { if (parameters[i] == null) { if (parameterTypes[i].isPrimitive()) { return false; } else { continue; } } if (parameterTypes[i].isInstance(parameters[i])) { continue; } if ( parameterTypes[i].isPrimitive() && parameters[i] != null && isInstancePrimitive(ClassUtils.primitiveToWrapper(parameterTypes[i]), parameters[i]) ) { continue; } if (parameterTypes[i] == String.class && parameters[i] instanceof GString) { continue; } return false; } return true; }
Source:
public IntegerCopyNumberTransitionProbabilityCacheCollection( @Nonnull final IntegerCopyNumberTransitionMatrixCollection transitionMatrixCollection, final boolean padStates) { sexGenotypeAndContigToTransitionMatrixCacheMap = new HashMap<>(); constructCacheMapFromMatrixCollection(padStates ? transitionMatrixCollection.cloneWithPaddedStates() : transitionMatrixCollection); padded = padStates; if (padded) { maxCopyNumber = transitionMatrixCollection.getMaxCopyNumberInCollection(); } else { maxCopyNumber = 0; } sexGenotypesSet = Collections.unmodifiableSet(transitionMatrixCollection.getSexGenotypes()); contigsSet = Collections.unmodifiableSet(transitionMatrixCollection.getContigs()); }

Target:
public IntegerCopyNumberTransitionProbabilityCacheCollection( @Nonnull final IntegerCopyNumberTransitionMatrixCollection transitionMatrixCollection, final boolean padStates) { Utils.nonNull(transitionMatrixCollection, "The transition matrix cache collection must be non-null"); sexGenotypeAndContigToTransitionMatrixCacheMap = constructCacheMapFromMatrixCollection(padStates ? transitionMatrixCollection.cloneWithPaddedStates() : transitionMatrixCollection); padded = padStates; maxCopyNumber = padded ? transitionMatrixCollection.getMaxCopyNumberInCollection() : UNDEFINED_MAX_COPY_NUMBER; sexGenotypesSet = Collections.unmodifiableSet(transitionMatrixCollection.getSexGenotypes()); contigSet = Collections.unmodifiableSet(transitionMatrixCollection.getContigs()); }
Source:
public SqlDataTypeSpec withNullable(Boolean nullable) { if (nullable.equals(this.nullable)) { return this; } return new SqlDataTypeSpec(collectionsTypeName, typeName, precision, scale, charSetName, timeZone, nullable, getParserPosition()); }

Target:
public SqlDataTypeSpec withNullable(Boolean nullable) { if (Objects.equals(nullable, this.nullable)) { return this; } return new SqlDataTypeSpec(collectionsTypeName, typeName, precision, scale, charSetName, timeZone, nullable, getParserPosition()); }
Source:
public static int[] getDecimalPrecisionAndScale(byte[] bytes, int offset, int length) { if (length == 1 && bytes[offset] == ZERO_BYTE) { return new int[] {0, 0}; } int signum = ((bytes[offset] & 0x80) == 0) ? -1 : 1; int scale; int index; int digitOffset; if (signum == 1) { scale = (byte)(((bytes[offset] & 0x7F) - 65) * -2); index = offset + length; digitOffset = POS_DIGIT_OFFSET; } else { scale = (byte)((~bytes[offset] - 65 - 128) * -2); index = offset + length - (bytes[offset + length - 1] == NEG_TERMINAL_BYTE ? 1 : 0); digitOffset = -NEG_DIGIT_OFFSET; } length = index - offset; int precision = 2 * (length - 1); int d = signum * bytes[--index] - digitOffset; if (d % 10 == 0) { d /= 10; scale--; precision -= 1; } d = signum * bytes[1] - digitOffset; if (d < 10) { precision -= 1; } scale += (length - 2) * 2; if (scale < 0) { precision = precision - scale; scale = 0; } return new int[] {precision, scale}; }

Target:
public static int[] getDecimalPrecisionAndScale(byte[] bytes, int offset, int length) { if (length == 1 && bytes[offset] == ZERO_BYTE) { return new int[] {0, 0}; } int signum = ((bytes[offset] & 0x80) == 0) ? -1 : 1; int scale; int index; int digitOffset; if (signum == 1) { scale = (byte)(((bytes[offset] & 0x7F) - 65) * -2); index = offset + length; digitOffset = POS_DIGIT_OFFSET; } else { scale = (byte)((~bytes[offset] - 65 - 128) * -2); index = offset + length - (bytes[offset + length - 1] == NEG_TERMINAL_BYTE ? 1 : 0); digitOffset = -NEG_DIGIT_OFFSET; } length = index - offset; int precision = 2 * (length - 1); int d = signum * bytes[--index] - digitOffset; if (d % 10 == 0) { d /= 10; scale--; precision -= 1; } d = signum * bytes[offset+1] - digitOffset; if (d < 10) { precision -= 1; } scale += (length - 2) * 2; if (scale < 0) { precision = precision - scale; scale = 0; } return new int[] {precision, scale}; }
Source:
private static OGCGeometry readSimpleGeometry(BasicSliceInput input, Slice inputSlice, GeometryType type, int length) { int currentPosition = toIntExact(input.position()); ByteBuffer geometryBuffer = inputSlice.toByteBuffer(currentPosition, length).slice(); input.setPosition(currentPosition + length); Geometry esriGeometry = local().execute(0, Unknown, geometryBuffer); return createFromEsriGeometry(esriGeometry, type.isMultitype()); }

Target:
private static OGCGeometry readSimpleGeometry(BasicSliceInput input, Slice inputSlice, GeometryType type, int length) { int currentPosition = toIntExact(input.position()); ByteBuffer geometryBuffer = inputSlice.toByteBuffer(currentPosition, length).slice(); input.setPosition(currentPosition + length); Geometry esriGeometry = OperatorImportFromESRIShape.local().execute(0, Unknown, geometryBuffer); return createFromEsriGeometry(esriGeometry, type.isMultitype()); }
Source:
private static Req affirmative(final Comment.Smart comment, final URI home) throws IOException { new Answer(comment).post( true, String.format( QnRelease.PHRASES.getString("QnRelease.start"), home.toASCIIString() ) ); return new Req.Simple( "release", new MapOf<String, String>( new MapEntry<String, String>("head_branch", "master"), new MapEntry<String, String>( "head", String.format( "git@github.com:%s.git", comment.issue().repo().coordinates() ) ) ) ); }

Target:
private static Req affirmative(final Comment.Smart comment, final URI home) throws IOException { new Answer(comment).post( true, String.format( QnRelease.PHRASES.getString("QnRelease.start"), home.toASCIIString() ) ); return new Req.Simple( "release", new SolidMap<String, String>( new MapEntry<String, String>("head_branch", "master"), new MapEntry<String, String>( "head", String.format( "git@github.com:%s.git", comment.issue().repo().coordinates() ) ) ) ); }
Source:
public ClaimsBasedSecurityChannel(Mono<RequestResponseChannel> responseChannelMono, TokenCredential tokenCredential, CbsAuthorizationType authorizationType, AmqpRetryOptions retryOptions) { this.authorizationType = Objects.requireNonNull(authorizationType, "'authorizationType' cannot be null."); this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); this.credential = Objects.requireNonNull(tokenCredential, "'tokenCredential' cannot be null."); this.cbsChannelMono = Objects.requireNonNull(responseChannelMono, "'cbsChannelMono' cannot be null."); }

Target:
public ClaimsBasedSecurityChannel(Mono<RequestResponseChannel> responseChannelMono, TokenCredential tokenCredential, CbsAuthorizationType authorizationType, AmqpRetryOptions retryOptions) { this.authorizationType = Objects.requireNonNull(authorizationType, "'authorizationType' cannot be null."); this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); this.credential = Objects.requireNonNull(tokenCredential, "'tokenCredential' cannot be null."); this.cbsChannelMono = Objects.requireNonNull(responseChannelMono, "'responseChannelMono' cannot be null."); }
Source:
public CompletableFuture<Optional<byte[]>> getRaw(Multihash hash) { return Futures.of(map(hash, h -> { GetObjectRequest get = new GetObjectRequest(bucket, folder + hashToKey(hash)); Histogram.Timer readTimer = readTimerLog.labels(h.toString()).startTimer(); try (S3Object res = s3Client.getObject(get); DataInputStream din = new DataInputStream(new BufferedInputStream(res.getObjectContent()))) { return Optional.of(Serialize.readFully(din)); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } finally { readTimer.observeDuration(); } }, e -> Optional.empty())); }

Target:
public CompletableFuture<Optional<byte[]>> getRaw(Multihash hash) { return Futures.of(map(hash, h -> { GetObjectRequest get = new GetObjectRequest(bucket, folder + hashToKey(hash)); Histogram.Timer readTimer = readTimerLog.labels("read").startTimer(); try (S3Object res = s3Client.getObject(get); DataInputStream din = new DataInputStream(new BufferedInputStream(res.getObjectContent()))) { return Optional.of(Serialize.readFully(din)); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } finally { readTimer.observeDuration(); } }, e -> Optional.empty())); }
Source:
public void getTimestampsForGivenRows() { String expected = "SELECT key, column1, column2 FROM \"foo__bar\"" + " WHERE key = ? LIMIT 100;"; executor.getTimestamps(TABLE_REF, ImmutableList.of(ROW, END_ROW), LIMIT); verify(queryExecutor).prepare(argThat(byteBufferMatcher(expected)), any()); verify(queryExecutor).executePrepared(eq(1), eq(ImmutableList.of(ByteBuffer.wrap(ROW)))); }

Target:
public void getTimestampsForGivenRows() { String expected = "SELECT key, column1, column2 FROM \"foo__bar\"" + " WHERE key = ? LIMIT 100;"; executor.getTimestamps(TABLE_REF, ImmutableList.of(ROW, END_ROW), LIMIT); verify(queryExecutor).prepare(argThat(byteBufferMatcher(expected)), eq(ROW), any()); verify(queryExecutor).executePrepared(eq(1), eq(ImmutableList.of(ByteBuffer.wrap(ROW)))); }
Source:
public static String str(Object x) { if ( x == null ) return "<null>" ; return x.toString() ; }

Target:
public static String str(Object x) { return Objects.toString(x, "<null>"); }
Source:
public void onAttach(Activity activity) { super.onAttach(activity); try { mListener = (ShareFragmentListener) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement OnShareFragmentInteractionListener"); } }

Target:
public void onAttach(Activity activity) { super.onAttach(activity); try { mListener = (ShareFragmentListener) activity; } catch (IllegalStateException e) { throw new IllegalStateException(activity.toString() + " must implement OnShareFragmentInteractionListener"); } }
Source:
public void displaySource(Object element, IWorkbenchPage page, boolean forceSourceLookup) { SCTDebugTarget newTarget = unwrapTarget(element); if (!newTarget.getModelIdentifier().equals(IDebugConstants.ID_DEBUG_MODEL) || newTarget.getDebugTarget().isTerminated()) return; if (newTarget != null && activeDebugTarget != newTarget){ if (activeSourceDisplay != null) activeSourceDisplay.terminate(false); activeSourceDisplay = new SCTSourceDisplay( (ISimulationEngine) newTarget.getAdapter(ISimulationEngine.class)); } try { activeSourceDisplay.displaySource(newTarget, page, forceSourceLookup); activeDebugTarget = newTarget; } catch (RuntimeException e) { if(element instanceof SCTDebugTarget) { try { ((SCTDebugTarget) element).terminate(); } catch (DebugException e2) { throw e; } } } }

Target:
public void displaySource(Object element, IWorkbenchPage page, boolean forceSourceLookup) { SCTDebugTarget newTarget = unwrapTarget(element); if (!newTarget.getModelIdentifier().equals(IDebugConstants.ID_DEBUG_MODEL) || newTarget.getDebugTarget().isTerminated()) return; if (newTarget != null && activeDebugTarget != newTarget){ if (activeSourceDisplay != null) activeSourceDisplay.terminate(false); activeSourceDisplay = new SCTSourceDisplay( (ISimulationEngine) newTarget.getAdapter(ISimulationEngine.class)); } activeSourceDisplay.displaySource(newTarget, page, forceSourceLookup); activeDebugTarget = newTarget; }
Source:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpRequest = (HttpServletRequest) request; Map<String, String> details = new HashMap<String, String>(); details.put("HTTP-Verb", "GET"); details.put("Date", httpRequest.getHeader("Date")); details.put("Authorization", httpRequest.getHeader("Authorization")); details.put("Resource", httpRequest.getRequestURI()); try { Authentication authentication = authenticationManager .authenticate(new ApiUserAuthentication(new ApiUser(), details)); SecurityContextHolder.getContext() .setAuthentication(authentication); } catch (AuthenticationException e) { } chain.doFilter(request, response); }

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpRequest = (HttpServletRequest) request; Map<String, String> details = new HashMap<String, String>(); details.put("HTTP-Verb", httpRequest.getMethod()); details.put("Date", httpRequest.getHeader("Date")); details.put("Authorization", httpRequest.getHeader("Authorization")); details.put("Resource", httpRequest.getRequestURI()); try { Authentication authentication = authenticationManager .authenticate(new ApiUserAuthentication(new ApiUser(), details)); SecurityContextHolder.getContext() .setAuthentication(authentication); } catch (AuthenticationException e) { } chain.doFilter(request, response); }
Source:
public AffineTransform inverse() { double det = this.determinant(); return new AffineTransform( (m11 * m22 - m21 * m12) / det, (m02 * m21 - m22 * m01) / det, (m01 * m12 - m11 * m02) / det, (m01 * (m22 * m13 - m12 * m23) + m02 * (m11 * m23 - m21 * m13) - m03 * (m11 * m22 - m21 * m12)) / det, (m12 * m20 - m22 * m10) / det, (m00 * m22 - m20 * m02) / det, (m02 * m10 - m12 * m00) / det, (m00 * (m12 * m23 - m22 * m13) - m02 * (m10 * m23 - m20 * m13) + m03 * (m10 * m22 - m20 * m12)) / det, (m10 * m21 - m20 * m11) / det, (m01 * m20 - m21 * m00) / det, (m00 * m11 - m10 * m01) / det, (m00 * (m21 * m13 - m11 * m23) + m01 * (m10 * m23 - m20 * m13) - m03 * (m10 * m21 - m20 * m11)) / det); }

Target:
public AffineTransform inverse() { double det = this.determinant(); return new AffineTransform( (m11 * m22 - m21 * m12) / det, (m21 * m02 - m01 * m22) / det, (m01 * m12 - m11 * m02) / det, (m01 * (m22 * m13 - m12 * m23) + m02 * (m11 * m23 - m21 * m13) - m03 * (m11 * m22 - m21 * m12)) / det, (m20 * m12 - m10 * m22) / det, (m00 * m22 - m20 * m02) / det, (m10 * m02 - m00 * m12) / det, (m00 * (m12 * m23 - m22 * m13) - m02 * (m10 * m23 - m20 * m13) + m03 * (m10 * m22 - m20 * m12)) / det, (m10 * m21 - m20 * m11) / det, (m20 * m01 - m00 * m21) / det, (m00 * m11 - m10 * m01) / det, (m00 * (m21 * m13 - m11 * m23) + m01 * (m10 * m23 - m20 * m13) - m03 * (m10 * m21 - m20 * m11)) / det); }
Source:
public synchronized void refreshInternalResourceGroups() { boolean requeue = false; boolean versionChanged = false; int specVersion = configurationManager.get().getSpecVersion(); for (InternalResourceGroup rootGroup : rootGroups) { log.info("Root group" + rootGroup.getId().toString() + " version: " + rootGroup.getVersion() + " latest version: " + rootGroup.getLatest().getVersion()); if (rootGroup.getLatest().getVersion() < specVersion) { versionChanged = true; break; } } if (!versionChanged) { return; } log.info("Version changed, new spec version: " + specVersion); for (ResourceGroupId id : groups.keySet()) { InternalResourceGroup group = groups.get(id).getLatest(); if (group.getVersion() != specVersion) { requeue = true; } createGroupIfNecessary(group, refreshResourceGroupExecutor, specVersion); } if (requeue) { for (ResourceGroupId id : groups.keySet()) { InternalResourceGroup group = groups.get(id).getLatest(); if (group.getPrev().isPresent()) { group.getPrev().get().requeueToNext(); } } } for (InternalResourceGroup group : rootGroups) { while (group.getNext().isPresent()) { group.purgeExpiredResourceGroups(); group = group.getNext().get(); } } }

Target:
public synchronized void refreshInternalResourceGroups() { boolean requeue = false; boolean versionChanged = false; int specVersion = configurationManager.get().getSpecVersion(); for (InternalResourceGroup rootGroup : rootGroups) { if (rootGroup.getLatest().getVersion() < specVersion) { versionChanged = true; break; } } if (!versionChanged) { return; } for (ResourceGroupId id : groups.keySet()) { InternalResourceGroup group = groups.get(id).getLatest(); if (group.getVersion() != specVersion) { requeue = true; } createGroupIfNecessary(group, refreshResourceGroupExecutor, specVersion); } if (requeue) { for (ResourceGroupId id : groups.keySet()) { InternalResourceGroup group = groups.get(id).getLatest(); if (group.getPrev().isPresent()) { group.getPrev().get().requeueToNext(); } } } for (InternalResourceGroup group : rootGroups) { while (group.getNext().isPresent()) { group.purgeExpiredResourceGroups(); group = group.getNext().get(); } } }
Source:
public synchronized IndexWriter getTimestampsWriter() { if (fTimestampsWriter == null) { try { Directory indexDir = FSDirectory .open(Paths.get(fIndexRoot.append(fContainerId) .append(TIMESTAMPS_DIR).toOSString())); IndexWriterConfig config = new IndexWriterConfig( new SimpleAnalyzer()); config.setOpenMode(OpenMode.CREATE_OR_APPEND); fTimestampsWriter = new IndexWriter(indexDir, config); } catch (IOException e) { Logger.logException(e); } } return fTimestampsWriter; }

Target:
public synchronized IndexWriter getTimestampsWriter() { if (fTimestampsWriter == null) { try { Directory indexDir = FSDirectory.open( Paths.get(fIndexRoot, fContainerId, TIMESTAMPS_DIR)); IndexWriterConfig config = new IndexWriterConfig( new SimpleAnalyzer()); config.setOpenMode(OpenMode.CREATE_OR_APPEND); fTimestampsWriter = new IndexWriter(indexDir, config); } catch (IOException e) { Logger.logException(e); } } return fTimestampsWriter; }
Source:
public void verifyPageHeader(String expectedHeader) { waitForElementByXPath(String.format(headerTextSelector, expectedHeader)); }

Target:
public void verifyPageHeader(String expectedHeader) { waitForElementByXPath(String.format(headerTextSelector, expectedHeader)); PageObjectLogging.log( "SpecialPageHeader", "Special Page Header is the same as expected", true, driver ); }
Source:
SecurityWebFilterChain springSecurity(ServerHttpSecurity http) throws Exception { http .authorizeExchange() .anyExchange().access(authorizationManager()) .and() .oauth2ResourceServer() .bearerTokenConverter(bearerTokenAuthenticationConverter()) .jwt() .publicKey(publicKey()); return http.build(); }

Target:
SecurityWebFilterChain springSecurity(ServerHttpSecurity http) throws Exception { http .authorizeExchange() .anyExchange().hasAuthority("SCOPE_message:read") .and() .oauth2ResourceServer() .bearerTokenConverter(bearerTokenAuthenticationConverter()) .jwt() .publicKey(publicKey()); return http.build(); }
Source:
public Object evaluate(String js, IPageContext pageContext) { JSPMultiPageEditor editor = WebUiPlugin.getActiveMultiPageEditor(); if(editor!=null) { IVisualEditor ve = editor.getVisualEditor(); if(ve!=null) { ve.initBrowser(); Object obj = ve.getVisualEditor(); if(obj instanceof VpvEditor) { VpvEditor vpv = (VpvEditor)obj; Browser browser = vpv.getBrowser(); if(browser!=null && !browser.isDisposed()) { Map<String, String> parameters = new HashMap<String, String>(); parameters.put(BrowserDataProviderManager.ELEMENT_ID_PARAM, VpvDomBuilder.ATTR_VPV_ID); Long id = vpv.getCurrentSelectedElementId(); if(id!=null) { parameters.put(BrowserDataProviderManager.ELEMENT_ID_VALUE_PARAM, id.toString()); js = BrowserDataProviderManager.format(js, parameters); return browser.evaluate(js); } } } } } return ""; }

Target:
public Object evaluate(String js, IPageContext pageContext) { JSPMultiPageEditor editor = WebUiPlugin.getActiveMultiPageEditor(); if(editor!=null) { IVisualEditor ve = editor.getVisualEditor(); if(ve!=null) { ve.initBrowser(); Object obj = ve.getVisualEditor(); if(obj instanceof VpvEditor) { VpvEditor vpv = (VpvEditor)obj; Browser browser = vpv.getBrowser(); if(browser!=null && !browser.isDisposed()) { Map<String, String> parameters = new HashMap<String, String>(); parameters.put(BrowserDataProviderManager.ELEMENT_ID_PARAM, VpvDomBuilder.ATTR_VPV_ID); Long id = vpv.getCurrentSelectedElementId(); if(id!=null) { parameters.put(BrowserDataProviderManager.ELEMENT_ID_VALUE_PARAM, id.toString()); js = BrowserDataProviderManager.format(js, parameters); try { return browser.evaluate(js); } catch(SWTException e) { if(e.code != SWT.ERROR_FAILED_EVALUATE && e.code != SWT.ERROR_INVALID_RETURN_VALUE) { Activator.logError(e); } } } } } } } return ""; }
Source:
public Message getValue(Message object) { final Message fieldValue; final Message result; try { fieldValue = (Message) getter.invoke(object); result = fieldValue instanceof Any ? AnyPacker.unpack((Any) fieldValue) : fieldValue; } catch (IllegalAccessException | InvocationTargetException e) { throw wrappedCause(e); } return result; }

Target:
public Optional<Message> getValue(Message object) { final Message fieldValue; final Message result; try { fieldValue = (Message) getter.invoke(object); if (fieldValue instanceof Any) { final Any any = (Any)fieldValue; if (isDefault(any)) { return Optional.absent(); } result = AnyPacker.unpack(any); } else { result = fieldValue; } } catch (IllegalAccessException | InvocationTargetException e) { throw wrappedCause(e); } return Optional.fromNullable(result); }
Source:
public boolean equals(Object o) { boolean equals = this == o || o instanceof URIEditorInput && getURI().equals(((URIEditorInput) o).getURI()); if (equals && o instanceof SessionEditorInput) { EObject input = getInput(false); if (input != null) { SessionEditorInput otherSessionEditorInput = (SessionEditorInput) o; return input.equals(otherSessionEditorInput.getInput(false)); } } return equals; }

Target:
public boolean equals(Object o) { boolean equals = this == o || o instanceof SessionEditorInput && getURI().equals(((SessionEditorInput) o).getURI()); if (equals && o instanceof SessionEditorInput) { EObject input = getInput(false); if (input != null) { SessionEditorInput otherSessionEditorInput = (SessionEditorInput) o; return input.equals(otherSessionEditorInput.getInput(false)); } } return equals; }
Source:
public void renderHead(Component component, IHeaderResponse response) { super.renderHead(component, response); response.render(JavaScriptHeaderItem.forReference(FileUploadGlueJavaScriptResourceReference.get())); response.render(OnDomReadyHeaderItem.forScript(statement(component).render())); Component adresse = new WebMarkupContainer("adresse"); Component complement = new WebMarkupContainer("complement"); int ADRESSE_MAXIMUM_LENGTH = 36; response.render(OnDomReadyHeaderItem.forScript( new JsStatement().$(null).chain( EventsHelper.keyup().chainLabel(), new JsStatement().append("suivant(" + adresse.getMarkupId() + "," + complement.getMarkupId() + "," + ADRESSE_MAXIMUM_LENGTH + ")").render() ).render() )); }

Target:
public void renderHead(Component component, IHeaderResponse response) { super.renderHead(component, response); response.render(JavaScriptHeaderItem.forReference(FileUploadGlueJavaScriptResourceReference.get())); response.render(OnDomReadyHeaderItem.forScript(statement(component).render())); }
Source:
public VariantSourceMongo(IVariantSource variantSource) { this.fileId = variantSource.getFileId(); this.fileName = variantSource.getFileName(); this.studyId = variantSource.getStudyId(); this.studyName = variantSource.getStudyName(); this.type = variantSource.getType(); this.aggregation = variantSource.getAggregation(); this.samplesPosition = new HashMap<>(); Map<String,Integer> samplesPosition = variantSource.getSamplesPosition(); if (samplesPosition != null && !samplesPosition.isEmpty()) { this.samplesPosition.putAll(samplesPosition); } this.metadata = new HashMap<>(); Map<String, Object> metadata = variantSource.getMetadata(); if (metadata != null && !metadata.isEmpty()) { this.metadata.putAll(metadata); } this.stats = (VariantGlobalStatsMongo)(variantSource.getStats()); this.date = variantSource.getDate(); }

Target:
public VariantSourceMongo(IVariantSource variantSource) { this(variantSource.getFileId(), variantSource.getFileName(), variantSource.getStudyId(), variantSource.getStudyName(), variantSource.getType(), variantSource.getAggregation(), variantSource.getSamplesPosition(), variantSource.getMetadata(), new VariantGlobalStatsMongo(variantSource.getStats())); }
Source:
public ItemMarkingInfo getItemMarkingInfo(Context context, Item item) throws SQLException { if (metadataField != null && mapping!=null) { DCValue[] vals = item.getMetadata(metadataField); if (vals.length > 0) { for (DCValue value : vals){ String type = value.value; if (mapping.containsKey(type)){ return mapping.get(type); } } } } return null; }

Target:
public ItemMarkingInfo getItemMarkingInfo(Context context, Item item) throws SQLException { if (metadataField != null && mapping!=null) { DCValue[] vals = item.getMetadataByMetadataString(metadataField); if (vals.length > 0) { for (DCValue value : vals){ String type = value.value; if (mapping.containsKey(type)){ return mapping.get(type); } } } } return null; }
Source:
public void test_futureValueSensitivity_ISDA() { RateObservationFn<RateObservation> mockObs = mock(RateObservationFn.class); PricingEnvironment mockEnv = mock(PricingEnvironment.class); ExpandedFra fraExp = FRA.expand(); double forwardRate = 0.05; LocalDate fixingDate = FRA.getStartDate(); PointSensitivityBuilder snese = IborRateSensitivity.of(FRA.getIndex(), fixingDate, 1d); when(mockObs.rateSensitivity(mockEnv, fraExp.getFloatingRate(), fraExp.getStartDate(), fraExp.getEndDate())) .thenReturn(snese); when(mockObs.rate(mockEnv, fraExp.getFloatingRate(), FRA.getStartDate(), FRA.getEndDate())) .thenReturn(forwardRate); DiscountingExpandedFraPricerFn test = new DiscountingExpandedFraPricerFn(mockObs); PointSensitivities sensitivity = test.futureValueSensitivity(mockEnv, fraExp); double eps = 1.e-7; double fdSense = futureValueFwdSensitivity(FRA, forwardRate, eps); assertEquals(sensitivity.getSensitivities().size(), 1); assertEquals(sensitivity.getSensitivities().get(0).getCurveKey(), FRA.getIndex()); assertEquals(sensitivity.getSensitivities().get(0).getDate(), fixingDate); assertEquals(sensitivity.getSensitivities().get(0).getSensitivity(), fdSense, FRA.getNotional() * eps); }

Target:
public void test_futureValueSensitivity_ISDA() { RateObservationFn<RateObservation> mockObs = mock(RateObservationFn.class); PricingEnvironment mockEnv = mock(PricingEnvironment.class); ExpandedFra fraExp = FRA.expand(); double forwardRate = 0.05; LocalDate fixingDate = FRA.getStartDate(); PointSensitivityBuilder sens = IborRateSensitivity.of(FRA.getIndex(), fixingDate, 1d); when(mockObs.rateSensitivity(mockEnv, fraExp.getFloatingRate(), fraExp.getStartDate(), fraExp.getEndDate())) .thenReturn(sens); when(mockObs.rate(mockEnv, fraExp.getFloatingRate(), FRA.getStartDate(), FRA.getEndDate())) .thenReturn(forwardRate); DiscountingExpandedFraPricerFn test = new DiscountingExpandedFraPricerFn(mockObs); PointSensitivities sensitivity = test.futureValueSensitivity(mockEnv, fraExp); double eps = 1.e-7; double fdSense = futureValueFwdSensitivity(FRA, forwardRate, eps); ImmutableList<PointSensitivity> sensitivities = sensitivity.getSensitivities(); assertEquals(sensitivities.size(), 1); PointSensitivity sensitivity0 = sensitivities.get(0); assertEquals(sensitivity0.getCurveKey(), FRA.getIndex()); assertEquals(sensitivity0.getDate(), fixingDate); assertEquals(sensitivity0.getSensitivity(), fdSense, FRA.getNotional() * eps); }
Source:
public SearchQueryBuilder query(Map<String, Object> q, boolean caseSensitive) { querySpec = new ContainsSearchQuerySpec((String) q.get("value"), caseSensitive); return this; }

Target:
public SearchQueryBuilder query(Map<String, Object> q, boolean caseSensitive) { String value = Preconditions.checkNotNull(q.get("value"), "no value").toString(); querySpec = new ContainsSearchQuerySpec(value, caseSensitive); return this; }
Source:
public static void setVerbose(int n) { m_verbose = n; }

Target:
public void setVerbose(int n) { m_verbose = n; }
Source:
public int addOfficial(Member official) { if(official == null || this.officials.contains(official) || official.getUserType()!=Member.UserType.OFFICIAL) { return -1; } if(this.officials.size() == tournament.getOfficialsPerGame()) { return 0; } this.officials.add(official); return 1; }

Target:
public int addOfficial(Member official) { if(official == null || this.officials.contains(official) || MemberUtils.atLeastOfficial(official)) { return -1; } if(this.officials.size() == tournament.getOfficialsPerGame()) { return 0; } this.officials.add(official); return 1; }
Source:
public double hitRatio() { return ((double) hits()) / (hits() + faults()); }

Target:
public double hitRatio() { return MathUtil.portion( hits(), faults() ); }
Source:
public int getErrorCode() { if (isSuccessful()) { return Activity.RESULT_OK; } else if (mException instanceof NetworkException) { return ErrorCodes.NO_NETWORK; } else { return ErrorCodes.UNKNOWN_ERROR; } }

Target:
public int getErrorCode() { if (isSuccessful()) { return Activity.RESULT_OK; } else { return mException.getErrorCode(); } }
Source:
public void writeLine(String line) throws IOException { try { if (line != null) { writer.write(line); } writer.write('\n'); writer.flush(); } catch (IOException e) { if("Stream closed".equals(e.getMessage())) { throw new ConsumerAlreadyClosedException(e.getMessage()); } throw e; } }

Target:
public void writeLine(String line) throws IOException { if (isOpen) { try { if (line != null) { writer.write(line); } writer.write('\n'); writer.flush(); } catch (IOException e) { if ("Stream closed".equals(e.getMessage())) { throw new ConsumerAlreadyClosedException(e.getMessage()); } throw e; } } }
Source:
public void setUp() throws IOException, InterruptedException { ttsService = new TTSServiceStub(); hliStub = new HumanLanguageInterpreterStub(); voice = new VoiceStub(); registerService(voice); registerService(hliStub); registerService(ttsService); Dictionary<String, Object> config = new Hashtable<String, Object>(); config.put(CONFIG_DEFAULT_TTS, ttsService.getId()); config.put(CONFIG_DEFAULT_HLI, hliStub.getId()); config.put(CONFIG_DEFAULT_VOICE, voice.getUID()); ConfigurationAdmin configAdmin = super.getService(ConfigurationAdmin.class); String pid = "org.eclipse.smarthome.voice"; Configuration configuration = configAdmin.getConfiguration(pid); configuration.update(config); Thread.sleep(100); }

Target:
public void setUp() throws IOException, InterruptedException { ttsService = new TTSServiceStub(); hliStub = new HumanLanguageInterpreterStub(); voice = new VoiceStub(); registerService(voice); registerService(hliStub); registerService(ttsService); Dictionary<String, Object> config = new Hashtable<String, Object>(); config.put(CONFIG_DEFAULT_TTS, ttsService.getId()); config.put(CONFIG_DEFAULT_HLI, hliStub.getId()); config.put(CONFIG_DEFAULT_VOICE, voice.getUID()); ConfigurationAdmin configAdmin = super.getService(ConfigurationAdmin.class); String pid = "org.eclipse.smarthome.voice"; Configuration configuration = configAdmin.getConfiguration(pid); configuration.update(config); }
Source:
public static void initializeIndexIfNeeded(Directory directory, EventContext eventContext) throws IOException { if ( DirectoryReader.indexExists( directory ) ) { return; } try { IndexWriterConfig iwriterConfig = new IndexWriterConfig( AnalyzerConstants.KEYWORD_ANALYZER ) .setOpenMode( OpenMode.CREATE_OR_APPEND ); SleepingLockWrapper delayedDirectory = new SleepingLockWrapper( directory, 2000, 20 ); IndexWriter iw = new IndexWriter( delayedDirectory, iwriterConfig ); iw.close(); } catch (LockObtainFailedException lofe) { log.lockingFailureDuringInitialization( directory.toString() ); } }

Target:
public static void initializeIndexIfNeeded(Directory directory, EventContext eventContext) throws IOException { if ( DirectoryReader.indexExists( directory ) ) { return; } try { IndexWriterConfig iwriterConfig = new IndexWriterConfig( AnalyzerConstants.KEYWORD_ANALYZER ) .setOpenMode( OpenMode.CREATE_OR_APPEND ); SleepingLockWrapper delayedDirectory = new SleepingLockWrapper( directory, 2000, 20 ); IndexWriter iw = new IndexWriter( delayedDirectory, iwriterConfig ); iw.close(); } catch (LockObtainFailedException lofe) { log.lockingFailureDuringInitialization( directory.toString(), eventContext ); } }
Source:
public JSONObject isSerialNumberUnique(HttpSession session, JSONObject json) { if (!json.has("serialNumber") || (json.has("serialNumber") && isStringEmptyOrNull(json.getString("serialNumber")))) { return JSONUtils.SimpleJSONError("Please supply a barcode to lookup."); } try { String serialNumber = json.getString("serialNumber"); String containerId = json.getString("containerId"); Collection<SequencerPartitionContainer<SequencerPoolPartition>> containers = requestManager .listSequencerPartitionContainersByBarcode(serialNumber); Map<String, Object> responseMap = new HashMap<String, Object>(); if (containers.isEmpty()) { responseMap.put("isSerialNumberUnique", true); } else { SequencerPartitionContainer<SequencerPoolPartition> container = new ArrayList<>(containers).get(0); if (containerId != null && !containerId.equals("null") && Long.valueOf(containerId).longValue() == container.getId()) { responseMap.put("isSerialNumberUnique", true); } else { responseMap.put("isSerialNumberUnique", false); } } return JSONUtils.JSONObjectResponse(responseMap); } catch (IOException e) { log.error("unable to lookup barcode", e); return JSONUtils.JSONObjectResponse("error", "Unable to lookup barcode."); } }

Target:
public JSONObject isSerialNumberUnique(HttpSession session, JSONObject json) { if (!json.has("serialNumber") || (json.has("serialNumber") && isStringEmptyOrNull(json.getString("serialNumber")))) { return JSONUtils.SimpleJSONError("Please supply a serial number to lookup."); } String serialNumber = json.getString("serialNumber"); String containerId = json.getString("containerId"); Map<String, Object> responseMap = new HashMap<String, Object>(); try { Collection<SequencerPartitionContainer<SequencerPoolPartition>> containers = requestManager .listSequencerPartitionContainersByBarcode(serialNumber); if (containers.isEmpty()) { responseMap.put("isSerialNumberUnique", true); } else { SequencerPartitionContainer<SequencerPoolPartition> container = new ArrayList<>(containers).get(0); if (containerId != null && !containerId.equals("null") && Long.valueOf(containerId).longValue() == container.getId()) { responseMap.put("isSerialNumberUnique", true); } else { responseMap.put("isSerialNumberUnique", false); } } return JSONUtils.JSONObjectResponse(responseMap); } catch (IOException e) { String err = String.format("Unable to lookup serial number %s.", serialNumber); log.error(err, e); responseMap.put("error", err); responseMap.put("isSerialNumberUnique", false); return JSONUtils.JSONObjectResponse(responseMap); } }
Source:
public Map<String, Integer> getNumberOfTasksAdded() { Map<String, Integer> numberOfTasksAdded = new HashMap<>(); for (TaskWrapper task : tasksAdded) { String queueName = task.getQueueName(); int oldTaskCount = numberOfTasksAdded.computeIfAbsent(queueName, (String key) -> 0); numberOfTasksAdded.put(queueName, oldTaskCount + 1); } return numberOfTasksAdded; }

Target:
public Map<String, Integer> getNumberOfTasksAdded() { Map<String, Integer> numberOfTasksAdded = new HashMap<>(); for (TaskWrapper task : tasksAdded) { String queueName = task.getQueueName(); int oldTaskCount = numberOfTasksAdded.getOrDefault(queueName, 0); numberOfTasksAdded.put(queueName, oldTaskCount + 1); } return numberOfTasksAdded; }
Source:
public Collection<PresentationMessage> getPresentations() { Collection<PresentationMessage> allMessages = new ArrayList<PresentationMessage>(); for (Entry<String, Locale> entry : localizedMap.entrySet()) { PresentationMessageMap codeMessageMap = entry.getValue(); allMessages.addAll(codeMessageMap.values()); } return allMessages; }

Target:
public Collection<PresentationMessage> getPresentations() { Collection<PresentationMessage> allMessages = new Vector<PresentationMessage>(); for (Locale locale : localizedMap.keySet()) { PresentationMessageMap codeMessageMap = localizedMap.get(locale); allMessages.addAll(codeMessageMap.values()); } return allMessages; }
Source:
public static Expr applyUnappliedIdentifiers(Expr expr, Expr.BindingDetails bindingDetails, List<String> toApply) { if (toApply.size() == 0) { return expr; } List<String> unapplied = toApply.stream() .filter(x -> bindingDetails.getRequiredColumnsList().contains(x)) .collect(Collectors.toList()); Expr newExpr = expr.visit( childExpr -> { if (childExpr instanceof ApplyFunctionExpr) { return liftApplyLambda((ApplyFunctionExpr) childExpr, unapplied); } else if (childExpr instanceof FunctionExpr) { FunctionExpr fnExpr = (FunctionExpr) childExpr; Set<Expr> arrayInputs = fnExpr.function.getArrayInputs(fnExpr.args); List<Expr> newArgs = new ArrayList<>(); for (Expr arg : fnExpr.args) { if (arg.getIdentifierIfIdentifier() == null && arrayInputs.contains(arg)) { Expr newArg = applyUnappliedIdentifiers(arg, bindingDetails, unapplied); newArgs.add(newArg); } else { newArgs.add(arg); } } FunctionExpr newFnExpr = new FunctionExpr(fnExpr.function, fnExpr.function.name(), newArgs); return newFnExpr; } return childExpr; } ); Expr.BindingDetails newExprBindings = newExpr.analyzeInputs(); final Set<String> expectedArrays = newExprBindings.getArrayVariables(); List<String> remainingUnappliedArgs = unapplied.stream().filter(x -> !expectedArrays.contains(x)).collect(Collectors.toList()); if (remainingUnappliedArgs.size() == 0) { return newExpr; } return applyUnapplied(newExpr, remainingUnappliedArgs); }

Target:
public static Expr applyUnappliedIdentifiers(Expr expr, Expr.BindingDetails bindingDetails, List<String> toApply) { if (toApply.size() == 0) { return expr; } List<String> unapplied = toApply.stream() .filter(x -> bindingDetails.getRequiredColumns().contains(x)) .collect(Collectors.toList()); Expr newExpr = expr.visit( childExpr -> { if (childExpr instanceof ApplyFunctionExpr) { return liftApplyLambda((ApplyFunctionExpr) childExpr, unapplied); } else if (childExpr instanceof FunctionExpr) { FunctionExpr fnExpr = (FunctionExpr) childExpr; Set<Expr> arrayInputs = fnExpr.function.getArrayInputs(fnExpr.args); List<Expr> newArgs = new ArrayList<>(); for (Expr arg : fnExpr.args) { if (arg.getIdentifierIfIdentifier() == null && arrayInputs.contains(arg)) { Expr newArg = applyUnappliedIdentifiers(arg, bindingDetails, unapplied); newArgs.add(newArg); } else { newArgs.add(arg); } } FunctionExpr newFnExpr = new FunctionExpr(fnExpr.function, fnExpr.function.name(), newArgs); return newFnExpr; } return childExpr; } ); Expr.BindingDetails newExprBindings = newExpr.analyzeInputs(); final Set<String> expectedArrays = newExprBindings.getArrayVariables(); List<String> remainingUnappliedArgs = unapplied.stream().filter(x -> !expectedArrays.contains(x)).collect(Collectors.toList()); if (remainingUnappliedArgs.size() == 0) { return newExpr; } return applyUnapplied(newExpr, remainingUnappliedArgs); }