auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void execute(OperationContext opContext, ModelNode model) throws OperationFailedException { try { ServiceName name = SubsystemExtension.SERVICE_NAME; ServiceRegistry serviceRegistry = opContext.getServiceRegistry(true); MonitorService service = (MonitorService) serviceRegistry.getRequiredService(name).getValue(); boolean restart = model.get("restart").asBoolean(false); if (restart) { LOGGER.debug("Asked to restart the Hawkualr Monitor service. Will stop it, then restart it now."); service.stopMonitorService(); } else { LOGGER.debug("Asked to start the Hawkular Monitor service"); } if (!service.isMonitorServiceStarted()) { Thread newThread = new Thread(new Runnable() { @Override public void run() { try { service.startMonitorService(); } catch (Throwable t) { } } }, "Hawkular WildFly Agent Operation Start Thread"); newThread.setDaemon(true); newThread.start(); } } catch (ServiceNotFoundException snfe) { throw new OperationFailedException("Cannot restart Hawkular Monitor service - it is disabled", snfe); } catch (Exception e) { throw new OperationFailedException("Cannot restart Hawkular Monitor service", e); } opContext.stepCompleted(); return; }

Target:
public void execute(OperationContext opContext, ModelNode model) throws OperationFailedException { try { ServiceName name = SubsystemExtension.SERVICE_NAME; ServiceRegistry serviceRegistry = opContext.getServiceRegistry(true); MonitorService service = (MonitorService) serviceRegistry.getRequiredService(name).getValue(); boolean restart = model.get("restart").asBoolean(false); if (restart) { LOGGER.debug("Asked to restart the Hawkualr Monitor service. Will stop it, then restart it now."); service.stopMonitorService(); } else { LOGGER.debug("Asked to start the Hawkular Monitor service"); } if (!service.isMonitorServiceStarted()) { Thread newThread = new Thread(new Runnable() { @Override public void run() { service.startMonitorService(); } }, "Hawkular WildFly Agent Operation Start Thread"); newThread.setDaemon(true); newThread.start(); } } catch (ServiceNotFoundException snfe) { throw new OperationFailedException("Cannot restart Hawkular Monitor service - it is disabled", snfe); } catch (Exception e) { throw new OperationFailedException("Cannot restart Hawkular Monitor service", e); } opContext.stepCompleted(); return; }
Source:
private Node addStateNotations(View sourceView, State newState) { View region = getRegionCompartmentView(sourceView); Node stateNode = ViewService.createNode(region, newState, SemanticHints.STATE, DiagramActivator.DIAGRAM_PREFERENCES_HINT); Bounds sourceBounds = null; if(sourceView instanceof Node){ Node mynode = (Node)sourceView; LayoutConstraint layoutConstraint = mynode.getLayoutConstraint(); if(layoutConstraint instanceof Bounds){ sourceBounds = (Bounds) layoutConstraint; } } Bounds newStateBounds = NotationFactory.eINSTANCE.createBounds(); newStateBounds.setX(sourceBounds.getX()+200); newStateBounds.setY(sourceBounds.getY()); stateNode.setLayoutConstraint(newStateBounds); return stateNode; }

Target:
private Node addStateNotations(View sourceView, State newState) { View region = getParentRegionCompartmentView(sourceView); Node stateNode = ViewService.createNode(region, newState, SemanticHints.STATE, DiagramActivator.DIAGRAM_PREFERENCES_HINT); Bounds sourceBounds = getSourceBounds(sourceView); Bounds newStateBounds = NotationFactory.eINSTANCE.createBounds(); newStateBounds.setX(sourceBounds.getX()+150); newStateBounds.setY(sourceBounds.getY()+50); stateNode.setLayoutConstraint(newStateBounds); return stateNode; }
Source:
public void notifyCheckpointAborted(long checkpointId) throws Exception { if (keyedStateBackend != null && keyedStateBackend instanceof CheckpointListener) { ((CheckpointListener) keyedStateBackend).notifyCheckpointAborted(checkpointId); } }

Target:
public void notifyCheckpointAborted(long checkpointId) throws Exception { if (keyedStateBackend instanceof CheckpointListener) { ((CheckpointListener) keyedStateBackend).notifyCheckpointAborted(checkpointId); } }
Source:
public File getMainApk() { Set<File> testedApkFiles = new HashSet<File>(testedConfiguration.getFiles()); if (testedApkFiles.size() > 1) { File metadataFile = testedMetadata.getSingleFile(); FilterDataPersistence persistence = new FilterDataPersistence(); List<FilterDataPersistence.Record> filterDatas; try { filterDatas = persistence .load(new FileReader(metadataFile)); } catch (IOException e) { throw new RuntimeException(e); } for (FilterDataPersistence.Record filterData : filterDatas) { File splitFile = findSplitFile(testedApkFiles, filterData.splitFileName); if (splitFile != null) { testedApkFiles.remove(splitFile); } else { throw new RuntimeException( String.format("Internal Error : %1$s is not in the list of published files", filterData.splitFileName)); } } if (testedApkFiles.size() != 1) { throw new RuntimeException( String.format("Internal Error : %1$s files are not in the variant metadata", Joiner.on(",").join(testedApkFiles))); } } if (testedApkFiles.isEmpty()) { throw new RuntimeException("Cannot retrieve tested APKs"); } return testedApkFiles.iterator().next(); }

Target:
public File getMainApk() { Set<File> testedApkFiles = new HashSet<File>(testedConfiguration.getFiles()); if (testedApkFiles.size() > 1) { File metadataFile = testedMetadata.getSingleFile(); FilterDataPersistence persistence = new FilterDataPersistence(); List<FilterDataPersistence.Record> filterDatas; try { filterDatas = persistence.load(new FileReader(metadataFile)); } catch (IOException e) { throw new RuntimeException(e); } for (FilterDataPersistence.Record filterData : filterDatas) { File splitFile = findSplitFile(testedApkFiles, filterData.splitFileName); if (splitFile != null) { testedApkFiles.remove(splitFile); } else { throw new RuntimeException( String.format("Internal Error : %1$s is not in the list of published files", filterData.splitFileName)); } } if (testedApkFiles.size() != 1) { throw new RuntimeException( String.format("Internal Error : %1$s files are not in the variant metadata", Joiner.on(",").join(testedApkFiles))); } } if (testedApkFiles.isEmpty()) { throw new RuntimeException("Cannot retrieve tested APKs"); } return Iterables.getOnlyElement(testedApkFiles); }
Source:
protected void executeVmCommand() { initEffectiveCompatibilityVersion(); try { addVmToDb(); addVmToAffinityGroups(); addVmToAffinityLabels(); addPermissionsToDB(); processImages(); vmHandler.addVmInitToDB(getVm().getStaticData().getVmInit()); discardHelper.logIfDisksWithIllegalPassDiscardExist(getVmId()); Cluster cluster = clusterDao.get(getParameters().getClusterId()); if (getVm().getClusterCompatibilityVersionOrigin().less(cluster.getCompatibilityVersion())) { updateVm(); } } catch (RuntimeException e) { macPool.freeMacs(macsAdded); throw e; } setSucceeded(true); getReturnValue().setActionReturnValue(getVm()); }

Target:
protected void executeVmCommand() { try { addVmToDb(); addVmToAffinityGroups(); addVmToAffinityLabels(); addPermissionsToDB(); processImages(); vmHandler.addVmInitToDB(getVm().getStaticData().getVmInit()); discardHelper.logIfDisksWithIllegalPassDiscardExist(getVmId()); Cluster cluster = clusterDao.get(getParameters().getClusterId()); if (getVm() != null && getVm().getClusterCompatibilityVersionOrigin() != null && getVm().getClusterCompatibilityVersionOrigin().less(cluster.getCompatibilityVersion())) { updateVm(); } } catch (RuntimeException e) { macPool.freeMacs(macsAdded); throw e; } setSucceeded(true); getReturnValue().setActionReturnValue(getVm()); }
Source:
public List<E> findSpecificRule(Map<String, String> filterMap) { Criteria criteria = createDistinctRootEntityCriteria(); for (Entry<String, String> filter : filterMap.entrySet()) { if (StringUtils.isNoneEmpty(filter.getValue())) { criteria.add(Restrictions.like(filter.getKey(), filter.getValue())); } else { criteria.add(Restrictions.isNull(filter.getKey())); } } List<E> result = criteria.list(); return result; }

Target:
public List<E> findSpecificRule(Map<String, String> filterMap) { Criteria criteria = createDistinctRootEntityCriteria(); for (Entry<String, String> filter : filterMap.entrySet()) { if (StringUtils.isNotEmpty(filter.getValue())) { criteria.add(Restrictions.eq(filter.getKey(), filter.getValue()).ignoreCase()); } else { criteria.add(Restrictions.isNull(filter.getKey())); } } List<E> result = criteria.list(); return result; }
Source:
private Command createCommandFromString(Item item, String commandAsString) throws BindingConfigParseException { if (CHANGED_COMMAND_KEY.equals(commandAsString)) { return CHANGED_COMMAND_KEY; } else if (WILDCARD_COMMAND_KEY.equals(commandAsString)) { return WILDCARD_COMMAND_KEY; } else { Command command = TypeParser.parseCommand(item.getAcceptedCommandTypes(), commandAsString); if (command == null) { throw new BindingConfigParseException("couldn't create Command from '" + commandAsString + "' "); } return command; } }

Target:
private Command createCommandFromString(Item item, String commandAsString) throws BindingConfigParseException { if (WILDCARD_COMMAND_KEY.equals(commandAsString)) { return WILDCARD_COMMAND_KEY; } else { Command command = TypeParser.parseCommand(item.getAcceptedCommandTypes(), commandAsString); if (command == null) { throw new BindingConfigParseException("couldn't create Command from '" + commandAsString + "' "); } return command; } }
Source:
public void restart(String uiCommand) { final UIConstants constants = ConstantsManager.getInstance().getConstants(); final UIMessages messages = ConstantsManager.getInstance().getMessages(); HostRestartConfirmationModel model = new HostRestartConfirmationModel(); setConfirmWindow(model); model.setTitle(constants.restartHostsTitle()); model.setHelpTag(HelpTag.restart_host); model.setHashName("restart_host"); model.setMessage(constants.areYouSureYouWantToRestartTheFollowingHostsMsg()); ArrayList<String> items = new ArrayList<>(); for (Object item : getSelectedItems()) { VDS vds = (VDS) item; int runningVms = vds.getVmCount(); if (runningVms > 0) { items.add(messages.hostNumberOfRunningVms(vds.getName(), runningVms)); } else { items.add(vds.getName()); } } model.setItems(items); model.setForceToMaintenanceLabel(ConstantsManager.getInstance().getConstants().forceToMaintenance()); model.getForceToMaintenance().setEntity(false); model.getForceToMaintenance().setIsAvailable(true); model.getForceToMaintenance().setIsChangeable(true); UICommand tempVar = new UICommand(uiCommand, this); tempVar.setTitle(constants.ok()); tempVar.setIsDefault(true); model.getCommands().add(tempVar); UICommand tempVar2 = new UICommand("Cancel", this); tempVar2.setTitle(constants.cancel()); tempVar2.setIsCancel(true); model.getCommands().add(tempVar2); }

Target:
public void restart(String uiCommand) { final UIConstants constants = ConstantsManager.getInstance().getConstants(); final UIMessages messages = ConstantsManager.getInstance().getMessages(); HostRestartConfirmationModel model = new HostRestartConfirmationModel(); setConfirmWindow(model); model.setTitle(constants.restartHostsTitle()); model.setHelpTag(HelpTag.restart_host); model.setHashName("restart_host"); model.setMessage(constants.areYouSureYouWantToRestartTheFollowingHostsMsg()); ArrayList<String> items = new ArrayList<>(); for (Object item : getSelectedItems()) { VDS vds = (VDS) item; int runningVms = vds.getVmCount(); if (runningVms > 0) { items.add(messages.hostNumberOfRunningVms(vds.getName(), runningVms)); } else { items.add(vds.getName()); } } model.setItems(items); UICommand tempVar = new UICommand(uiCommand, this); tempVar.setTitle(constants.ok()); tempVar.setIsDefault(true); model.getCommands().add(tempVar); UICommand tempVar2 = new UICommand("Cancel", this); tempVar2.setTitle(constants.cancel()); tempVar2.setIsCancel(true); model.getCommands().add(tempVar2); }
Source:
public static void incrementAttributeInt(ITmfStateSystemBuilder ssb, long t, int attributeQuark, int increment) throws StateValueTypeException, AttributeNotFoundException { Object stateValue = ssb.queryOngoing(attributeQuark); int prevValue = 0; if (stateValue != null && stateValue instanceof Integer) { prevValue = (int) stateValue; } ssb.modifyAttribute(t, prevValue + increment, attributeQuark); }

Target:
public static void incrementAttributeInt(ITmfStateSystemBuilder ssb, long t, int attributeQuark, int increment) { Object stateValue = ssb.queryOngoing(attributeQuark); int prevValue = 0; if (stateValue instanceof Integer) { prevValue = (int) stateValue; } ssb.modifyAttribute(t, prevValue + increment, attributeQuark); }
Source:
public void recordTravelTimesForTarget (int target, int[] times) { int[] percentileTravelTimesMinutes = new int[nPercentiles]; if (times.length == 1) { Arrays.fill(percentileTravelTimesMinutes, times[0]); } else if (times.length == timesPerDestination) { Arrays.sort(times); for (int p = 0; p < nPercentiles; p++) { int timeSeconds = times[percentileIndexes[p]]; if (timeSeconds == FastRaptorWorker.UNREACHED) { percentileTravelTimesMinutes[p] = FastRaptorWorker.UNREACHED; } else { int timeMinutes = timeSeconds / 60; percentileTravelTimesMinutes[p] = timeMinutes; } } } else { throw new ParameterException("Must supply expected number of times or only one time."); } if (retainTravelTimes) timeGrid.setTarget(target, percentileTravelTimesMinutes); if (calculateAccessibility) { Grid grid = accessibilityResult.grids[0]; int x = target % grid.width; int y = target / grid.width; double amount = grid.grid[x][y]; for (int p = 0; p < nPercentiles; p++) { if (percentileTravelTimesMinutes[p] < task.maxTripDurationMinutes) { accessibilityResult.incrementAccessibility(0, 0, p, amount); } } } }

Target:
public void recordTravelTimesForTarget (int target, int[] times) { int[] percentileTravelTimesMinutes = new int[nPercentiles]; if (times.length == 1) { Arrays.fill(percentileTravelTimesMinutes, times[0]); } else if (times.length == timesPerDestination) { Arrays.sort(times); for (int p = 0; p < nPercentiles; p++) { int timeSeconds = times[percentileIndexes[p]]; if (timeSeconds == FastRaptorWorker.UNREACHED) { percentileTravelTimesMinutes[p] = FastRaptorWorker.UNREACHED; } else { int timeMinutes = timeSeconds / 60; percentileTravelTimesMinutes[p] = timeMinutes; } } } else { throw new ParameterException("You must supply the expected number of travel time values (or only one value)."); } if (retainTravelTimes) timeGrid.setTarget(target, percentileTravelTimesMinutes); if (calculateAccessibility) { Grid grid = accessibilityResult.grids[0]; int x = target % grid.width; int y = target / grid.width; double amount = grid.grid[x][y]; for (int p = 0; p < nPercentiles; p++) { if (percentileTravelTimesMinutes[p] < task.maxTripDurationMinutes) { accessibilityResult.incrementAccessibility(0, 0, p, amount); } } } }
Source:
public void setVisible (boolean visible) { super.setVisible (visible); if (visible) { showItem (pendingShowItem); } }

Target:
public void setVisible (boolean visible) { super.setVisible (visible); if ((visible) && (pendingShowItem != null)) { showItem (pendingShowItem); pendingShowItem = null; } }
Source:
protected abstract void runAutonomous() throws InterruptedException, AutonomousModeOverException; public void loadSettings(TuningContext context) { context.getFloat("autonomous-encoder", 0.1f); }

Target:
protected abstract void runAutonomous() throws InterruptedException, AutonomousModeOverException; public void loadSettings(TuningContext context) { this.driveSpeed = context.getFloat("auto-main-driveSpeed", 1.0f); this.rotateSpeed = context.getFloat("auto-main-rotateSpeed", 1.0f); }
Source:
private PackIndex idx(DfsReader ctx) throws IOException { DfsBlockCache.Ref<PackIndex> idxref = index; if (idxref != null) { PackIndex idx = idxref.get(); if (idx != null) return idx; } if (invalid) throw new PackInvalidException(getFileName()); Repository.getGlobalListenerList() .dispatch(new BeforeDfsPackIndexLoadedEvent(this)); synchronized (initLock) { idxref = index; if (idxref != null) { PackIndex idx = idxref.get(); if (idx != null) return idx; } DfsStreamKey idxKey = desc.getStreamKey(INDEX); try { idxref = cache.getOrLoadRef(idxKey, () -> { try { ctx.stats.readIdx++; long start = System.nanoTime(); try (ReadableChannel rc = ctx.db.openFile(desc, INDEX)) { InputStream in = Channels.newInputStream(rc); int wantSize = 8192; int bs = rc.blockSize(); if (0 < bs && bs < wantSize) bs = (wantSize / bs) * bs; else if (bs <= 0) bs = wantSize; PackIndex idx = PackIndex .read(new BufferedInputStream(in, bs)); int sz = (int) Math.min( idx.getObjectCount() * REC_SIZE, Integer.MAX_VALUE); ctx.stats.readIdxBytes += rc.position(); return new DfsBlockCache.Ref<>(idxKey, 0, sz, idx); } finally { ctx.stats.readIdxMicros += elapsedMicros(start); } } catch (EOFException e) { throw new IOException(MessageFormat.format( DfsText.get().shortReadOfIndex, desc.getFileName(INDEX)), e); } catch (IOException e) { throw new IOException(MessageFormat.format( DfsText.get().cannotReadIndex, desc.getFileName(INDEX)), e); } }); } catch (IOException e) { invalid = true; throw e; } PackIndex idx = idxref.get(); if (idx != null) { index = idxref; } return idx; } }

Target:
private PackIndex idx(DfsReader ctx) throws IOException { DfsBlockCache.Ref<PackIndex> idxref = index; if (idxref != null) { PackIndex idx = idxref.get(); if (idx != null) { return idx; } } if (invalid) { throw new PackInvalidException(getFileName()); } Repository.getGlobalListenerList() .dispatch(new BeforeDfsPackIndexLoadedEvent(this)); synchronized (initLock) { idxref = index; if (idxref != null) { PackIndex idx = idxref.get(); if (idx != null) { return idx; } } DfsStreamKey idxKey = desc.getStreamKey(INDEX); try { idxref = cache.getOrLoadRef(idxKey, () -> { try { ctx.stats.readIdx++; long start = System.nanoTime(); try (ReadableChannel rc = ctx.db.openFile(desc, INDEX)) { InputStream in = Channels.newInputStream(rc); int wantSize = 8192; int bs = rc.blockSize(); if (0 < bs && bs < wantSize) { bs = (wantSize / bs) * bs; } else if (bs <= 0) { bs = wantSize; } PackIndex idx = PackIndex .read(new BufferedInputStream(in, bs)); int sz = (int) Math.min( idx.getObjectCount() * REC_SIZE, Integer.MAX_VALUE); ctx.stats.readIdxBytes += rc.position(); return new DfsBlockCache.Ref<>(idxKey, 0, sz, idx); } finally { ctx.stats.readIdxMicros += elapsedMicros(start); } } catch (EOFException e) { throw new IOException(MessageFormat.format( DfsText.get().shortReadOfIndex, desc.getFileName(INDEX)), e); } catch (IOException e) { throw new IOException(MessageFormat.format( DfsText.get().cannotReadIndex, desc.getFileName(INDEX)), e); } }); } catch (IOException e) { invalid = true; throw e; } PackIndex idx = idxref.get(); if (idx != null) { index = idxref; } return idx; } }
Source:
Result(final SearchResult sr) throws NamingException { if (returnAttributes != null) { for (final String attName : returnAttributes) { final Attribute a = sr.getAttributes().get(attName); if (a != null && a.size() > 0) { atts.put(attName, a); attsSingle.put(attName, String.valueOf(a.get(0))); } } } else { NamingEnumeration<? extends Attribute> e = sr.getAttributes().getAll(); while (e.hasMoreElements()) { final Attribute a = e.nextElement(); if (a.size() == 1) { atts.put(a.getID(), a); attsSingle.put(a.getID(), String.valueOf(a.get(0))); } } } atts.put("dn", new BasicAttribute("dn", sr.getNameInNamespace())); attsSingle.put("dn", sr.getNameInNamespace()); }

Target:
Result(final SearchResult sr) throws NamingException { if (returnAttributes != null) { for (final String attName : returnAttributes) { final Attribute a = sr.getAttributes().get(attName); if (a != null && a.size() > 0) { atts.put(attName, a); attsSingle.put(attName, String.valueOf(a.get(0))); } } } else { NamingEnumeration<? extends Attribute> e = sr.getAttributes().getAll(); while (e.hasMoreElements()) { final Attribute a = e.nextElement(); atts.put(a.getID(), a); if (a.size() == 1) { attsSingle.put(a.getID(), String.valueOf(a.get(0))); } } } atts.put("dn", new BasicAttribute("dn", sr.getNameInNamespace())); attsSingle.put("dn", sr.getNameInNamespace()); }
Source:
protected void closeWatchRequest() { if (this.watchRequest == null) { return; } WatchCancelRequest watchCancelRequest = WatchCancelRequest.newBuilder().setWatchId(watchId).build(); WatchRequest cancelRequest = WatchRequest.newBuilder() .setCancelRequest(watchCancelRequest).build(); watchRequest.onNext(cancelRequest); this.watchRequest = null; }

Target:
protected void closeWatchRequest() { if (this.watchRequest == null) { return; } try { WatchCancelRequest watchCancelRequest = WatchCancelRequest.newBuilder().setWatchId(watchId).build(); WatchRequest cancelRequest = WatchRequest.newBuilder() .setCancelRequest(watchCancelRequest).build(); watchRequest.onNext(cancelRequest); } finally { this.watchRequest.onCompleted(); this.watchRequest = null; } }
Source:
private boolean matchesExtensions(LanguageDescription language, String path) { if (language.getFileExtensions() != null) { for (String extension : language.getFileExtensions()) { if (path.endsWith(extension)) { return true; } } } return false; }

Target:
private boolean matchesExtensions(LanguageDescription language, String path) { return language.getFileExtensions().stream().anyMatch(extension->path.endsWith(extension)); }
Source:
public StorageTraversal resolveLocalModel(IResource start, IProgressMonitor monitor) throws InterruptedException { if (!(start instanceof IFile)) { return new StorageTraversal(new LinkedHashSet<IStorage>()); } lock.lockInterruptibly(); try { while (!currentlyResolving.isEmpty()) { notResolving.await(); } resolvedResources = new LinkedHashSet<URI>(); diagnostic = new BasicDiagnostic(); if (getResolutionScope() != CrossReferenceResolutionScope.SELF) { final SynchronizedResourceSet resourceSet = new SynchronizedResourceSet(); updateDependencies(resourceSet, (IFile)start, monitor); updateChangedResources(resourceSet, monitor); } while (!currentlyResolving.isEmpty()) { resolutionEnd.await(); } final Set<IStorage> traversalSet = resolveTraversal((IFile)start, Collections.<URI> emptySet(), monitor); StorageTraversal traversal = new StorageTraversal(traversalSet, diagnostic); diagnostic = null; resolvedResources = null; return traversal; } finally { notResolving.signal(); lock.unlock(); } }

Target:
public StorageTraversal resolveLocalModel(IResource start, IProgressMonitor monitor) throws InterruptedException { if (!(start instanceof IFile)) { return new StorageTraversal(new LinkedHashSet<IStorage>()); } lock.lockInterruptibly(); try { while (!currentlyResolving.isEmpty()) { notResolving.await(); } resolvedResources = new LinkedHashSet<URI>(); diagnostic = new BasicDiagnostic(); if (getResolutionScope() != CrossReferenceResolutionScope.SELF) { final SynchronizedResourceSet resourceSet = new SynchronizedResourceSet(); updateDependencies(resourceSet, (IFile)start, monitor); updateChangedResources(resourceSet, monitor); } while (!currentlyResolving.isEmpty()) { resolutionEnd.await(); } final Set<IStorage> traversalSet = resolveTraversal((IFile)start, Collections.<URI> emptySet()); StorageTraversal traversal = new StorageTraversal(traversalSet, diagnostic); return traversal; } finally { diagnostic = null; resolvedResources = null; notResolving.signal(); lock.unlock(); } }
Source:
public long getCapacity() { long capacity; if (configuredCapacity < 0L) { long remaining; if (cachedCapacity > 0L) { remaining = cachedCapacity - getReserved(); } else { remaining = usage.getCapacity() - getReserved(); } capacity = Math.max(remaining, 0L); } else { capacity = configuredCapacity; } if (enableSameDiskArchival) { double reservedForArchival = conf.getDouble( DFSConfigKeys.DFS_DATANODE_RESERVE_FOR_ARCHIVE_PERCENTAGE, DFSConfigKeys.DFS_DATANODE_RESERVE_FOR_ARCHIVE_PERCENTAGE_DEFAULT); if (storageType == StorageType.ARCHIVE) { capacity = (long) (capacity * reservedForArchival); } else { capacity = (long) (capacity * (1 - reservedForArchival)); } } return capacity; }

Target:
public long getCapacity() { long capacity; if (configuredCapacity < 0L) { long remaining; if (cachedCapacity > 0L) { remaining = cachedCapacity - getReserved(); } else { remaining = usage.getCapacity() - getReserved(); } capacity = Math.max(remaining, 0L); } else { capacity = configuredCapacity; } if (enableSameDiskTiering && dataset.getMountVolumeMap() != null) { double capacityRatio = dataset.getMountVolumeMap() .getCapacityRatioByMountAndStorageType(mount, storageType); capacity = (long) (capacity * capacityRatio); } return capacity; }
Source:
public boolean canExecute() { return null != fbnElement.getType(); }

Target:
public boolean canExecute() { return (null != entry) && (null != fbnElement) && (null != network); }
Source:
public static void decorateTrees(World world, Random rand, int worldX, int worldZ) { if (!Config.isValidTreeDim(world.provider.getDimension())) { return; } if (biomeCache.isEmpty()) { generateBiomeCache(world, rand); } for (int tries = 0; tries < 4 + rand.nextInt(2); tries++) { int x = worldX + rand.nextInt(16); int z = worldZ + rand.nextInt(16); BlockPos pos = new BlockPos(x, 0, z); Biome biome = world.getBiome(pos); Set<ITree> trees = biomeCache.computeIfAbsent(biome.getRegistryName(), k -> new HashSet<>()); for (ITree tree : trees) { IAlleleTreeSpecies species = tree.getGenome().getPrimary(); if (species.getRarity() * Config.generateTreesAmount >= rand.nextFloat()) { pos = getValidPos(world, x, z, tree); if (pos == null) { continue; } if (species.getGrowthProvider().canSpawn(tree, world, pos)) { if (TreeGenHelper.generateTree(tree, world, pos)) { return; } } } } } }

Target:
public static void decorateTrees(World world, Random rand, int worldX, int worldZ) { if (!Config.isValidTreeDim(world.provider.getDimension()) || Config.generateTreesAmount == 0) { return; } if (biomeCache.isEmpty()) { generateBiomeCache(world, rand); } for (int tries = 0; tries < 4 + rand.nextInt(2); tries++) { int x = worldX + rand.nextInt(16); int z = worldZ + rand.nextInt(16); BlockPos pos = new BlockPos(x, 0, z); Biome biome = world.getBiome(pos); Set<ITree> trees = biomeCache.computeIfAbsent(biome.getRegistryName(), k -> new HashSet<>()); for (ITree tree : trees) { IAlleleTreeSpecies species = tree.getGenome().getPrimary(); if (species.getRarity() * Config.generateTreesAmount >= rand.nextFloat()) { pos = getValidPos(world, x, z, tree); if (pos == null) { continue; } if (species.getGrowthProvider().canSpawn(tree, world, pos)) { if (TreeGenHelper.generateTree(tree, world, pos)) { return; } } } } } }
Source:
public void clickOnAllPinTypes() { driver.switchTo().defaultContent(); driver.switchTo().frame(mapFrame); waitForElementByElement(allPinTypes); allPinTypes.click(); PageObjectLogging.log("clickOnAllCategories", "All categories was clicked", true); driver.switchTo().activeElement(); }

Target:
public void clickOnAllPinTypes() { driver.switchTo().defaultContent(); driver.switchTo().frame(mapFrame); waitForElementByElement(allPinTypes); allPinTypes.click(); PageObjectLogging.log("clickOnAllCategories", "All categories were clicked", true); driver.switchTo().activeElement(); }
Source:
protected List<ComparableEvent> index(List<Event> events, Map<String,Integer> predicateIndex) { Map<String,Integer> omap = new HashMap<String,Integer>(); int numEvents = events.size(); int outcomeCount = 0; List<ComparableEvent> eventsToCompare = new ArrayList<>(numEvents); List<Integer> indexedContext = new ArrayList<>(); for (Event ev:events) { String[] econtext = ev.getContext(); ComparableEvent ce; int ocID; String oc = ev.getOutcome(); if (omap.containsKey(oc)) { ocID = omap.get(oc); } else { ocID = outcomeCount++; omap.put(oc, ocID); } for (String pred : econtext) { if (predicateIndex.containsKey(pred)) { indexedContext.add(predicateIndex.get(pred)); } } if (indexedContext.size() > 0) { int[] cons = new int[indexedContext.size()]; for (int ci=0;ci<cons.length;ci++) { cons[ci] = indexedContext.get(ci); } ce = new ComparableEvent(ocID, cons, ev.getValues()); eventsToCompare.add(ce); } else { System.err.println("Dropped event "+ev.getOutcome()+":"+Arrays.asList(ev.getContext())); } indexedContext.clear(); } outcomeLabels = toIndexedStringArray(omap); predLabels = toIndexedStringArray(predicateIndex); return eventsToCompare; }

Target:
protected List<ComparableEvent> index(List<Event> events, Map<String,Integer> predicateIndex) { Map<String,Integer> omap = new HashMap<>(); int numEvents = events.size(); int outcomeCount = 0; List<ComparableEvent> eventsToCompare = new ArrayList<>(numEvents); List<Integer> indexedContext = new ArrayList<>(); for (Event ev:events) { String[] econtext = ev.getContext(); ComparableEvent ce; int ocID; String oc = ev.getOutcome(); if (omap.containsKey(oc)) { ocID = omap.get(oc); } else { ocID = outcomeCount++; omap.put(oc, ocID); } for (String pred : econtext) { if (predicateIndex.containsKey(pred)) { indexedContext.add(predicateIndex.get(pred)); } } if (indexedContext.size() > 0) { int[] cons = new int[indexedContext.size()]; for (int ci = 0; ci < cons.length; ci++) { cons[ci] = indexedContext.get(ci); } ce = new ComparableEvent(ocID, cons, ev.getValues()); eventsToCompare.add(ce); } else { System.err.println("Dropped event " + ev.getOutcome() + ":" + Arrays.asList(ev.getContext())); } indexedContext.clear(); } outcomeLabels = toIndexedStringArray(omap); predLabels = toIndexedStringArray(predicateIndex); return eventsToCompare; }
Source:
public void limit(Actor actor, LocalSession session, @Arg(desc = "The limit to set", def = "") Integer limit) { LocalConfiguration config = worldEdit.getConfiguration(); boolean mayDisable = actor.hasPermission("worldedit.limit.unrestricted"); limit = limit == null ? config.defaultChangeLimit : Math.max(-1, limit); if (!mayDisable && config.maxChangeLimit > -1) { if (limit > config.maxChangeLimit) { actor.printError(TranslatableComponent.of("worldedit.limit.too-high", TextComponent.of(config.maxChangeLimit))); return; } } session.setBlockChangeLimit(limit); Component component = TextComponent.empty().append(TranslatableComponent.of("worldedit.limit.set", TextComponent.of(limit))); if (limit != config.defaultChangeLimit) { component.append(TranslatableComponent.of("worldedit.limit.return-to-default", TextColor.GRAY)); } actor.printInfo(component); }

Target:
public void limit(Actor actor, LocalSession session, @Arg(desc = "The limit to set", def = "") Integer limit) { LocalConfiguration config = worldEdit.getConfiguration(); boolean mayDisable = actor.hasPermission("worldedit.limit.unrestricted"); limit = limit == null ? config.defaultChangeLimit : Math.max(-1, limit); if (!mayDisable && config.maxChangeLimit > -1) { if (limit > config.maxChangeLimit) { actor.printError(TranslatableComponent.of("worldedit.limit.too-high", TextComponent.of(config.maxChangeLimit))); return; } } session.setBlockChangeLimit(limit); Component component = TextComponent.empty().append(TranslatableComponent.of("worldedit.limit.set", TextComponent.of(limit))); if (limit != config.defaultChangeLimit) { component.append(TextComponent.space()).append(TranslatableComponent.of("worldedit.limit.return-to-default", TextColor.GRAY)); } actor.printInfo(component); }
Source:
public void setSlaveConnectTimeoutStr(String slaveConnectTimeoutStr) { if (StringUtils.isBlank(slaveConnectTimeoutStr)) { setSlaveConnectTimeout(100); } else { setSlaveConnectTimeout(Integer.parseInt(slaveConnectTimeoutStr)); } }

Target:
public void setSlaveConnectTimeoutStr(String slaveConnectTimeoutStr) { if (StringUtils.isBlank(slaveConnectTimeoutStr)) { setSlaveConnectTimeout(DEFAULT_SLAVE_JENKINS_CONNECTION_TIMEOUT); } else { setSlaveConnectTimeout(Integer.parseInt(slaveConnectTimeoutStr)); } }
Source:
private void handleMultiInstanceEncapResponse( SerialMessage serialMessage, int offset) { logger.trace("Process Multi-instance Encapsulation"); int instance = serialMessage.getMessagePayloadByte(offset); int commandClassCode = serialMessage.getMessagePayloadByte(offset + 1); CommandClass commandClass = CommandClass.getCommandClass(commandClassCode); if (commandClass == null) { logger.error(String.format("NODE %d: Unsupported command class 0x%02x", this.getNode().getNodeId(), commandClassCode)); return; } logger.debug(String.format("NODE %d: Requested Command Class = %s (0x%02x)", this.getNode().getNodeId(), commandClass.getLabel() , commandClassCode)); ZWaveEndpoint endpoint = this.endpoints.get(instance); ZWaveCommandClass zwaveCommandClass = null; if (endpoint != null) { zwaveCommandClass = endpoint.getCommandClass(commandClass); if (zwaveCommandClass == null) { logger.warn(String.format("NODE %d: CommandClass %s (0x%02x) not implemented by endpoint %d, fallback to main node.", commandClass.getLabel(), commandClassCode, instance)); } } if (zwaveCommandClass == null) { zwaveCommandClass = this.getNode().getCommandClass(commandClass); } if (zwaveCommandClass == null) { logger.error(String.format("NODE %d: Unsupported command class %s (0x%02x)", this.getNode().getNodeId(), commandClass.getLabel(), commandClassCode)); return; } logger.debug("NODE {}: Instance = {}, calling handleApplicationCommandRequest.", this.getNode().getNodeId(), instance); zwaveCommandClass.handleApplicationCommandRequest(serialMessage, offset + 2, instance); }

Target:
private void handleMultiInstanceEncapResponse( SerialMessage serialMessage, int offset) { logger.trace("Process Multi-instance Encapsulation"); int instance = serialMessage.getMessagePayloadByte(offset); int commandClassCode = serialMessage.getMessagePayloadByte(offset + 1); CommandClass commandClass = CommandClass.getCommandClass(commandClassCode); if (commandClass == null) { logger.error(String.format("NODE %d: Unsupported command class 0x%02x", this.getNode().getNodeId(), commandClassCode)); return; } logger.debug(String.format("NODE %d: Requested Command Class = %s (0x%02x)", this.getNode().getNodeId(), commandClass.getLabel() , commandClassCode)); ZWaveCommandClass zwaveCommandClass = null; if (this.getVersion() >= 2) { ZWaveEndpoint endpoint = this.endpoints.get(instance); if (endpoint != null) { zwaveCommandClass = endpoint.getCommandClass(commandClass); if (zwaveCommandClass == null) { logger.warn(String.format("NODE %d: CommandClass %s (0x%02x) not implemented by endpoint %d, fallback to main node.", this.getNode().getNodeId(), commandClass.getLabel(), commandClassCode, instance)); } } } if (zwaveCommandClass == null) { zwaveCommandClass = this.getNode().getCommandClass(commandClass); } if (zwaveCommandClass == null) { logger.error(String.format("NODE %d: Unsupported command class %s (0x%02x)", this.getNode().getNodeId(), commandClass.getLabel(), commandClassCode)); return; } logger.debug("NODE {}: Instance = {}, calling handleApplicationCommandRequest.", this.getNode().getNodeId(), instance); zwaveCommandClass.handleApplicationCommandRequest(serialMessage, offset + 2, instance); }
Source:
synchronized EndpointContext getFollowUpEndpointContext(EndpointContext blockContext) { if (followUpEndpointContext == null || !followUpEndpointContext.getPeerAddress().equals(blockContext.getPeerAddress())) { EndpointContext context = exchange.getRequest().getDestinationContext(); String mode = context.get(DtlsEndpointContext.KEY_HANDSHAKE_MODE); if (mode != null && mode.equals(DtlsEndpointContext.HANDSHAKE_MODE_NONE)) { blockContext = MapBasedEndpointContext.addEntries(blockContext, DtlsEndpointContext.KEY_HANDSHAKE_MODE, DtlsEndpointContext.HANDSHAKE_MODE_NONE); } followUpEndpointContext = blockContext; } return followUpEndpointContext; }

Target:
synchronized EndpointContext getFollowUpEndpointContext(EndpointContext blockContext) { if (followUpEndpointContext == null || !followUpEndpointContext.getPeerAddress().equals(blockContext.getPeerAddress())) { EndpointContext context = exchange.getRequest().getDestinationContext(); String mode = context.get(DtlsEndpointContext.KEY_HANDSHAKE_MODE); if (mode != null && mode.equals(DtlsEndpointContext.HANDSHAKE_MODE_NONE)) { followUpEndpointContext = MapBasedEndpointContext.addEntries(blockContext, DtlsEndpointContext.KEY_HANDSHAKE_MODE, DtlsEndpointContext.HANDSHAKE_MODE_NONE); } else { followUpEndpointContext = blockContext; } } return followUpEndpointContext; }
Source:
public <T extends IEvaluation> T[] doEvaluation(JavaRDD<DataSet> data, int evalBatchSize, T... emptyEvaluations) { IEvaluateFlatMapFunction<T> evalFn = new IEvaluateFlatMapFunction<>(false, sc.broadcast(conf.toJson()), sc.broadcast(network.params()), evalBatchSize, emptyEvaluations); JavaRDD<T[]> evaluations = data.mapPartitions(evalFn); return evaluations.reduce(new IEvaluationReduceFunction<T>()); }

Target:
public <T extends IEvaluation> T[] doEvaluation(JavaRDD<DataSet> data, int evalBatchSize, T... emptyEvaluations) { IEvaluateFlatMapFunction<T> evalFn = new IEvaluateFlatMapFunction<>(false, sc.broadcast(conf.toJson()), sc.broadcast(network.params()), evalBatchSize, emptyEvaluations); JavaRDD<T[]> evaluations = data.mapPartitions(evalFn); return evaluations.treeAggregate(null, new IEvaluateAggregateFunction<T>(), new IEvaluationReduceFunction<T>()); }
Source:
public Adapter getContentAdapter() { if (adapter == null) { adapter = new EContentAdapter() { @Override public void notifyChanged(final Notification notification) { int type = notification.getEventType(); switch (type) { case Notification.ADD: case Notification.ADD_MANY: case Notification.REMOVE: case Notification.REMOVE_MANY: Display.getDefault().asyncExec(() -> refreshChildren()); break; case Notification.SET: break; default: break; } } }; } return adapter; }

Target:
public Adapter getContentAdapter() { if (null == adapter) { adapter = new EContentAdapter() { @Override public void notifyChanged(final Notification notification) { int type = notification.getEventType(); switch (type) { case Notification.ADD: case Notification.ADD_MANY: case Notification.REMOVE: case Notification.REMOVE_MANY: Display.getDefault().asyncExec(() -> refreshChildren()); break; case Notification.SET: break; default: break; } } }; } return adapter; }
Source:
public void parseOptionMap(Map<String, String[]> parameters) throws CmdLineException { parseOptionMap(parameters, new ArrayList<String>()); }

Target:
public void parseOptionMap(Map<String, String[]> parameters) throws CmdLineException { parseOptionMap(parameters, Collections.<String>emptySet()); }
Source:
private void cancelQuery(String sql) throws InterruptedException { long endTime = System.currentTimeMillis() + SECONDS.toMillis(30); while (System.currentTimeMillis() < endTime) { String findQuerySql = "SELECT query_id from system.runtime.queries WHERE query = '%s' and state = 'RUNNING' LIMIT 2"; QueryResult queryResult = query(format(findQuerySql, sql)); checkState(queryResult.getRowsCount() < 2, "Query is executed multiple times"); if (queryResult.getRowsCount() == 1) { String queryId = (String) queryResult.row(0).get(0); Response response = queryCanceller.cancel(queryId); if (response.getStatusCode() != HttpStatus.OK.code() && response.getStatusCode() != HttpStatus.ACCEPTED.code() && response.getStatusCode() != HttpStatus.NO_CONTENT.code()) { fail(String.format("Unexpected error code %s; reason=%s", response.getStatusCode(), response.getStatusMessage())); } return; } TimeUnit.MILLISECONDS.sleep(100L); } throw new IllegalStateException("Query did not reach running state or maybe it was too quick."); }

Target:
private void cancelQuery(String sql) throws InterruptedException { Stopwatch stopwatch = Stopwatch.createStarted(); while (stopwatch.elapsed(SECONDS) < 30) { String findQuerySql = "SELECT query_id from system.runtime.queries WHERE query = '%s' and state = 'RUNNING' LIMIT 2"; QueryResult queryResult = query(format(findQuerySql, sql)); checkState(queryResult.getRowsCount() < 2, "Query is executed multiple times"); if (queryResult.getRowsCount() == 1) { String queryId = (String) queryResult.row(0).get(0); Response response = queryCanceller.cancel(queryId); Assertions.assertThat(response.getStatusCode()).isEqualTo(HttpStatus.NO_CONTENT.code()); return; } MILLISECONDS.sleep(100L); } throw new IllegalStateException("Query did not reach running state or maybe it was too quick."); }
Source:
public static void GetVmsRunningOnOrMigratingToVds(AsyncQuery aQuery, Guid id) { aQuery.converterCallback = new IAsyncConverter() { @Override public Object Convert(Object source, AsyncQuery _asyncQuery) { ArrayList<VM> vms = (ArrayList<VM>) source; return vms; } }; Frontend.RunQuery(VdcQueryType.GetVmsRunningOnOrMigratingToVds, new GetVmsRunningOnOrMigratingToVdsParameters(id), aQuery); }

Target:
public static void GetVmsRunningOnOrMigratingToVds(AsyncQuery aQuery, Guid id) { aQuery.converterCallback = new IAsyncConverter() { @Override public Object Convert(Object source, AsyncQuery _asyncQuery) { if (source == null) { return new ArrayList<VM>(); } return source; } }; Frontend.RunQuery(VdcQueryType.GetVmsRunningOnOrMigratingToVds, new GetVmsRunningOnOrMigratingToVdsParameters(id), aQuery); }
Source:
public void testSuccessfulSessionId() { VdcQueryParametersBase params = new VdcQueryParametersBase();; params.setHttpSessionId("good_session_id"); ValidateSessionQuery<VdcQueryParametersBase> query = spy(new ValidateSessionQuery<VdcQueryParametersBase>(params)); when(query.getSessionUser("good_session_id")).thenReturn(new VdcUser(Guid.NewGuid(), "myUser", "myDomain")); query.Execute(); Assert.assertTrue(query.getQueryReturnValue().getSucceeded()); Assert.assertTrue(query.getQueryReturnValue().getReturnValue() instanceof VdcUser); VdcUser user = (VdcUser) query.getQueryReturnValue().getReturnValue(); Assert.assertTrue(user.getDomainControler().equals("myDomain")); Assert.assertTrue(user.getUserName().equals("myUser")); }

Target:
public void testSuccessfulSessionId() { VdcQueryParametersBase params = new VdcQueryParametersBase();; params.setHttpSessionId("good_session_id"); ValidateSessionQuery<VdcQueryParametersBase> query = spy(new ValidateSessionQuery<VdcQueryParametersBase>(params)); when(query.getSessionUser("good_session_id")).thenReturn(new VdcUser(Guid.NewGuid(), "myUser", "myDomain")); query.Execute(); assertTrue(query.getQueryReturnValue().getSucceeded()); assertTrue(query.getQueryReturnValue().getReturnValue() instanceof VdcUser); VdcUser user = (VdcUser) query.getQueryReturnValue().getReturnValue(); assertTrue(user.getDomainControler().equals("myDomain")); assertTrue(user.getUserName().equals("myUser")); }
Source:
public ANetApiResponse TestGetAccountUpdaterJobDetails() throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException { return GetAccountUpdaterJobDetails.run(apiLoginId, transactionKey); }

Target:
public ANetApiResponse TestGetAccountUpdaterJobDetails() { return GetAccountUpdaterJobDetails.run(apiLoginId, transactionKey); }
Source:
private void finalizeMetadataChunk() { finalBlobProperties = new BlobProperties(getBlobSize(), passedInBlobProperties.getServiceId(), passedInBlobProperties.getOwnerId(), passedInBlobProperties.getContentType(), passedInBlobProperties.isPrivate(), passedInBlobProperties.getTimeToLiveInSeconds(), passedInBlobProperties.getCreationTimeInMs(), passedInBlobProperties.getAccountId(), passedInBlobProperties.getContainerId(), passedInBlobProperties.isEncrypted(), passedInBlobProperties.getExternalAssetTag()); if (isStitchOperation() || getNumDataChunks() > 1) { List<Pair<StoreKey, Long>> orderedChunkIdList = indexToChunkIds.values().stream().collect( Collectors.toList()); buf = MetadataContentSerDe.serializeMetadataContentV3(getBlobSize(), orderedChunkIdList); onFillComplete(false); } else { blobId = (BlobId) indexToChunkIds.get(0).getFirst(); state = ChunkState.Complete; operationCompleted = true; } }

Target:
private void finalizeMetadataChunk() { finalBlobProperties = new BlobProperties(getBlobSize(), passedInBlobProperties.getServiceId(), passedInBlobProperties.getOwnerId(), passedInBlobProperties.getContentType(), passedInBlobProperties.isPrivate(), passedInBlobProperties.getTimeToLiveInSeconds(), passedInBlobProperties.getCreationTimeInMs(), passedInBlobProperties.getAccountId(), passedInBlobProperties.getContainerId(), passedInBlobProperties.isEncrypted(), passedInBlobProperties.getExternalAssetTag()); if (isStitchOperation() || getNumDataChunks() > 1) { if (routerConfig.routerMetadataContentVersion == MessageFormatRecord.Metadata_Content_Version_V2) { buf = MetadataContentSerDe.serializeMetadataContentV2(intermediateChunkSize, getBlobSize(), getSuccessfullyPutChunkIds()); } else if (routerConfig.routerMetadataContentVersion == MessageFormatRecord.Metadata_Content_Version_V3) { List<Pair<StoreKey, Long>> orderedChunkIdList = new ArrayList<>(indexToChunkIdsAndChunkSizes.values()); buf = MetadataContentSerDe.serializeMetadataContentV3(getBlobSize(), orderedChunkIdList); } else { throw new IllegalStateException( "Unexpected metadata content version: " + routerConfig.routerMetadataContentVersion); } onFillComplete(false); } else { blobId = (BlobId) indexToChunkIdsAndChunkSizes.get(0).getFirst(); state = ChunkState.Complete; operationCompleted = true; } }
Source:
long getThreadDelayTimeInSecond(int daemonThreadIntervalSeconds) { OffsetDateTime now = OffsetDateTime.now(ZoneOffset.UTC); long roundOfTimeStamp = OffsetDateTime.of(now.getYear(), now.getMonthValue(), now.getDayOfMonth(), now.getHour(), 0, 0, 0, ZoneOffset.UTC).toEpochSecond(); long initialDelay = Math.min(INITIAL_THREAD_DELAY, daemonThreadIntervalSeconds); while ((roundOfTimeStamp - now.toEpochSecond()) < initialDelay) { roundOfTimeStamp += daemonThreadIntervalSeconds; } return roundOfTimeStamp - now.toEpochSecond(); }

Target:
long getThreadDelayTimeInSecond(int daemonThreadIntervalSeconds) { OffsetDateTime now = OffsetDateTime.now(ZoneOffset.UTC); long truncatedTimestamp = now.truncatedTo(ChronoUnit.HOURS).toEpochSecond(); long minDelay = Math.min(MIN_INITIAL_DELAY, daemonThreadIntervalSeconds); while ((truncatedTimestamp - now.toEpochSecond()) < minDelay) { truncatedTimestamp += daemonThreadIntervalSeconds; } return truncatedTimestamp - now.toEpochSecond(); }
Source:
public boolean parseOptions(final PrintStream messageStream, final String[] args) { this.argv = args; this.messageStream = messageStream; if (prefix.isEmpty()) { commandLine = callerOptions.getClass().getName(); } for (int i = 0; i < args.length; ++i) { final String arg = args[i]; if (arg.equals("-h") || arg.equals("--help")) { usage(messageStream, false); return false; } if (arg.equals("-H") || arg.equals("--stdhelp")) { usage(messageStream, true); return false; } if (arg.equals("--version")) { messageStream.println(getVersion()); return false; } final String[] pair = arg.split("=", 2); if (pair.length == 2 && pair[1].isEmpty() && i < args.length - 1) { pair[1] = args[++i]; } if (pair.length == 2) { if (!parseOption(pair[0], pair[1], false)) { messageStream.println(); usage(messageStream, true); return false; } } else if (!parsePositionalArgument(arg)) { messageStream.println(); usage(messageStream, false); return false; } } if (!checkNumArguments()) { messageStream.println(); usage(messageStream, false); return false; } if (!parseChildOptions()) { messageStream.println(); usage(messageStream, false); return false; } return true; }

Target:
public boolean parseOptions(final PrintStream messageStream, final String[] args) { this.argv = args; this.messageStream = messageStream; if (prefix.isEmpty()) { commandLine = callerOptions.getClass().getName(); } for (int i = 0; i < args.length; ++i) { final String arg = args[i]; if (arg.equals("-h") || arg.equals("--help")) { usage(messageStream, false); return false; } if (arg.equals("-H") || arg.equals("--stdhelp")) { usage(messageStream, true); return false; } if (arg.equals("--version")) { messageStream.println(getVersion()); return false; } final String[] pair = arg.split("=", 2); if (pair.length == 2) { if (pair[1].isEmpty() && i < args.length - 1) { pair[1] = args[++i]; } if (!parseOption(pair[0], pair[1], false)) { messageStream.println(); usage(messageStream, true); return false; } } else if (!parsePositionalArgument(arg)) { messageStream.println(); usage(messageStream, false); return false; } } if (!checkNumArguments()) { messageStream.println(); usage(messageStream, false); return false; } if (!parseChildOptions()) { messageStream.println(); usage(messageStream, false); return false; } return true; }
Source:
public ClassOrInterfaceDeclaration visit(ClassOrInterfaceDeclaration cid, Void arg) { if (cid.isInterface()) { return cid; } super.visit(cid, arg); removeIfPrivateOrPkgPrivate(cid); return cid; }

Target:
public ClassOrInterfaceDeclaration visit(ClassOrInterfaceDeclaration cid, Void arg) { boolean prevIP = implicitlyPublic; if (cid.isInterface()) { implicitlyPublic = true; } super.visit(cid, arg); if (cid.isInterface()) { implicitlyPublic = prevIP; } return cid; }