auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private List<String> getAllProcessedFiles(BatchSourceContext batchSourceContext) { KeyValueTable table = batchSourceContext.getDataset(excelInputreaderConfig.memoryTableName); List<String> processedFiles = new ArrayList<>(); try (CloseableIterator<KeyValue<byte[], byte[]>> filesIterable = table.scan(null, null)) { while (filesIterable.hasNext()) { KeyValue<byte[], byte[]> file = filesIterable.next(); processedFiles.add(new String(file.getKey(), Charsets.UTF_8)); } } return processedFiles; }

Target:
private List<String> getAllProcessedFiles(BatchSourceContext batchSourceContext) { List<String> processedFiles = new ArrayList<>(); if (!excelInputreaderConfig.reprocess) { KeyValueTable table = batchSourceContext.getDataset(excelInputreaderConfig.memoryTableName); processedFiles = new ArrayList<>(); Calendar cal = Calendar.getInstance(); cal.add(Calendar.DATE, -Integer.valueOf(excelInputreaderConfig.tableExpiryPeriod)); Date expiryDate = cal.getTime(); try (CloseableIterator<KeyValue<byte[], byte[]>> filesIterable = table.scan(null, null)) { while (filesIterable.hasNext()) { KeyValue<byte[], byte[]> file = filesIterable.next(); Long time = Bytes.toLong(file.getValue()); Date processedDate = new Date(time); if (processedDate.before(expiryDate)) { table.delete(file.getKey()); } else { processedFiles.add(new String(file.getKey(), Charsets.UTF_8)); } } } } return processedFiles; }
Source:
Mono<PartitionPublishingProperties> getPartitionPublishingProperties(String partitionId) { PartitionPublishingState publishingState = getClientPartitionPublishingState(partitionId); if (publishingState.isFromLink()) { return Mono.just(publishingState.toPartitionPublishingProperties()); } else { return withRetry(this.getSendLink(partitionId).flatMap(amqpSendLink -> Mono.just(this.getClientPartitionPublishingState(partitionId))), retryOptions.getTryTimeout(), retryPolicy).map( PartitionPublishingState::toPartitionPublishingProperties); } }

Target:
Mono<PartitionPublishingProperties> getPartitionPublishingProperties(String partitionId) { PartitionPublishingState publishingState = getClientPartitionPublishingState(partitionId); if (publishingState.isFromLink()) { return Mono.defer(() -> Mono.just(publishingState.toPartitionPublishingProperties())); } else { return withRetry(getSendLink(partitionId).flatMap(amqpSendLink -> Mono.just(getClientPartitionPublishingState(partitionId))), retryOptions.getTryTimeout(), retryPolicy).map( PartitionPublishingState::toPartitionPublishingProperties); } }
Source:
private void stopJobExecution(final Exception cause) throws Exception { validateRunsInMainThread(); Exception resultingException = null; stopScheduling(cause); disconnectTaskManagerResourceManagerConnections(cause); try { stopJobMasterServices(); } catch (Exception e) { resultingException = e; } ExceptionUtils.tryRethrowException(resultingException); }

Target:
private void stopJobExecution(final Exception cause) throws Exception { validateRunsInMainThread(); stopScheduling(cause); disconnectTaskManagerResourceManagerConnections(cause); Exception resultingException = null; try { stopJobMasterServices(); } catch (Exception e) { resultingException = e; } ExceptionUtils.tryRethrowException(resultingException); }
Source:
public void testWithNullArrays() { final KeySet keySetOriginal = new KeySet(); final byte[] authenticationKey = null; keySetOriginal.setAuthenticationKey(authenticationKey); final byte[] encryptionKey = null; keySetOriginal.setEncryptionKey(encryptionKey); final com.alliander.osgp.domain.core.valueobjects.smartmetering.KeySet keySetMapped = this.mapperFactory .getMapperFacade().map(keySetOriginal, com.alliander.osgp.domain.core.valueobjects.smartmetering.KeySet.class); assertNotNull(keySetMapped); assertNull(keySetMapped.getAuthenticationKey()); assertNull(keySetMapped.getEncryptionKey()); }

Target:
public void testWithNullArrays() { final KeySet keySetOriginal = new KeySet(); final byte[] authenticationKey = null; keySetOriginal.setAuthenticationKey(authenticationKey); final byte[] encryptionKey = null; keySetOriginal.setEncryptionKey(encryptionKey); final com.alliander.osgp.domain.core.valueobjects.smartmetering.KeySet keySetMapped = this.configurationMapper .map(keySetOriginal, com.alliander.osgp.domain.core.valueobjects.smartmetering.KeySet.class); assertNotNull(keySetMapped); assertNull(keySetMapped.getAuthenticationKey()); assertNull(keySetMapped.getEncryptionKey()); }
Source:
public static void main(String... args) throws Exception { Thread.setDefaultUncaughtExceptionHandler((t, e) -> LOGGER.log(Level.SEVERE, "Unhandled exception in thread " + t, e)); Launcher launcher = new Launcher(); CmdLineParser parser = new CmdLineParser(launcher); try { parser.parseArgument(args); launcher.run(); } catch (CmdLineException e) { System.err.println(e.getMessage()); System.err.println("java -jar slave.jar [options...]"); parser.printUsage(System.err); System.err.println(); } }

Target:
public static void main(String... args) throws Exception { Launcher launcher = new Launcher(); CmdLineParser parser = new CmdLineParser(launcher); try { parser.parseArgument(args); launcher.run(); } catch (CmdLineException e) { System.err.println(e.getMessage()); System.err.println("java -jar slave.jar [options...]"); parser.printUsage(System.err); System.err.println(); } }
Source:
public JdbcOptions build() { checkNotNull(dbURL, "No dbURL supplied."); checkNotNull(tableName, "No tableName supplied."); if (this.dialect == null) { Optional<JdbcDialect> optional = JdbcDialects.get(dbURL); this.dialect = optional.orElseGet(() -> { throw new NullPointerException("Unknown dbURL,can not find proper dialect."); }); } if (this.driverName == null) { Optional<String> optional = dialect.defaultDriverName(); this.driverName = optional.orElseGet(() -> { throw new NullPointerException("No driverName supplied."); }); } return new JdbcOptions(dbURL, tableName, driverName, username, password, dialect,connectionCheckTimeoutSeconds); }

Target:
public JdbcOptions build() { checkNotNull(dbURL, "No dbURL supplied."); checkNotNull(tableName, "No tableName supplied."); if (this.dialect == null) { Optional<JdbcDialect> optional = JdbcDialects.get(dbURL); this.dialect = optional.orElseGet(() -> { throw new NullPointerException("Unknown dbURL,can not find proper dialect."); }); } if (this.driverName == null) { Optional<String> optional = dialect.defaultDriverName(); this.driverName = optional.orElseGet(() -> { throw new NullPointerException("No driverName supplied."); }); } return new JdbcOptions(dbURL, tableName, driverName, username, password, dialect, parallelism, connectionCheckTimeoutSeconds); }
Source:
public void testOtherSoundsSettings_touchVibration() throws Exception { Vibrator mVibrator = (Vibrator) getInstrumentation().getTargetContext().getSystemService(Context.VIBRATOR_SERVICE); if (mVibrator.hasVibrator() == false) return; int originalValue = Settings.System.getInt( mContentResolver, Settings.System.HAPTIC_FEEDBACK_ENABLED, -1); assertTrue("Touch vibration does not exist.", originalValue != -1); mBackupUtils.backupNowAndAssertSuccess(SETTINGS_PACKAGE_NAME); boolean ret = Settings.System.putInt( mContentResolver, Settings.System.HAPTIC_FEEDBACK_ENABLED, 1 - originalValue); assertTrue("Toggle Touch vibration fail.", ret); mBackupUtils.restoreAndAssertSuccess(LOCAL_TRANSPORT_TOKEN, SETTINGS_PACKAGE_NAME); int restoreValue = Settings.System.getInt( mContentResolver, Settings.System.HAPTIC_FEEDBACK_ENABLED, -1); assertTrue("Touch vibration restore fail.", originalValue == restoreValue); }

Target:
public void testOtherSoundsSettings_touchVibration() throws Exception { Vibrator mVibrator = (Vibrator) getInstrumentation().getTargetContext().getSystemService(Context.VIBRATOR_SERVICE); if (!mVibrator.hasVibrator()) return; int originalValue = Settings.System.getInt( mContentResolver, Settings.System.HAPTIC_FEEDBACK_ENABLED, -1); assertTrue("Touch vibration does not exist.", originalValue != -1); mBackupUtils.backupNowAndAssertSuccess(SETTINGS_PACKAGE_NAME); boolean ret = Settings.System.putInt( mContentResolver, Settings.System.HAPTIC_FEEDBACK_ENABLED, 1 - originalValue); assertTrue("Toggle Touch vibration fail.", ret); mBackupUtils.restoreAndAssertSuccess(LOCAL_TRANSPORT_TOKEN, SETTINGS_PACKAGE_NAME); int restoreValue = Settings.System.getInt( mContentResolver, Settings.System.HAPTIC_FEEDBACK_ENABLED, -1); assertTrue("Touch vibration restore fail.", originalValue == restoreValue); }
Source:
public static void main(String[] args) { Queue data = Data.data(); System.out.println("Data received"); Filter stage1 = new Stage1(); Filter stage2 = new Stage2(); Process stage3 = new Stage3(); Print stage4 = new Stage4(); buffer1 = new LinkedList(); buffer2 = new LinkedList(); buffer3 = new LinkedList(); buffer4 = new LinkedList(); System.out.println("Buffers initialised"); int time = 1; while (!(data.isEmpty())) { System.out.println("\nTime " + time + " : "); String newData = (String) data.remove(); buffer1.add(newData); if (!buffer4.isEmpty()) { stage4.printData(); } if (!buffer3.isEmpty()) { stage3.process(); System.out.println("Data processed through 3rd stage"); } if (!buffer2.isEmpty()) { stage2.removeChar(); System.out.println("Data filtered through 2nd stage"); } if (!buffer1.isEmpty()) { stage1.removeChar(); System.out.println("Data filtered through 1st stage"); } time++; } while (!buffer4.isEmpty()) { System.out.println("\nTime " + time + " : "); stage4.printData(); if (!buffer3.isEmpty()) { stage3.process(); System.out.println("Data processed through 3rd stage"); } if (!buffer2.isEmpty()) { stage2.removeChar(); System.out.println("Data filtered through 2nd stage"); } if (!buffer1.isEmpty()) { stage1.removeChar(); System.out.println("Data filtered through 1st stage"); } time++; } }

Target:
public static void main(String[] args) throws InterruptedException { Pipeline pipeline = new Pipeline(); pipeline.start(); }
Source:
public Simulation createSimulation(Path context, String dmnFilePath) throws Exception { final FactModelTuple factModelTuple = getFactModelTuple(context, dmnFilePath); Simulation toReturn = new Simulation(); SimulationDescriptor simulationDescriptor = toReturn.getSimulationDescriptor(); ScenarioWithIndex scenarioWithIndex = createScesimDataWithIndex(toReturn, simulationDescriptor, ScenarioWithIndex.class); AtomicInteger id = new AtomicInteger(1); final Collection<FactModelTree> visibleFactTrees = factModelTuple.getVisibleFacts().values(); final Map<String, FactModelTree> hiddenValues = factModelTuple.getHiddenFacts(); visibleFactTrees.stream().sorted((a, b) -> { Type aType = a.getType(); Type bType = b.getType(); return aType.equals(bType) ? 0 : (Type.INPUT.equals(aType) ? -1 : 1); }).forEach(factModelTree -> { FactIdentifier factIdentifier = new FactIdentifier(factModelTree.getFactName(), factModelTree.getFactName()); FactMappingExtractor factMappingExtractor = new FactMappingExtractor(factIdentifier, scenarioWithIndex.getIndex(), id, convert(factModelTree.getType()), simulationDescriptor, scenarioWithIndex.getScesimData()); addFactMapping(factMappingExtractor, factModelTree, new ArrayList<>(), hiddenValues); }); addEmptyColumnsIfNeeded(toReturn, scenarioWithIndex); return toReturn; }

Target:
public Simulation createSimulation(Path context, String dmnFilePath) throws Exception { final FactModelTuple factModelTuple = getFactModelTuple(context, dmnFilePath); Simulation toReturn = new Simulation(); ScesimModelDescriptor simulationDescriptor = toReturn.getScesimModelDescriptor(); ScenarioWithIndex scenarioWithIndex = createScesimDataWithIndex(toReturn, simulationDescriptor, ScenarioWithIndex.class); AtomicInteger id = new AtomicInteger(1); final Collection<FactModelTree> visibleFactTrees = factModelTuple.getVisibleFacts().values(); final Map<String, FactModelTree> hiddenValues = factModelTuple.getHiddenFacts(); visibleFactTrees.stream().sorted((a, b) -> { Type aType = a.getType(); Type bType = b.getType(); return aType.equals(bType) ? 0 : (Type.INPUT.equals(aType) ? -1 : 1); }).forEach(factModelTree -> { FactIdentifier factIdentifier = new FactIdentifier(factModelTree.getFactName(), factModelTree.getFactName()); FactMappingExtractor factMappingExtractor = new FactMappingExtractor(factIdentifier, scenarioWithIndex.getIndex(), id, convert(factModelTree.getType()), simulationDescriptor, scenarioWithIndex.getScesimData()); addFactMapping(factMappingExtractor, factModelTree, new ArrayList<>(), hiddenValues); }); addEmptyColumnsIfNeeded(toReturn, scenarioWithIndex); return toReturn; }
Source:
public byte[] serialize(Object object) { RuntimeException ex = null; ISerializationListener listener = listener(); try { ByteArrayOutputStream buffer = new ByteArrayOutputStream((int)this.bufferSize.bytes()); FSTObjectOutput out = fastSerialConfig.getObjectOutput(buffer); if (listener != null) { out.setListener(new ListenerAdapter(listener)); listener.begin(object); } out.writeObject(object); out.flush(); out.setListener(null); buffer.close(); return buffer.toByteArray(); } catch (RuntimeException e) { throw new Fast2WicketSerialException("serialize", e); } catch (IOException e) { throw new Fast2WicketSerialException("serialize", e); } finally { if (listener != null) { listener.end(object, ex); } } }

Target:
public byte[] serialize(Object object) { Exception exception = null; try { FSTObjectOutput out = fastSerializationConfig.getObjectOutput(); if (listener != null) { out.setListener(new ListenerAdapter(listener)); listener.begin(object); } out.writeObject(object); out.setListener(null); return out.getCopyOfWrittenBuffer(); } catch (Exception e) { exception = e; throw new Fast2WicketSerialException(String.format( "Unable to serialize the object %1$s", object), e); } finally { if (listener != null) { listener.end(object, exception); } } }
Source:
public void checkNotHosted(Tool tool) { if (tool.getMode() == ToolMode.HOSTED) { throw new WebApplicationException("Cannot modify hosted entries this way", HttpStatus.SC_BAD_REQUEST); } }

Target:
public void checkNotHosted(Tool tool) { if (tool.getMode() == ToolMode.HOSTED) { throw new CustomWebApplicationException("Cannot modify hosted entries this way", HttpStatus.SC_BAD_REQUEST); } }
Source:
private <T extends DataWriteCommand & ParamsCommand> CompletableFuture<Void> visitWriteCommand(InvocationContext ctx, T command) throws Throwable { Object retval = ctx.forkInvocationSync(command); if (!isStoreEnabled(command) || ctx.isInTxScope() || !command.isSuccessful()) return ctx.shortCircuit(retval); if (!isProperWriter(ctx, command, command.getKey())) return ctx.shortCircuit(retval); Param<PersistenceMode> persistMode = command.getParams().get(PersistenceMode.ID); switch (persistMode.get()) { case PERSIST: Object key = command.getKey(); CacheEntry entry = ctx.lookupEntry(key); if (entry != null) { if (entry.isRemoved()) { boolean resp = persistenceManager.deleteFromAllStores(key, BOTH); if (trace) getLog().tracef("Removed entry under key %s and got response %s from CacheStore", key, resp); } else if (entry.isChanged()) { storeEntry(ctx, key, command); } } case SKIP: log.trace("Skipping cache store since persistence mode parameter is SKIP"); } return ctx.shortCircuit(retval); }

Target:
private <T extends DataWriteCommand & ParamsCommand> CompletableFuture<Void> visitWriteCommand(InvocationContext ctx, T command) throws Throwable { Object retval = ctx.forkInvocationSync(command); if (!isStoreEnabled(command) || ctx.isInTxScope() || !command.isSuccessful()) return ctx.shortCircuit(retval); if (!isProperWriter(ctx, command, command.getKey())) return ctx.shortCircuit(retval); Param<PersistenceMode> persistMode = command.getParams().get(PersistenceMode.ID); switch (persistMode.get()) { case PERSIST: Object key = command.getKey(); CacheEntry entry = ctx.lookupEntry(key); if (entry != null) { if (entry.isRemoved()) { boolean resp = persistenceManager.deleteFromAllStores(key, BOTH); if (trace) getLog().tracef("Removed entry under key %s and got response %s from CacheStore", key, resp); } else if (entry.isChanged()) { storeEntry(ctx, key, command); } break; } case SKIP: log.trace("Skipping cache store since persistence mode parameter is SKIP"); } return ctx.shortCircuit(retval); }
Source:
protected void update(float percent) { sprite.look.updateLookIfSizeIsZero(); float width = sprite.look.getWidthInUserInterfaceDimensionUnit(); float height = sprite.look.getHeightInUserInterfaceDimensionUnit(); float xPosition = sprite.look.getXInUserInterfaceDimensionUnit(); float yPosition = sprite.look.getYInUserInterfaceDimensionUnit(); int halfVirtualScreenWidth = ProjectManager.getInstance().getCurrentProject().getXmlHeader().virtualScreenWidth / 2; int halfVirtualScreenHeight = ProjectManager.getInstance().getCurrentProject().getXmlHeader().virtualScreenHeight / 2; float newDirection = sprite.look.getDirectionInUserInterfaceDimensionUnit(); if (xPosition < -halfVirtualScreenWidth + width / 2) { if (isLookingLeft(newDirection)) { newDirection = -newDirection; fireBounceEvent(); } xPosition = -halfVirtualScreenWidth + (width / 2); } else if (xPosition > halfVirtualScreenWidth - width / 2) { if (isLookingRight(newDirection)) { newDirection = -newDirection; fireBounceEvent(); } xPosition = halfVirtualScreenWidth - (width / 2); } if (yPosition < -halfVirtualScreenHeight + height / 2) { if (isLookingDown(newDirection)) { newDirection = 180f - newDirection; fireBounceEvent(); } yPosition = -halfVirtualScreenHeight + (height / 2); } else if (yPosition > halfVirtualScreenHeight - height / 2) { if (isLookingUp(newDirection)) { newDirection = 180f - newDirection; fireBounceEvent(); } yPosition = halfVirtualScreenHeight - (height / 2); } sprite.look.setDirectionInUserInterfaceDimensionUnit(newDirection); sprite.look.setPositionInUserInterfaceDimensionUnit(xPosition, yPosition); }

Target:
protected void update(float percent) { float width = sprite.look.getWidthInUserInterfaceDimensionUnit(); float height = sprite.look.getHeightInUserInterfaceDimensionUnit(); float xPosition = sprite.look.getXInUserInterfaceDimensionUnit(); float yPosition = sprite.look.getYInUserInterfaceDimensionUnit(); int halfVirtualScreenWidth = ProjectManager.getInstance().getCurrentProject().getXmlHeader().virtualScreenWidth / 2; int halfVirtualScreenHeight = ProjectManager.getInstance().getCurrentProject().getXmlHeader().virtualScreenHeight / 2; float newDirection = sprite.look.getDirectionInUserInterfaceDimensionUnit(); if (xPosition < -halfVirtualScreenWidth + width / 2) { if (isLookingLeft(newDirection)) { newDirection = -newDirection; fireBounceEvent(); } xPosition = -halfVirtualScreenWidth + (width / 2); } else if (xPosition > halfVirtualScreenWidth - width / 2) { if (isLookingRight(newDirection)) { newDirection = -newDirection; fireBounceEvent(); } xPosition = halfVirtualScreenWidth - (width / 2); } if (yPosition < -halfVirtualScreenHeight + height / 2) { if (isLookingDown(newDirection)) { newDirection = 180f - newDirection; fireBounceEvent(); } yPosition = -halfVirtualScreenHeight + (height / 2); } else if (yPosition > halfVirtualScreenHeight - height / 2) { if (isLookingUp(newDirection)) { newDirection = 180f - newDirection; fireBounceEvent(); } yPosition = halfVirtualScreenHeight - (height / 2); } sprite.look.setDirectionInUserInterfaceDimensionUnit(newDirection); sprite.look.setPositionInUserInterfaceDimensionUnit(xPosition, yPosition); }
Source:
public void testHelpTopic() { String dir = System.getProperty("user.dir"); IPath wsRoot = new Path(dir); IPath testRoot = wsRoot.append("javadoc_root"); IPreferenceStore ps = JavaDocPlugin.getDefault().getPreferenceStore(); ps.setValue(PreferenceConstants.JAVADOCS_DIRECTORY, testRoot.toOSString()); JavaDocToc toc = new JavaDocToc(); ITopic[] topics = toc.getTopics(); assertTrue(topics.length > 0); assertTrue(topics.length == 1); ITopic topicJnr = topics[0]; assertTrue(topicJnr.getLabel().startsWith("jnr-unixsocket")); ITopic[] subtopicsJnr = topicJnr.getSubtopics(); assertTrue(subtopicsJnr.length == 0); IUAElement[] elementsJnr = topicJnr.getChildren(); assertTrue(elementsJnr.length == 0); String hrefApache = topicJnr.getHref(); assertEquals(hrefApache, "org.eclipse.linuxtools.javadocs/jnr-unixsocket/index.html"); assertTrue(topicJnr.isEnabled(null)); }

Target:
public void testHelpTopic() throws IOException { String testDocLoc = "/javadoc_root"; String dir = FileLocator.toFileURL( this.getClass().getResource(testDocLoc)).getPath(); IPath wsRoot = new Path(dir); IPreferenceStore ps = JavaDocPlugin.getDefault().getPreferenceStore(); ps.setValue(PreferenceConstants.JAVADOCS_DIRECTORY, wsRoot.toOSString()); JavaDocToc toc = new JavaDocToc(); ITopic[] topics = toc.getTopics(); assertTrue(topics.length > 0); assertTrue(topics.length == 1); ITopic topicJnr = topics[0]; assertTrue(topicJnr.getLabel().startsWith("jnr-unixsocket")); ITopic[] subtopicsJnr = topicJnr.getSubtopics(); assertTrue(subtopicsJnr.length == 0); IUAElement[] elementsJnr = topicJnr.getChildren(); assertTrue(elementsJnr.length == 0); String hrefApache = topicJnr.getHref(); assertEquals(hrefApache, "org.eclipse.linuxtools.javadocs/jnr-unixsocket/index.html"); assertTrue(topicJnr.isEnabled(null)); }
Source:
public void givenThread_WhenExchangedMessage_thenCorrect() throws InterruptedException, ExecutionException { Exchanger<String> exchanger = new Exchanger<>(); Runnable runner = () -> { try { String message = exchanger.exchange("from runner"); assertEquals("to runner", message); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); } }; CompletableFuture<Void> result = CompletableFuture.runAsync(runner); String msg = exchanger.exchange("to runner"); assertEquals("from runner", msg); CompletableFuture.allOf(result).get(); }

Target:
public void givenThread_WhenExchangedMessage_thenCorrect() throws InterruptedException, ExecutionException { Exchanger<String> exchanger = new Exchanger<>(); Runnable runner = () -> { try { String message = exchanger.exchange("from runner"); assertEquals("to runner", message); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); } }; CompletableFuture<Void> result = CompletableFuture.runAsync(runner); String msg = exchanger.exchange("to runner"); assertEquals("from runner", msg); result.join(); }
Source:
public static SortedMap<String, Charset> requiredCharsets() { return Collections.unmodifiableSortedMap(REQUIRED_CHARSETS); }

Target:
public static SortedMap<String, Charset> requiredCharsets() { return REQUIRED_CHARSETS; }
Source:
private void showInfoPopup(View view) { if (!isAdded() || view == null) return; if (mInfoPopupWindow == null) { mInfoPopupWindow = new PopupWindow(getActivity()); mInfoPopupWindow.setWidth(WindowManager.LayoutParams.WRAP_CONTENT); mInfoPopupWindow.setHeight(WindowManager.LayoutParams.WRAP_CONTENT); mInfoPopupWindow.setBackgroundDrawable(new ColorDrawable(0)); mInfoPopupWindow.setOutsideTouchable(true); mInfoPopupWindow.setFocusable(true); LayoutInflater inflater = (LayoutInflater)getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); View popupView = inflater.inflate(R.layout.popup_info, null); mInfoPopupWindow.setContentView(popupView); } updateInfoPopup(); mInfoPopupWindow.showAsDropDown(view); }

Target:
private void showInfoPopup(View view) { if (!isAdded() || view == null) return; if (mInfoPopupWindow == null) { mInfoPopupWindow = new PopupWindow(getActivity()); mInfoPopupWindow.setWidth(WindowManager.LayoutParams.WRAP_CONTENT); mInfoPopupWindow.setHeight(WindowManager.LayoutParams.WRAP_CONTENT); mInfoPopupWindow.setBackgroundDrawable(new ColorDrawable(0)); mInfoPopupWindow.setOutsideTouchable(true); mInfoPopupWindow.setFocusable(true); LayoutInflater inflater = LayoutInflater.from(getActivity()); View popupView = inflater.inflate(R.layout.popup_info, null); mInfoPopupWindow.setContentView(popupView); } updateInfoPopup(); mInfoPopupWindow.showAsDropDown(view); }
Source:
public void testDoesNotFire() { tester.assertThat(new RemoveDistinctFromSemiJoin()) .on(p -> { Symbol sourceKey = p.symbol("custkey", BigintType.BIGINT); Symbol filteringSourceKey = p.symbol("custkey_1", BigintType.BIGINT); Symbol outputKey = p.symbol("orderkey", BigintType.BIGINT); return p.semiJoin( p.tableScan("orders", ImmutableMap.of("custkey", "custkey")), p.project(Assignments.of(filteringSourceKey, expression("x")), p.aggregation(ab -> ab.step(AggregationNode.Step.SINGLE) .groupingSets(ImmutableList.of(ImmutableList.of(filteringSourceKey))) .addAggregation(p.symbol("max", BigintType.BIGINT), expression("max(custkey_1)"), ImmutableList.of(BIGINT)) .source(p.tableScan("customer", ImmutableMap.of("custkey_1", "custkey"))) .build()) ), sourceKey, filteringSourceKey, outputKey ); }).doesNotFire(); }

Target:
public void testDoesNotFire() { tester.assertThat(new RemoveDistinctFromSemiJoin()) .on(p -> { Symbol sourceKey = p.symbol("custkey", BigintType.BIGINT); Symbol filteringSourceKey = p.symbol("custkey_1", BigintType.BIGINT); Symbol outputKey = p.symbol("orderkey", BigintType.BIGINT); return p.semiJoin( p.tableScan( new TableHandle( new ConnectorId("local"), new TpchTableHandle("local", "orders", TINY_SCALE_FACTOR)), ImmutableList.of(sourceKey), ImmutableMap.of(sourceKey, new TpchColumnHandle("custkey", BIGINT))), p.project(Assignments.of(filteringSourceKey, expression("x")), p.aggregation(ab -> ab.step(AggregationNode.Step.SINGLE) .groupingSets(ImmutableList.of(ImmutableList.of(filteringSourceKey))) .addAggregation(p.symbol("max", BigintType.BIGINT), expression("max(custkey_1)"), ImmutableList.of(BIGINT)) .source(p.tableScan( new TableHandle( new ConnectorId("local"), new TpchTableHandle("local", "customer", TINY_SCALE_FACTOR)), ImmutableList.of(filteringSourceKey), ImmutableMap.of(filteringSourceKey, new TpchColumnHandle("custkey", BIGINT))) ) .build()) ), sourceKey, filteringSourceKey, outputKey ); }).doesNotFire(); }
Source:
private Collection<Problem> parseContestProblems(XmlNode problemsNode, String rootDirectory) throws AppException { if (problemsNode == null) { throw new AppException("Invalid XmlNode."); } Collection<Problem> contestProblems = new ArrayList<>(); for (XmlNode node : problemsNode.getChildList()) { Problem problem = parseContestProblem(rootDirectory + "/" + node.getInnerText().trim()); contestProblems.add(problem); } return contestProblems; }

Target:
private ArrayList<ProblemDTO> parseContestProblems(XmlNode problemsNode, String rootDirectory) throws AppException { AppExceptionUtil.assertNotNull(problemsNode); ArrayList<ProblemDTO> contestProblems = new ArrayList<>(); for (XmlNode node : problemsNode.getChildList()) { String problemDirectory = rootDirectory + "/" + node.getInnerText().trim(); ProblemDTO problem = parseContestProblem(problemDirectory); problemDataDirectories.add(problemDirectory.replaceFirst(settings.SETTING_UPLOAD_FOLDER, "")); contestProblems.add(problem); } return contestProblems; }
Source:
private ShadowDocument.Update createShadowDOMUpdate() { verifyThreadAccess(); if (mDocumentProvider.getRootElement() != mShadowDOM.getRootElement()) { throw new IllegalStateException(); } ArrayListAccumulator<Object> childrenAccumulator = acquireChildrenAccumulator(); ShadowDocument.UpdateBuilder updateBuilder = mShadowDOM.beginUpdate(); Queue<Object> queue = new ArrayDeque<>(); queue.add(mDocumentProvider.getRootElement()); while (!queue.isEmpty()) { final Object element = queue.remove(); NodeDescriptor descriptor = mDocumentProvider.getNodeDescriptor(element); mObjectIdMapper.putObject(element); descriptor.getChildren(element, childrenAccumulator); updateBuilder.setElementChildren(element, childrenAccumulator); for (int i = 0, N = childrenAccumulator.size(); i < N; ++i) { queue.add(childrenAccumulator.get(i)); } childrenAccumulator.clear(); } releaseChildrenAccumulator(childrenAccumulator); return updateBuilder.build(); }

Target:
private ShadowDocument.Update createShadowDOMUpdate() { verifyThreadAccess(); if (mDocumentProvider.getRootElement() != mShadowDocument.getRootElement()) { throw new IllegalStateException(); } ArrayListAccumulator<Object> childrenAccumulator = acquireChildrenAccumulator(); ShadowDocument.UpdateBuilder updateBuilder = mShadowDocument.beginUpdate(); mCachedUpdateQueue.add(mDocumentProvider.getRootElement()); while (!mCachedUpdateQueue.isEmpty()) { final Object element = mCachedUpdateQueue.remove(); NodeDescriptor descriptor = mDocumentProvider.getNodeDescriptor(element); mObjectIdMapper.putObject(element); descriptor.getChildren(element, childrenAccumulator); updateBuilder.setElementChildren(element, childrenAccumulator); for (int i = 0, N = childrenAccumulator.size(); i < N; ++i) { mCachedUpdateQueue.add(childrenAccumulator.get(i)); } childrenAccumulator.clear(); } releaseChildrenAccumulator(childrenAccumulator); return updateBuilder.build(); }
Source:
public GetHealthStatusResponse dequeueGetHealthResponse( final String correlationUid ) throws OsgpException { LOGGER.debug( "dequeueGetHealthRequest called with correlation uid {}", correlationUid ); return (GetHealthStatusResponse) processResponse( correlationUid ); }

Target:
public GetHealthStatusResponse dequeueGetHealthResponse(final String correlationUid) throws OsgpException { LOGGER.debug("dequeueGetHealthResponse called with correlation uid {}", correlationUid); return (GetHealthStatusResponse) processResponse(correlationUid); }
Source:
private void placeBlock(ItemStack item, Block facedBlock, Dispenser dispenser) { BlockPlacerPlaceEvent e = new BlockPlacerPlaceEvent(dispenser.getBlock(), item, facedBlock); Bukkit.getPluginManager().callEvent(e); if(!dispenser.getInventory().getViewers().isEmpty()){ e.setCancelled(true); } if (!e.isCancelled()) { facedBlock.setType(item.getType()); if (item.hasItemMeta()) { ItemMeta meta = item.getItemMeta(); if (meta.hasDisplayName()) { BlockStateSnapshotResult blockState = PaperLib.getBlockState(facedBlock, false); if ((blockState.getState() instanceof Nameable)) { Nameable nameable = ((Nameable) blockState.getState()); nameable.setCustomName(meta.getDisplayName()); if (blockState.isSnapshot()) { blockState.getState().update(true, false); } } } } facedBlock.getWorld().playEffect(facedBlock.getLocation(), Effect.STEP_SOUND, item.getType()); if (dispenser.getInventory().containsAtLeast(item, 2)) { dispenser.getInventory().removeItem(new CustomItem(item, 1)); } else { SlimefunPlugin.runSync(() -> dispenser.getInventory().removeItem(item), 2L); } } }

Target:
private void placeBlock(ItemStack item, Block facedBlock, Dispenser dispenser) { BlockPlacerPlaceEvent e = new BlockPlacerPlaceEvent(dispenser.getBlock(), item, facedBlock); Bukkit.getPluginManager().callEvent(e); if (!e.isCancelled()) { facedBlock.setType(item.getType()); if (item.hasItemMeta()) { ItemMeta meta = item.getItemMeta(); if (meta.hasDisplayName()) { BlockStateSnapshotResult blockState = PaperLib.getBlockState(facedBlock, false); if ((blockState.getState() instanceof Nameable)) { Nameable nameable = ((Nameable) blockState.getState()); nameable.setCustomName(meta.getDisplayName()); if (blockState.isSnapshot()) { blockState.getState().update(true, false); } } } } facedBlock.getWorld().playEffect(facedBlock.getLocation(), Effect.STEP_SOUND, item.getType()); if (dispenser.getInventory().containsAtLeast(item, 2)) { dispenser.getInventory().removeItem(new CustomItem(item, 1)); } else { SlimefunPlugin.runSync(() -> dispenser.getInventory().removeItem(item), 2L); } } }
Source:
private static String buildComment(AllergyIntolerance allergyIntolerance) { if (CollectionUtils.isNotEmpty(allergyIntolerance.getNote())) { return allergyIntolerance.getNoteFirstRep().getText(); } return null; }

Target:
private static String buildComment(AllergyIntolerance allergyIntolerance) { return (CollectionUtils.isNotEmpty(allergyIntolerance.getNote())) ? allergyIntolerance.getNoteFirstRep().getText() : null; }