auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private boolean recordPvenRouteStatusChangeForPaymentWorksIsEnabled() { return (getPaymentWorksBatchUtilityService().retrievePaymentWorksParameterValue(PaymentWorksParameterConstants.PMW_INTEGRATION_IS_ACTIVE_IND).equalsIgnoreCase(KFSConstants.ParameterValues.YES) ? true : false); }

Target:
private boolean recordPvenRouteStatusChangeForPaymentWorksIsEnabled() { return (getPaymentWorksBatchUtilityService().retrievePaymentWorksParameterValue(PaymentWorksParameterConstants.PMW_INTEGRATION_IS_ACTIVE_IND).equalsIgnoreCase(KFSConstants.ParameterValues.YES)); }
Source:
public StateStatus getCurrentState() { if (CollectionUtils.isNotEmpty(states)) { for (StateStatus state : states) { if (state.endDate == null) { return state; } } } return null; }

Target:
public StateStatus getCurrentState() { StateStatus result = null; if (CollectionUtils.isNotEmpty(states)) { for (StateStatus state : states) { if (state.endDate == null) { result = state; break; } } } return result; }
Source:
private static DataFormatter createFormatter_CadenceZones_TimePercentages() { final DataFormatter dataFormatter = new DataFormatter( FormatterID.CADENCE_ZONES_TIMES, Messages.Calendar_Profile_Value_CadenceZones_TimePercentages, GraphColorManager.PREF_GRAPH_CADENCE) { @Override String format(final CalendarTourData data, final ValueFormat valueFormat, final boolean isShowValueUnit) { String cadenceZonesPercentages = UI.EMPTY_STRING; final int totalCadenceTime = data.cadenceZone_SlowTime + data.cadenceZone_FastTime; if (totalCadenceTime > 0) { final int cadenceZone_SlowPercentage = Math.round(data.cadenceZone_SlowTime * 100f / totalCadenceTime); final int cadenceZone_FastPercentage = Math.round(data.cadenceZone_FastTime * 100f / totalCadenceTime); cadenceZonesPercentages = cadenceZone_SlowPercentage + " - " + cadenceZone_FastPercentage; } return cadenceZonesPercentages; } @Override public ValueFormat getDefaultFormat() { return ValueFormat.TEXT; } @Override public ValueFormat[] getValueFormats() { return new ValueFormat[] { ValueFormat.TEXT }; } @Override void setValueFormat(final ValueFormat valueFormat) }; dataFormatter.setValueFormat(dataFormatter.getDefaultFormat()); return dataFormatter; }

Target:
private static DataFormatter createFormatter_CadenceZones_TimePercentages() { final DataFormatter dataFormatter = new DataFormatter( FormatterID.CADENCE_ZONES_TIMES, Messages.Calendar_Profile_Value_CadenceZones_TimePercentages, GraphColorManager.PREF_GRAPH_CADENCE) { @Override String format(final CalendarTourData data, final ValueFormat valueFormat, final boolean isShowValueUnit) { return TourManager.generateCadenceZones_TimePercentages(data.cadenceZone_SlowTime, data.cadenceZone_FastTime); } @Override public ValueFormat getDefaultFormat() { return ValueFormat.TEXT; } @Override public ValueFormat[] getValueFormats() { return new ValueFormat[] { ValueFormat.TEXT }; } @Override void setValueFormat(final ValueFormat valueFormat) }; dataFormatter.setValueFormat(dataFormatter.getDefaultFormat()); return dataFormatter; }
Source:
RuleConfiguredTarget getGeneratingConfiguredTarget(KeyedConfiguredTarget kct) throws InterruptedException { return (RuleConfiguredTarget) ((ConfiguredTargetValue) walkableGraph.getValue( ConfiguredTargetKey.builder() .setLabel( ((OutputFileConfiguredTarget) kct.getConfiguredTarget()) .getGeneratingRule() .getLabel()) .setConfiguration(queryEnvironment.getConfiguration(kct)) .build())) .getConfiguredTarget(); }

Target:
RuleConfiguredTarget getGeneratingConfiguredTarget(KeyedConfiguredTarget kct) throws InterruptedException { Preconditions.checkArgument(kct.getConfiguredTarget() instanceof OutputFileConfiguredTarget); return (RuleConfiguredTarget) ((ConfiguredTargetValue) walkableGraph.getValue( ConfiguredTargetKey.builder() .setLabel( ((OutputFileConfiguredTarget) kct.getConfiguredTarget()) .getGeneratingRule() .getLabel()) .setConfiguration(queryEnvironment.getConfiguration(kct)) .build())) .getConfiguredTarget(); }
Source:
static void setAttributeValue(AttributeDefinition attribute, ModelNode value) throws IOException { ModelNode expectedValue = null; switch (attribute.getType()) { case LIST: expectedValue = textifyList(value); break; case OBJECT: expectedValue = textifyMap(value); break; default: expectedValue = value; break; } expectedValues.put(attribute, expectedValue); ModelNode op = Operations.createWriteAttributeOperation(ADDRESS, attribute.getName(), value); ModelNode result = modelControllerClient.execute(op); Assert.assertEquals(SUCCESS, result.get(OUTCOME).asString()); }

Target:
static void setAttributeValue(AttributeDefinition attribute, ModelNode value) throws IOException { ModelNode expectedValue = null; ModelNode resolvedValue = value.resolve(); switch (attribute.getType()) { case LIST: expectedValue = textifyList(resolvedValue); break; case OBJECT: expectedValue = textifyMap(resolvedValue); break; default: expectedValue = resolvedValue; break; } expectedValues.put(attribute, expectedValue); ModelNode op = Operations.createWriteAttributeOperation(ADDRESS, attribute.getName(), value); ModelNode result = modelControllerClient.execute(op); Assert.assertEquals(SUCCESS, result.get(OUTCOME).asString()); }
Source:
public Result next() { if (query == null) throw new IllegalStateException("_query variable is null"); if (randomAccess) return null; synchronized (getDatabase().getLock()) { try { if (c4enum.next()) { return currentObject(); } else return null; } catch (LiteCoreException e) { Log.w(TAG, "Query enumeration error: %s", e); return null; } } }

Target:
public Result next() { if (query == null) throw new IllegalStateException("_query variable is null"); synchronized (getDatabase().getLock()) { try { if (c4enum.next()) { return currentObject(); } else return null; } catch (LiteCoreException e) { Log.w(TAG, "Query enumeration error: %s", e); return null; } } }
Source:
private boolean looksLikeBinary(Path source) { String nonTextTypes = "class|jar|exe|jpg|jpeg|gif"; return getFileExtension(source).matches(nonTextTypes); }

Target:
private boolean looksLikeBinary(Path source) { String nonTextTypes = "class|jar|exe|jpg|jpeg|gif|png"; return getFileExtension(source).matches(nonTextTypes); }
Source:
public boolean getOnOffState() { JsonElement onOff = attributes.get(ONOFF); if (onOff != null) { return attributes.get(ONOFF).getAsInt() == 1; } else { return false; } }

Target:
public boolean getOnOffState() { JsonElement onOff = attributes.get(ONOFF); if (onOff != null) { return onOff.getAsInt() == 1; } else { return false; } }
Source:
SignatureKeyPairImpl generateKeyPair(String workspaceId) throws ServerException { final KeyPairGenerator kpg; try { kpg = KeyPairGenerator.getInstance(algorithm); } catch (NoSuchAlgorithmException ex) { throw new ServerException(ex.getMessage(), ex); } kpg.initialize(keySize); final KeyPair pair = kpg.generateKeyPair(); final SignatureKeyPairImpl kp = new SignatureKeyPairImpl(workspaceId, pair.getPublic(), pair.getPrivate()); LOG.info( "Generated signature key pair with ws id and algorithm {}.", kp.getWorkspaceId(), algorithm); return kp; }

Target:
SignatureKeyPairImpl generateKeyPair(String workspaceId) throws ServerException { final KeyPairGenerator kpg; try { kpg = KeyPairGenerator.getInstance(algorithm); } catch (NoSuchAlgorithmException ex) { throw new ServerException(ex.getMessage(), ex); } kpg.initialize(keySize); final KeyPair pair = kpg.generateKeyPair(); final SignatureKeyPairImpl kp = new SignatureKeyPairImpl(workspaceId, pair.getPublic(), pair.getPrivate()); LOG.debug( "Generated signature key pair with ws id and algorithm {}.", kp.getWorkspaceId(), algorithm); return kp; }
Source:
private void showListOfPackages(final boolean includeDefaultPackage, final Command packagesLoadedCommand) { final Module activeModule = projectContext.getActiveModule().orElse(null); if (activeModule == null) { return; } else { moduleService.call((Set<Package> pkgs) -> { moduleService.call((Package activePackage) -> { final List<Package> sortedPackages = getPackages(includeDefaultPackage, pkgs); if (sortedPackages.isEmpty()) { return; } addPackagesToSelect(sortedPackages, activePackage); if (packagesLoadedCommand != null) { packagesLoadedCommand.execute(); } }).resolveDefaultWorkspacePackage(activeModule); }).resolvePackages(activeModule); } }

Target:
private void showListOfPackages(final boolean includeDefaultPackage, final Command packagesLoadedCommand) { final Module activeModule = projectContext.getActiveModule().orElse(null); if (activeModule == null) { return; } else { moduleService.call((Set<Package> pkgs) -> { moduleService.call((Package activePackage) -> { final List<Package> sortedPackages = getSortedPackages(includeDefaultPackage, pkgs); if (sortedPackages.isEmpty()) { return; } addPackagesToSelect(sortedPackages, activePackage); if (packagesLoadedCommand != null) { packagesLoadedCommand.execute(); } }).resolveDefaultWorkspacePackage(activeModule); }).resolvePackages(activeModule); } }
Source:
public ModelAndView consoleout(@RequestParam("pipelineName") String pipelineName, @RequestParam("pipelineLabel") String counterOrLabel, @RequestParam("stageName") String stageName, @RequestParam("buildName") String buildName, @RequestParam(value = "stageCounter", required = false) String stageCounter, @RequestParam(value = "startLineNumber", required = false) Long start ) throws Exception { start = start == null ? 0L : start; try { JobIdentifier job = restfulService.findJob(pipelineName, counterOrLabel, stageName, stageCounter, buildName); ConsoleConsumer streamer = consoleService.getStreamer(start, job); return new ModelAndView(new ConsoleOutView(streamer)); } catch (Exception e) { return buildNotFound(pipelineName, counterOrLabel, stageName, stageCounter, buildName); } }

Target:
public ModelAndView consoleout(@RequestParam("pipelineName") String pipelineName, @RequestParam("pipelineLabel") String counterOrLabel, @RequestParam("stageName") String stageName, @RequestParam("buildName") String buildName, @RequestParam(value = "stageCounter", required = false) String stageCounter, @RequestParam(value = "startLineNumber", required = false) Long start ) throws Exception { start = start == null ? 0L : start; try (ConsoleConsumer streamer = consoleService.getStreamer(start, restfulService.findJob(pipelineName, counterOrLabel, stageName, stageCounter, buildName))) { return new ModelAndView(new ConsoleOutView(streamer)); } catch (Exception e) { return buildNotFound(pipelineName, counterOrLabel, stageName, stageCounter, buildName); } }
Source:
private void updateAllocation() { int totalAllocations = 0; boolean isAllocationExceed; for (Integer allocation : writerList.values()) { totalAllocations += allocation; } if (totalAllocations <= totalMemoryPool) { isAllocationExceed = false; } else { isAllocationExceed = true; } if (!isAllocationExceed) { for (Map.Entry<InternalParquetRecordWriter, Integer> entry : writerList.entrySet()) { entry.getKey().setRowGroupSizeThreshold(entry.getValue()); } } else { double scale = (double) totalMemoryPool / totalAllocations; for (Map.Entry<InternalParquetRecordWriter, Integer> entry : writerList.entrySet()) { int newSize = (int) Math.floor(entry.getValue() * scale); entry.getKey().setRowGroupSizeThreshold(newSize); LOG.debug(String.format("Adjust block size to %,d for writer: %s", newSize, entry.getKey())); } } }

Target:
private void updateAllocation() { long totalAllocations = 0; double scale; for (Long allocation : writerList.values()) { totalAllocations += allocation; } if (totalAllocations <= totalMemoryPool) { scale = 1.0; } else { scale = (double) totalMemoryPool / totalAllocations; } for (Map.Entry<InternalParquetRecordWriter, Long> entry : writerList.entrySet()) { long newSize = (long) Math.floor(entry.getValue() * scale); entry.getKey().setRowGroupSizeThreshold(newSize); LOG.debug(String.format("Adjust block size from %,d to %,d for writer: %s", entry.getValue(), newSize, entry.getKey())); } }
Source:
public void initialize(IPath containerPath, final IJavaProject javaProject) throws CoreException { Central.onWorkspaceInit(new Function<Workspace,Void>() { @Override public Void apply(Workspace a) { try { Central.getInstance().addModelListener(BndContainerInitializer.this); IProject project = javaProject.getProject(); Updater updater = new Updater(project, javaProject); updater.updateClasspathContainer(true); } catch (CoreException e) { logger.logError("Error initializing classpath container", e); } return null; } }); }

Target:
public void initialize(IPath containerPath, final IJavaProject javaProject) throws CoreException { Central.onWorkspaceInit(new Function<Workspace,Void>() { @Override public Void apply(Workspace a) { try { IProject project = javaProject.getProject(); Updater updater = new Updater(project, javaProject); updater.updateClasspathContainer(true); } catch (CoreException e) { logger.logError("Error initializing classpath container", e); } return null; } }); }
Source:
public List<TriggerImpl> getTriggers() { return triggers; }

Target:
public List<Trigger> getTriggers() { return triggers; }
Source:
public ChangeAuditLogger build() { if (addHandlers != null && removeHandlers != null) { List<String> auxList = new ArrayList<String>(); auxList.addAll(addHandlers); auxList.removeAll(removeHandlers); if (auxList.size() < addHandlers.size()) { throw new IllegalArgumentException("handler can not be added and removed at the same time"); } } return new ChangeAuditLogger(this); }

Target:
public ChangeAuditLogger build() { if (addHandlers != null && removeHandlers != null) { Set<String> intersection = new HashSet<String>(addHandlers); intersection.retainAll(removeHandlers); if (!intersection.isEmpty()) { throw new IllegalArgumentException("handler can not be added and removed at the same time"); } } return new ChangeAuditLogger(this); }
Source:
public void hook(ExtensionHook extensionHook) { super.hook(extensionHook); extensionHook.addApiImplementor(this.api); if (getView() != null) { extensionHook.getHookMenu().addToolsMenuItem(getMenuExample()); extensionHook.getHookMenu().addPopupMenuItem(getPopupMsgMenuExample()); extensionHook.getHookView().addStatusPanel(getStatusPanel()); } }

Target:
public void hook(ExtensionHook extensionHook) { super.hook(extensionHook); this.api = new SimpleExampleAPI(this); extensionHook.addApiImplementor(this.api); if (getView() != null) { extensionHook.getHookMenu().addToolsMenuItem(getMenuExample()); extensionHook.getHookMenu().addPopupMenuItem(getPopupMsgMenuExample()); extensionHook.getHookView().addStatusPanel(getStatusPanel()); } }
Source:
public void refreshAllUsers() { SyncUsers.sync(DbFacade.getInstance().getDbUserDao().getAll(), "The user was reactivated during periodic sync"); }

Target:
public void refreshAllUsers() { List<DbUser> activeUsers = new ArrayList<>(); for (DbUser dbUser : DbFacade.getInstance().getDbUserDao().getAll()) { if (dbUser.isActive()) { activeUsers.add(dbUser); } } SyncUsers.sync(activeUsers); }
Source:
public void testOffHeapStore() throws Exception { final AsyncDispatcher<MockMessage> asyncDispatcher = threadLockingDispatcherFactory.createAsyncDispatcher(module); final AtomicBoolean allThreadsLocked = new AtomicBoolean(false); ThreadLockingSyncDispatcher<MockMessage> threadLockingSyncDispatcher = threadLockingDispatcherFactory.getThreadLockingSyncDispatcher(); threadLockingSyncDispatcher.waitForThreads(NUM_THREADS).thenRun(() -> { allThreadsLocked.set(true); }); final List<CompletableFuture<MockMessage>> futures = new ArrayList<>(); for (int i = 0; i < NUM_THREADS + QUEUE_SIZE; i++) { futures.add(asyncDispatcher.send(new MockMessage(Integer.toString(i)))); } await().atMost(30, SECONDS).until(() -> allThreadsLocked.get()); assertEquals(0, threadLockingSyncDispatcher.getNumExtraThreadsWaiting()); assertEquals(QUEUE_SIZE, asyncDispatcher.getQueueSize()); int numOfMessagesInOffHeap = 0; for (int i = NUM_THREADS + QUEUE_SIZE; i < NUM_THREADS + QUEUE_SIZE + OFFHEAP_MESSAGES; i++) { CompletableFuture<MockMessage> future = asyncDispatcher.send(new MockMessage(Integer.toString(i))); Thread.sleep(100); futures.add(future); } assertThat(offHeapStore.getNumOfMessages(module.getId()), equalTo(OFFHEAP_MESSAGES -1)); threadLockingSyncDispatcher.release(); await().atMost(30, SECONDS).until(() -> asyncDispatcher.getQueueSize(), equalTo(0)); await().atMost(30, SECONDS).until(() -> threadLockingDispatcherFactory.getNumMessageDispatched(), greaterThan(QUEUE_SIZE + OFFHEAP_MESSAGES)); CompletableFuture.allOf(futures.toArray(new CompletableFuture<?>[]{})); asyncDispatcher.close(); }

Target:
public void testOffHeapStore() throws Exception { final AsyncDispatcher<MockMessage> asyncDispatcher = threadLockingDispatcherFactory.createAsyncDispatcher(module); final AtomicBoolean allThreadsLocked = new AtomicBoolean(false); ThreadLockingSyncDispatcher<MockMessage> threadLockingSyncDispatcher = threadLockingDispatcherFactory.getThreadLockingSyncDispatcher(); threadLockingSyncDispatcher.waitForThreads(NUM_THREADS).thenRun(() -> { allThreadsLocked.set(true); }); final List<CompletableFuture<MockMessage>> futures = new ArrayList<>(); for (int i = 0; i < NUM_THREADS + QUEUE_SIZE; i++) { futures.add(asyncDispatcher.send(new MockMessage(Integer.toString(i)))); } await().atMost(30, SECONDS).until(allThreadsLocked::get); assertEquals(0, threadLockingSyncDispatcher.getNumExtraThreadsWaiting()); assertEquals(QUEUE_SIZE, asyncDispatcher.getQueueSize()); int numOfMessagesInOffHeap = 0; for (int i = NUM_THREADS + QUEUE_SIZE; i < NUM_THREADS + QUEUE_SIZE + OFFHEAP_MESSAGES; i++) { CompletableFuture<MockMessage> future = asyncDispatcher.send(new MockMessage(Integer.toString(i))); futures.add(future); } assertThat(offHeapStore.getNumOfMessages(module.getId()), greaterThanOrEqualTo(OFFHEAP_MESSAGES-1)); threadLockingSyncDispatcher.release(); await().atMost(30, SECONDS).until(asyncDispatcher::getQueueSize, equalTo(0)); await().atMost(30, SECONDS).until(threadLockingDispatcherFactory::getNumMessageDispatched, greaterThan(QUEUE_SIZE + OFFHEAP_MESSAGES)); CompletableFuture.allOf(futures.toArray(new CompletableFuture<?>[]{})); asyncDispatcher.close(); }
Source:
protected void run() throws Exception { if (tree == null) throw die(CLIText.get().treeIsRequired); ArchiveCommand.registerFormat("tar", new TarFormat()); ArchiveCommand.registerFormat("zip", new ZipFormat()); final ArchiveCommand cmd = new ArchiveCommand(db); try { cmd.setTree(tree) .setFormat(format) .setOutputStream(outs).call(); } catch (GitAPIException e) { throw die(e.getMessage()); } finally { cmd.release(); ArchiveCommand.unregisterFormat("zip"); ArchiveCommand.unregisterFormat("tar"); } }

Target:
protected void run() throws Exception { if (tree == null) throw die(CLIText.get().treeIsRequired); final ArchiveCommand cmd = new ArchiveCommand(db); try { cmd.setTree(tree) .setFormat(format) .setOutputStream(outs).call(); } catch (GitAPIException e) { throw die(e.getMessage()); } finally { cmd.release(); } }
Source:
public void setup() { buffer = (DiskBuffer) new DiskBuffer(BUFFER_DIR, maxEvents); }

Target:
public void setup() { buffer = new DiskBuffer(BUFFER_DIR, maxEvents); }
Source:
public String placeLimitOrder(LimitOrder order) throws IOException { CoingiPlaceLimitOrderRequest request = new CoingiPlaceLimitOrderRequest() .setCurrencyPair(CoingiAdapters.adaptCurrency(order.getCurrencyPair())) .setOrderType(order.getType().equals(BID) ? 0 : 1) .setPrice(order.getLimitPrice()) .setVolume(order.getRemainingAmount()); String response; try { response = placeCoingiLimitOrder(request).getResult(); } catch (CoingiException e) { throw CoingiErrorAdapter.adapt(e); } return response; }

Target:
public String placeLimitOrder(LimitOrder order) throws IOException { try { CoingiPlaceLimitOrderRequest request = new CoingiPlaceLimitOrderRequest() .setCurrencyPair(CoingiAdapters.adaptCurrency(order.getCurrencyPair())) .setOrderType(order.getType().equals(BID) ? 0 : 1) .setPrice(order.getLimitPrice()) .setVolume(order.getRemainingAmount()); return placeCoingiLimitOrder(request).getResult(); } catch (CoingiException e) { throw CoingiErrorAdapter.adapt(e); } }
Source:
public void switchToTrash() { int flag = 1; Ode.getInstance().getTopToolbar().updateMoveToTrash(flag); hideChaff(); hideTutorials(); ProjectListBox.getProjectListBox().loadTrashList(); currentView = TRASHCAN; projectToolbar.enableStartButton(); projectToolbar.setProjectTabButtonsVisible(false); projectToolbar.setPublishOrUpdateButtonVisible(false); projectToolbar.setTrashTabButtonsVisible(true); }

Target:
public void switchToTrash() { Ode.getInstance().getTopToolbar().updateMoveToTrash("Delete From Trash"); hideChaff(); hideTutorials(); ProjectListBox.getProjectListBox().loadTrashList(); currentView = TRASHCAN; projectToolbar.enableStartButton(); projectToolbar.setProjectTabButtonsVisible(false); projectToolbar.setPublishOrUpdateButtonVisible(false); projectToolbar.setTrashTabButtonsVisible(true); }
Source:
public void setUnmodified() { this.modified = false; if (configCurrent != null) { configCurrent.setUnmodified(); } }

Target:
public void setUnmodified() { this.modified = false; getLogisticRegressionConfiguration().setUnmodified(); getNaiveBayesConfiguration().setUnmodified(); getRandomForestConfiguration().setUnmodified(); getSVMConfiguration().setUnmodified(); }
Source:
public void testAdditiveMergeSolvableConflicts_Branch2OnBranch1(Status status, Repository repository, List<IProject> projects, GitTestSupport support) throws Exception { assertFalse(status.hasUncommittedChanges()); assertEquals(0, status.getConflicting().size()); Comparison comparison = support.compare("branch1", "expected", "model.notation"); Collection<Diff> diffs = Collections2.filter(comparison.getDifferences(), Predicates.not(hasDirectOrIndirectConflict(PSEUDO, ConflictKind.REAL))); assertEquals(2, diffs.size()); for (Diff diff : diffs) { assertEquals(DifferenceKind.MOVE, diff.getKind()); } }

Target:
public void testAdditiveMergeSolvableConflicts_Branch2OnBranch1(Status status, Repository repository, List<IProject> projects, GitTestSupport support) throws Exception { assertFalse(status.hasUncommittedChanges()); assertEquals(0, status.getConflicting().size()); Comparison comparison = support.compare("branch1", "expected", "model.notation"); Collection<Diff> diffs = Collections2.filter(comparison.getDifferences(), Predicates.not(hasDirectOrIndirectConflict(PSEUDO, REAL))); assertEquals(2, diffs.size()); for (Diff diff : diffs) { assertEquals(MOVE, diff.getKind()); } }
Source:
public FragmentProto getProto() { FileFragmentProto.Builder builder = FileFragmentProto.newBuilder(); builder.setId(this.tableName); builder.setStartOffset(this.startOffset); builder.setLength(this.length); builder.setPath(this.uri.toString()); if(diskIds != null) { List<Integer> idList = new ArrayList<>(); for(int eachId: diskIds) { idList.add(eachId); } builder.addAllDiskIds(idList); } if(hosts != null) { List inputList = new ArrayList<>(); inputList.addAll(Arrays.asList(hosts)); builder.addAllHosts(inputList); } FragmentProto.Builder fragmentBuilder = FragmentProto.newBuilder(); fragmentBuilder.setId(this.tableName); fragmentBuilder.setDataFormat(BuiltinStorages.TEXT); fragmentBuilder.setContents(builder.buildPartial().toByteString()); return fragmentBuilder.build(); }

Target:
public FragmentProto getProto() { FileFragmentProto.Builder builder = FileFragmentProto.newBuilder(); builder.setId(this.tableName); builder.setStartOffset(this.startOffset); builder.setLength(this.length); builder.setPath(this.uri.toString()); if(diskIds != null) { List<Integer> idList = new ArrayList<>(); for(int eachId: diskIds) { idList.add(eachId); } builder.addAllDiskIds(idList); } if(hosts != null) { builder.addAllHosts(Arrays.asList(hosts)); } FragmentProto.Builder fragmentBuilder = FragmentProto.newBuilder(); fragmentBuilder.setId(this.tableName); fragmentBuilder.setDataFormat(BuiltinStorages.TEXT); fragmentBuilder.setContents(builder.buildPartial().toByteString()); return fragmentBuilder.build(); }
Source:
public void setup(){ mainPage = Transporter.driverMainPage(); lead = JSONMapper.getLead("src\\test\\resources\\CreateLeadBase.json"); leadEditEnum = JSONMapper.getLead("src\\test\\resources\\EditLead.json"); Common.createLead(lead); }

Target:
public void setup(){ lead = JSONMapper.getLead("src/test/resources/CreateLeadBase.json"); leadEditEnum = JSONMapper.getLead("src/test/resources/EditLead.json"); Common.createLead(lead); }
Source:
public CustodiSoulcaller(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{W}{W}"); this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.CLERIC); this.power = new MageInt(1); this.toughness = new MageInt(2); this.addAbility(new MeleeAbility()); this.addAbility(new AttacksTriggeredAbility(new CustodiSoulcallerEffect(), false)); }

Target:
public CustodiSoulcaller(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{W}{W}"); this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.CLERIC); this.power = new MageInt(1); this.toughness = new MageInt(2); this.addAbility(new MeleeAbility()); Ability ability = new AttacksTriggeredAbility(new ReturnFromGraveyardToBattlefieldTargetEffect(), false); ability.addWatcher(new CustodiSoulcallerWatcher()); ability.addTarget(new TargetCardInYourGraveyard(new FilterCreatureCard("creature card with converted mana cost X or less from your graveyard, where X is the number of players you attacked with a creature this combat"))); this.addAbility(ability); }
Source:
private void initNetworkInterfaces() { if (networkInterfacesInited) { return; } AsyncQuery getVmNicsQuery = new AsyncQuery(); getVmNicsQuery.asyncCallback = new INewAsyncCallback() { @Override public void onSuccess(Object model, Object result) { List<VmNetworkInterface> nics = (List<VmNetworkInterface>) result; if (nics != null && nics.size() > 0) { initNetworkInterfaces(networkBehavior, nics); } networkInterfacesInited = true; } }; AsyncDataProvider.getVmNicList(getVmNicsQuery, vm.getId()); }

Target:
private void initNetworkInterfaces() { AsyncQuery getVmNicsQuery = new AsyncQuery(); getVmNicsQuery.asyncCallback = new INewAsyncCallback() { @Override public void onSuccess(Object model, Object result) { initNetworkInterfaces(networkBehavior, (List<VmNetworkInterface>) result); } }; AsyncDataProvider.getVmNicList(getVmNicsQuery, vm.getId()); }
Source:
public static void register() { if (!isRegistered) { instance.registerMBean(); isRegistered = true; } }

Target:
public synchronized void register() { if (isRegistered) return; try { ObjectName objectName = new ObjectName(trackerName); MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer(); if (!mBeanServer.isRegistered(objectName)) { ManagementFactory.getPlatformMBeanServer().registerMBean(instance, objectName); } isRegistered = true; } catch (Exception exc) { log.error("Unable to register mbean for " + instance.getClass().getSimpleName(), exc); } }
Source:
private void generateTaskList() { taskList.clear(); Map map = Maps.newHashMap(); for (Object object : intermediateList) { if (object instanceof StateChange) { map.put(object.getClass(), object); } else { for (Object o : map.values()) { taskList.add(((StateChange) o).generateTask()); } map.clear(); taskList.add(new NodeTask((Node) object)); } } }

Target:
private void generateTaskList() { StateChange stateChange; StateChange persistentStateChange; Map persistentStateChanges = Maps.newHashMap(); Map intranodesStateChanges = Maps.newHashMap(); taskList.clear(); for (Object object : intermediateList) { if (object instanceof StateChange) { intranodesStateChanges.put(object.getClass(), object); } else { for (Object preCastStateChange : intranodesStateChanges.values()) { stateChange = (StateChange) preCastStateChange; persistentStateChange = (StateChange) persistentStateChanges.get(stateChange.getClass()); if (persistentStateChange == null) { if (!stateChange.isTheDefaultInstance()) { taskList.add(stateChange.generateTask()); persistentStateChanges.put(stateChange.getClass(), stateChange); } } else { if (stateChange.isTheDefaultInstance()) { taskList.add(stateChange.generateTask()); persistentStateChanges.remove(stateChange.getClass()); } else if (!stateChange.isEqualTo(persistentStateChange)) { taskList.add(stateChange.generateTask()); persistentStateChanges.put(stateChange.getClass(), stateChange); } } } intranodesStateChanges.clear(); taskList.add(((Node) object).generateTask()); } } }
Source:
protected void reportInternal(Span span) { receivedTagCount.update(span.getAnnotations().size()); Integer maxSpanDelay = dropSpansDelayedMinutes.get(); if (maxSpanDelay != null && span.getStartMillis() + span.getDuration() < Clock.now() - TimeUnit.MINUTES.toMillis(maxSpanDelay)) { this.reject(span, "span is older than acceptable delay of " + maxSpanDelay + " minutes"); return; } validateSpan(span, validationConfig, spanLogsHandler.get()::report); if (span.getAnnotations() != null && AnnotationUtils.getValue(span.getAnnotations(), SPAN_SAMPLING_POLICY_TAG) != null) { this.policySampledSpanCounter.inc(1); } final String strSpan = serializer.apply(span); getTask().add(strSpan); getReceivedCounter().inc(); if (validItemsLogger != null) validItemsLogger.info(strSpan); }

Target:
protected void reportInternal(Span span) { receivedTagCount.update(span.getAnnotations().size()); Integer maxSpanDelay = dropSpansDelayedMinutes.get(); if (maxSpanDelay != null && span.getStartMillis() + span.getDuration() < Clock.now() - TimeUnit.MINUTES.toMillis(maxSpanDelay)) { this.reject(span, "span is older than acceptable delay of " + maxSpanDelay + " minutes"); return; } validateSpan(span, validationConfig, spanLogsHandler.get()::report); if (span.getAnnotations() != null && AnnotationUtils.getValue(span.getAnnotations(), SPAN_SAMPLING_POLICY_TAG) != null) { this.policySampledSpanCounter.inc(); } final String strSpan = serializer.apply(span); getTask().add(strSpan); getReceivedCounter().inc(); if (validItemsLogger != null) validItemsLogger.info(strSpan); }
Source:
public void appendColumn( final BaseColumn column ) throws MoveColumnVetoException { final MetaData metaData = new BaseColumnSynchronizer.ColumnMetaDataImpl( column ); for ( int i = 0; i < synchronizers.size(); i++ ) { final Synchronizer synchronizer = synchronizers.get( i ); if ( synchronizer.handlesAppend( metaData ) ) { synchronizer.append( metaData ); break; } } eventBus.fireEvent( new AfterColumnInserted() ); }

Target:
public void appendColumn( final BaseColumn column ) throws MoveColumnVetoException { final MetaData metaData = new BaseColumnSynchronizer.ColumnMetaDataImpl( column ); for ( Synchronizer synchronizer : synchronizers ) { if ( synchronizer.handlesAppend( metaData ) ) { synchronizer.append( metaData ); break; } } eventBus.fireEvent( new AfterColumnInserted() ); }
Source:
public ColumnResizeHandler(Element headerElement, Column<T, ?> column, HasResizableColumns<T> table) { this.headerElement = headerElement; this.column = column; this.table = table; this.eventHandler = Event.addNativePreviewHandler(this); columnAbsoluteLeft = headerElement.getAbsoluteLeft(); table.onResizeStart(column, headerElement); }

Target:
public ColumnResizeHandler(Element headerElement, Column<T, ?> column, HasResizableColumns<T> table) { this.headerElement = headerElement; this.column = column; this.table = table; this.eventHandler = Event.addNativePreviewHandler(this); this.columnAbsoluteLeft = headerElement.getAbsoluteLeft(); table.onResizeStart(column, headerElement); }
Source:
public PrefetchableOrPredicate(Predicate<ChangeData>... that) { super(that); }

Target:
PrefetchableOrPredicate(Predicate<ChangeData>... that) { super(that); }
Source:
public static GerritTrigger getTrigger(@Nullable Job project) { if (project == null) { return null; } DescribableList<Trigger<?>, TriggerDescriptor> triggers = new DescribableList<Trigger<?>, TriggerDescriptor>(project); for (Trigger p : triggers) { if (GerritTrigger.class.isInstance(p)) { return GerritTrigger.class.cast(p); } } return null; }

Target:
public static GerritTrigger getTrigger(@Nullable Job project) { if (project == null) { return null; } if (project instanceof ParameterizedJob) { ParameterizedJob parameterizedJob = (ParameterizedJob)project; for (Trigger p : parameterizedJob.getTriggers().values()) { if (GerritTrigger.class.isInstance(p)) { return GerritTrigger.class.cast(p); } } } return null; }
Source:
public void testJsonContents() throws Exception { JsonElement json = HttpValueFunctions.jsonContents().apply(response); assertTrue(json.isJsonObject()); assertEquals(json.getAsJsonObject().entrySet(), ImmutableMap.of("mykey", new JsonPrimitive("myvalue")).entrySet()); }

Target:
public void testJsonContents() throws Exception { JsonElement json = HttpValueFunctions.jsonContents().apply(response); assertTrue(json.isJsonObject()); assertEquals(json.getAsJsonObject().entrySet(), ImmutableMap.of(bodyKey, new JsonPrimitive(bodyVal)).entrySet()); }
Source:
protected void executeVmCommand() { setVmName(getVmStaticDAO().get(getParameters().getVmId()).getName()); VmNic iface = getVmNicDao().get(getParameters().getInterfaceId()); if (iface != null) { new ExternalNetworkManager(iface).deallocateIfExternal(); getMacPoolForVmNic(iface).freeMac(iface.getMacAddress()); interfaceName = iface.getName(); String interType = VmInterfaceType.forValue(iface.getType()).getDescription(); if (interType != null) { addCustomValue("InterfaceType", interType); } } TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { getVmNicDao().remove(getParameters().getInterfaceId()); getDbFacade().getVmNetworkStatisticsDao().remove(getParameters().getInterfaceId()); getDbFacade().getVmDeviceDao().remove(new VmDeviceId(getParameters().getInterfaceId(), getParameters().getVmId())); setSucceeded(true); return null; } }); }

Target:
protected void executeVmCommand() { this.setVmName(getVmStaticDAO().get(getParameters().getVmId()).getName()); VmNic iface = getVmNicDao().get(getParameters().getInterfaceId()); if (iface != null) { interfaceName = iface.getName(); String interType = VmInterfaceType.forValue(iface.getType()).getDescription(); if (interType != null) { addCustomValue("InterfaceType", interType); } new ExternalNetworkManager(iface).deallocateIfExternal(); getMacPool().freeMac(iface.getMacAddress()); } TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { getVmNicDao().remove(getParameters().getInterfaceId()); getDbFacade().getVmNetworkStatisticsDao().remove(getParameters().getInterfaceId()); getDbFacade().getVmDeviceDao().remove(new VmDeviceId(getParameters().getInterfaceId(), getParameters().getVmId())); setSucceeded(true); return null; } }); }
Source:
public Optional<Response> doRefund(Long accountId, String chargeId, RefundRequest refundRequest) { return chargeDao.findByExternalIdAndGatewayAccount(chargeId, accountId) .map(chargeEntity -> { Optional<Response> refundResult = refundWithGateway(chargeEntity, refundRequest); if (chargeEntity.getPaymentGatewayName() == PaymentGatewayName.SANDBOX && refundResult.isPresent()) { RefundEntity refundEntity = refundResult.get().getRefundEntity(); refundEntity.setStatus(RefundStatus.REFUNDED); refundDao.merge(refundEntity); } return refundResult; }) .orElseThrow(() -> new ChargeNotFoundRuntimeException(chargeId)); }

Target:
public Optional<Response> doRefund(Long accountId, String chargeId, RefundRequest refundRequest) { return Optional.ofNullable(transactionFlowProvider.get() .executeNext(prepareForRefund(providers, accountId, chargeId, refundRequest)) .executeNext(doGatewayRefund(providers)) .executeNext(setAsSubmitted()) .executeNext(setSandboxAsRefunded()) .complete().get(Response.class)); }
Source:
public final void endVisit(final ReturnStatement node) { final Expression expression= node.getExpression(); if (expression != null) { final ConstraintVariable2 descendant= (ConstraintVariable2) expression.getProperty(PROPERTY_CONSTRAINT_VARIABLE); if (descendant != null) { ASTNode methodOrLambda= fCurrentMethodsAndLambdas.peek(); if (methodOrLambda instanceof MethodDeclaration) { final MethodDeclaration declaration= (MethodDeclaration) methodOrLambda; final IMethodBinding binding= declaration.resolveBinding(); if (binding != null) { final ConstraintVariable2 ancestor= fModel.createReturnTypeVariable(binding); if (ancestor != null) { node.setProperty(PROPERTY_CONSTRAINT_VARIABLE, ancestor); fModel.createSubtypeConstraint(descendant, ancestor); } } } else if (methodOrLambda instanceof LambdaExpression) { LambdaExpression lambda= (LambdaExpression) methodOrLambda; IMethodBinding binding= lambda.resolveMethodBinding(); if (binding != null) { final ConstraintVariable2 ancestor= fModel.createReturnTypeVariable(binding); if (ancestor != null) { node.setProperty(PROPERTY_CONSTRAINT_VARIABLE, ancestor); fModel.createSubtypeConstraint(descendant, ancestor); } } } } } }

Target:
public final void endVisit(final ReturnStatement node) { final Expression expression= node.getExpression(); if (expression != null) { final ConstraintVariable2 descendant= (ConstraintVariable2) expression.getProperty(PROPERTY_CONSTRAINT_VARIABLE); if (descendant != null) { ASTNode methodOrLambda= fCurrentMethodsAndLambdas.peek(); IMethodBinding binding = null; if (methodOrLambda instanceof MethodDeclaration) { binding= ((MethodDeclaration) methodOrLambda).resolveBinding(); } else if (methodOrLambda instanceof LambdaExpression) { binding= ((LambdaExpression) methodOrLambda).resolveMethodBinding(); } if (binding != null) { final ConstraintVariable2 ancestor= fModel.createReturnTypeVariable(binding); if (ancestor != null) { node.setProperty(PROPERTY_CONSTRAINT_VARIABLE, ancestor); fModel.createSubtypeConstraint(descendant, ancestor); } } } } }
Source:
public RuleModellerWidget createWidget( final RuleModeller ruleModeller, final EventBus eventBus, final IAction iAction, final Boolean readOnly ) { BendableConstraintMatchRuleModellerWidget widget = new BendableConstraintMatchRuleModellerWidget( ruleModeller, eventBus, (ActionBendableHardConstraintMatch) iAction, readOnly, "Hard Score" ); actionPluginUtils.initScoreHolderAwarePlugin( ruleModeller.getPath(), widget, SUPPORTED_SCORE_HOLDER_TYPES ); scoreHolderService.call( new RemoteCallback<Collection<BendableScoreLevelsWrapper>>() { @Override public void callback( final Collection<BendableScoreLevelsWrapper> scoreLevels ) { if ( scoreLevels.size() == 1 ) { widget.setScoreLevels( scoreLevels.iterator().next().getHardScoreLevels() ); } } } ).getBendableScoreLevelsSize( ruleModeller.getPath() ); return widget; }

Target:
public RuleModellerWidget createWidget(final RuleModeller ruleModeller, final EventBus eventBus, final IAction iAction, final Boolean readOnly) { BendableConstraintMatchRuleModellerWidget widget = new BendableConstraintMatchRuleModellerWidget(ruleModeller, eventBus, (ActionBendableHardConstraintMatch) iAction, translationService, readOnly, GuidedRuleEditorConstants.RuleModellerActionPluginHardScore); actionPluginClientService.initScoreHolderAwarePlugin(ruleModeller, widget, SUPPORTED_SCORE_HOLDER_TYPES); actionPluginClientService.invokeScoreInformationCachedOperation(ruleModeller, scoreInformation -> { Collection<BendableScoreLevelsWrapper> scoreLevels = scoreInformation.getBendableScoreLevelsWrappers(); if (scoreLevels.size() == 1) { widget.setScoreLevels(scoreLevels.iterator().next().getHardScoreLevels()); } }); return widget; }
Source:
public Iterable<Property> getProperties(String name) { Property reservedProperty = getReservedProperty(name); if (reservedProperty != null) { ArrayList<Property> result = new ArrayList<>(); result.add(reservedProperty); return result; } return internalGetProperties(null, name); }

Target:
public Iterable<Property> getProperties(String name) { return getProperties(null, name); }
Source:
private static IIsolatedExecutor.SerializableCallable<RepairResult> repair(Map<String, String> options) { return () -> { SimpleCondition await = new SimpleCondition(); AtomicBoolean success = new AtomicBoolean(true); AtomicBoolean wasInconsistent = new AtomicBoolean(false); StorageService.instance.repair(KEYSPACE, options, ImmutableList.of((tag, event) -> { System.out.println(String.format("EVENT %s %s", event.getMessage(), event.getType())); if (event.getType() == ProgressEventType.ERROR) { success.set(false); await.signalAll(); } else if (event.getType() == ProgressEventType.NOTIFICATION && event.getMessage().contains("Repaired data is inconsistent")) { wasInconsistent.set(true); } else if (event.getType() == ProgressEventType.COMPLETE) { await.signalAll(); } else if (event.getType() == ProgressEventType.SUCCESS) { success.set(true); await.signalAll(); } })); try { await.await(1, TimeUnit.MINUTES); } catch (InterruptedException e) { throw new RuntimeException(e); } return new RepairResult(success.get(), wasInconsistent.get()); }; }

Target:
private static IIsolatedExecutor.SerializableCallable<RepairResult> repair(Map<String, String> options) { return () -> { SimpleCondition await = new SimpleCondition(); AtomicBoolean success = new AtomicBoolean(true); AtomicBoolean wasInconsistent = new AtomicBoolean(false); StorageService.instance.repair(KEYSPACE, options, ImmutableList.of((tag, event) -> { if (event.getType() == ProgressEventType.ERROR) { success.set(false); await.signalAll(); } else if (event.getType() == ProgressEventType.NOTIFICATION && event.getMessage().contains("Repaired data is inconsistent")) { wasInconsistent.set(true); } else if (event.getType() == ProgressEventType.COMPLETE) await.signalAll(); })); try { await.await(1, TimeUnit.MINUTES); } catch (InterruptedException e) { throw new RuntimeException(e); } return new RepairResult(success.get(), wasInconsistent.get()); }; }
Source:
protected void performUpdate(UpdateSecretRequest updateSecretRequest, AWSSecretsManager client) { boolean processed = false; int tryCount = 0; while (!processed) { UpdateSecretResult result = client.updateSecret(updateSecretRequest); if (result.getSdkHttpMetadata().getHttpStatusCode() == 200) { processed = true; } else { tryCount++; if (tryCount >= 5) { throw new RuntimeException("performUpdate, unable to update secret: " + result.toString()); } } } }

Target:
protected void performUpdate(UpdateSecretRequest updateSecretRequest, AWSSecretsManager client) { boolean processed = false; int tryCount = 0; while (!processed) { UpdateSecretResult result = client.updateSecret(updateSecretRequest); if (result.getSdkHttpMetadata().getHttpStatusCode() == 200) { processed = true; } else { tryCount++; if (tryCount >= retryCount) { throw new RuntimeException("performUpdate, unable to update secret: " + result.toString()); } } } }
Source:
public File extractAllActivity(Date startTime, Date endTime, int pollingTimeIntervalSecond, int bulkJobTimeoutSecond) { String exportID = marketoRestClient.createActitvityExtract(startTime, endTime); marketoRestClient.startActitvityBulkExtract(exportID); try { marketoRestClient.waitActitvityExportJobComplete(exportID, pollingTimeIntervalSecond, bulkJobTimeoutSecond); } catch (InterruptedException e) { LOGGER.error("Exception when waiting for export job id: {}", exportID, e); throw new DataException("Error when wait for bulk extract"); } InputStream activitiesBulkExtractResult = marketoRestClient.getActivitiesBulkExtractResult(exportID); return saveExtractedFile(exportID, activitiesBulkExtractResult); }

Target:
public File extractAllActivity(Date startTime, Date endTime, int pollingTimeIntervalSecond, int bulkJobTimeoutSecond) { String exportID = marketoRestClient.createActivityExtract(startTime, endTime); marketoRestClient.startActitvityBulkExtract(exportID); try { marketoRestClient.waitActitvityExportJobComplete(exportID, pollingTimeIntervalSecond, bulkJobTimeoutSecond); } catch (InterruptedException e) { LOGGER.error("Exception when waiting for export job id: {}", exportID, e); throw new DataException("Error when wait for bulk extract"); } InputStream activitiesBulkExtractResult = marketoRestClient.getActivitiesBulkExtractResult(exportID); return saveExtractedFile(exportID, activitiesBulkExtractResult); }
Source:
SocketConnection( SocketClient socket, Logger logger ) { this.socket = socket; this.logger = logger; if( logger.isDebugEnabled() ) { this.responseHandler = new LoggingResponseHandler( logger ); } else { this.responseHandler = new SocketResponseHandler(); } this.socket.start(); }

Target:
SocketConnection( SocketClient socket, Logger logger ) { this.socket = socket; this.logger = logger; this.responseHandler = createResponseHandler( logger ); this.socket.start(); }
Source:
private void list(StoredConfig config) throws IOException, ConfigInvalidException { config.load(); Set<String> sections = config.getSections(); for (String section : sections) { Set<String> names = config.getNames(section); for (String name : names) { for (String value : config.getStringList(section, null, name)) { System.out.println(section + "." + name + "=" + value); } } if (names.isEmpty()) { for (String subsection : config.getSubsections(section)) { names = config.getNames(section, subsection); for (String name : names) { for (String value : config.getStringList(section, subsection, name)) { System.out.println(section + "." + subsection + "." + name + "=" + value); } } } } } }

Target:
private void list(StoredConfig config) throws IOException, ConfigInvalidException { config.load(); Set<String> sections = config.getSections(); for (String section : sections) { Set<String> names = config.getNames(section); for (String name : names) { for (String value : config.getStringList(section, null, name)) System.out.println(section + "." + name + "=" + value); } if (names.isEmpty()) { for (String subsection : config.getSubsections(section)) { names = config.getNames(section, subsection); for (String name : names) { for (String value : config.getStringList(section, subsection, name)) System.out.println(section + "." + subsection + "." + name + "=" + value); } } } } }
Source:
private Estimate summarizePartitionStatistics( Collection<PartitionStatistics> partitionStatistics, String column, Function<HiveColumnStatistics, OptionalDouble> valueExtractFunction, Function<DoubleStream, OptionalDouble> valueAggregateFunction) { DoubleStream intermediateStream = partitionStatistics.stream() .map(PartitionStatistics::getColumnStatistics) .filter(stats -> stats.containsKey(column)) .map(stats -> stats.get(column)) .map(valueExtractFunction) .filter(OptionalDouble::isPresent) .mapToDouble(OptionalDouble::getAsDouble); OptionalDouble statisticsValue = valueAggregateFunction.apply(intermediateStream); if (statisticsValue.isPresent()) { return new Estimate(statisticsValue.getAsDouble()); } return Estimate.unknownValue(); }

Target:
private Estimate summarizePartitionStatistics( Collection<PartitionStatistics> partitionStatistics, String column, Function<HiveColumnStatistics, OptionalDouble> valueExtractFunction, Function<DoubleStream, OptionalDouble> valueAggregateFunction) { DoubleStream intermediateStream = partitionStatistics.stream() .map(PartitionStatistics::getColumnStatistics) .filter(stats -> stats.containsKey(column)) .map(stats -> stats.get(column)) .map(valueExtractFunction) .filter(OptionalDouble::isPresent) .mapToDouble(OptionalDouble::getAsDouble); OptionalDouble statisticsValue = valueAggregateFunction.apply(intermediateStream); if (!statisticsValue.isPresent()) { return Estimate.unknownValue(); } return new Estimate(statisticsValue.getAsDouble()); }
Source:
public void reschedule(final GlobalSchedGroupInfo groupInfo) { synchronized (rbTreeMap) { final long endTime = System.nanoTime(); final long delta = calculateVRuntimeDelta(endTime - groupInfo.getLatestScheduledTime(), groupInfo); final long adjustedVRuntime = groupInfo.getVRuntime() + delta; groupInfo.setVRuntime(adjustedVRuntime); Queue<GlobalSchedGroupInfo> queue = rbTreeMap.get(adjustedVRuntime); if (queue == null) { queue = new LinkedList<>(); rbTreeMap.put(adjustedVRuntime, queue); } queue.add(groupInfo); } }

Target:
public void reschedule(final GlobalSchedGroupInfo groupInfo) { final long endTime = System.nanoTime(); final long delta = calculateVRuntimeDelta(endTime - groupInfo.getLatestScheduledTime(), groupInfo); final long adjustedVRuntime = groupInfo.getVRuntime() + delta; groupInfo.setVRuntime(adjustedVRuntime); addGroup(groupInfo); }