auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.workouts_activity); prepareGestureListener(); addListeners(); TabHost tabHost = (TabHost)findViewById(R.id.tabhost); tabHost.setup(); TabSpec tabSpecs = tabHost.newTabSpec("TabSpec"); tabSpecs.setContent(R.id.tab1); tabSpecs.setIndicator("Workouts"); tabHost.addTab(tabSpecs); tabSpecs = tabHost.newTabSpec("TabSpec2"); tabSpecs.setContent(R.id.tab2); tabSpecs.setIndicator("Workouts"); tabHost.addTab(tabSpecs); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.planing_activity); prepareGestureListener(); addListeners(); TabHost tabHost = (TabHost)findViewById(R.id.tabhost); tabHost.setup(); TabSpec tabSpecs = tabHost.newTabSpec(TAB_SPEC_1_TAG); tabSpecs.setContent(R.id.tab1); tabSpecs.setIndicator("Workouts"); tabHost.addTab(tabSpecs); tabSpecs = tabHost.newTabSpec(TAB_SPEC_2_TAG); tabSpecs.setContent(R.id.tab2); tabSpecs.setIndicator("Workouts"); tabHost.addTab(tabSpecs); }
Source:
public void testToStringDefault() { DateFormat df = new SimpleDateFormat("HH:mm:ss.SSS"); df.setTimeZone(TimeZone.getTimeZone("UTC")); int timeOffset = TimeZone.getDefault().getOffset(0); Date d0 = new Date(0 + timeOffset); Date d1 = new Date(12345000L + timeOffset); Date d2 = new Date(1234500L + timeOffset); Date d3 = new Date(1234500000L + timeOffset); assertEquals("toString", df.format(d0) + " 000 000", ts0.toString()); assertEquals("toString", df.format(d1) + " 000 000", ts1.toString()); assertEquals("toString", df.format(d2) + " 000 000", ts2.toString()); assertEquals("toString", df.format(d3) + " 000 000", ts3.toString()); }

Target:
public void testToStringDefault() { DateFormat df = new SimpleDateFormat("HH:mm:ss.SSS"); Date d0 = new Date(0); Date d1 = new Date(12345000L); Date d2 = new Date(1234500L); Date d3 = new Date(1234500000L); assertEquals("toString", df.format(d0) + " 000 000", ts0.toString()); assertEquals("toString", df.format(d1) + " 000 000", ts1.toString()); assertEquals("toString", df.format(d2) + " 000 000", ts2.toString()); assertEquals("toString", df.format(d3) + " 000 000", ts3.toString()); }
Source:
private void reviewRecursive(Path src, Path dest, Session session) throws IOException { if (src.toString().contains("/dataset/")) { warn().collectionID(this) .uri(dest.toString()) .user(session) .log("warning received recursive review request for dataset content uri - this is a " + "potentially destructive action and could delete the updated previous version in the " + "collection"); } FileUtils.deleteDirectory(dest.getParent().toFile()); FileUtils.moveDirectory(src.getParent().toFile(), dest.getParent().toFile()); zebedee.getCollections().removeEmptyCollectionDirectories(src.getParent()); }

Target:
private void reviewRecursive(Path src, Path dest, Session session) throws IOException { if (src.toString().contains(DATASETS_URI)) { warn().collectionID(this) .uri(dest.toString()) .user(session) .log("warning received recursive review request for dataset content uri - this is a " + "potentially destructive action and could delete the updated previous version in the " + "collection"); } FileUtils.deleteDirectory(dest.getParent().toFile()); FileUtils.moveDirectory(src.getParent().toFile(), dest.getParent().toFile()); zebedee.getCollections().removeEmptyCollectionDirectories(src.getParent()); }
Source:
public boolean mappingExists(String alias, Map<String, Tag> idMap) { return alias != null && idMap != null && idMap.containsKey(alias); }

Target:
public static boolean mappingExists(String alias, Map<String, Tag> idMap) { return alias != null && idMap != null && idMap.containsKey(alias); }
Source:
public void convert_skip_null_abstract() throws IOException { Result sourceDataset = minimalEntityBuilder(ID, InfoSpaceConstants.SEMANTIC_CLASS_INSTANCE_TYPE_DATASET); addDescription(sourceDataset, "null"); addDescription(sourceDataset, ABSTRACT); DataSetReference metadata = converter.convert(sourceDataset); assertNotNull(metadata); assertEquals(ABSTRACT, metadata.getDescription()); }

Target:
public void convert_skip_null_abstract() { Result sourceDataset = minimalEntityBuilder(ID, InfoSpaceConstants.SEMANTIC_CLASS_INSTANCE_TYPE_DATASET); addDescription(sourceDataset, "null"); addDescription(sourceDataset, ABSTRACT); DataSetReference metadata = converter.convert(sourceDataset); assertNotNull(metadata); assertEquals(ABSTRACT, metadata.getDescription()); }
Source:
public DroolsAbstractTriConstraintStream(DroolsConstraintFactory<Solution_> constraintFactory, DroolsAbstractTriConstraintStream<Solution_, A, B, C> parent) { super(constraintFactory); if (parent == null && !(this instanceof DroolsJoinTriConstraintStream)) { throw new IllegalArgumentException("Parent of stream (" + this + ") must not be null, or not join stream."); } this.parent = parent; }

Target:
public DroolsAbstractTriConstraintStream(DroolsConstraintFactory<Solution_> constraintFactory, DroolsAbstractTriConstraintStream<Solution_, A, B, C> parent) { super(constraintFactory); if (parent == null && !(this instanceof DroolsJoinTriConstraintStream)) { throw new IllegalArgumentException("The stream (" + this + ") must have a parent (null), " + "unless it's a join stream."); } this.parent = parent; }
Source:
public ITimeEvent splitBefore(long splitTime) { throw new UnsupportedOperationException(); }

Target:
public ITimeEvent splitBefore(long splitTime) { return (splitTime > fTime ? new TimeEvent(getEntry(), fTime, Math.min(fDuration, splitTime - fTime)) : null); }
Source:
private org.mule.maven.client.api.model.RemoteRepository toRemoteRepo(RemoteRepository remoteRepository) { String id = remoteRepository.getId(); Optional<Authentication> authentication = getAuthentication(remoteRepository); URL url = null; try { url = getURL(remoteRepository); } catch (MavenExecutionException e) { e.printStackTrace(); } org.mule.maven.client.api.model.RemoteRepository.RemoteRepositoryBuilder builder = new org.mule.maven.client.api.model.RemoteRepository.RemoteRepositoryBuilder(); authentication.ifPresent(builder::withAuthentication); return builder .withId(id) .withUrl(url) .build(); }

Target:
private org.mule.maven.client.api.model.RemoteRepository toRemoteRepo(RemoteRepository remoteRepository) { String id = remoteRepository.getId(); Optional<Authentication> authentication = getAuthentication(remoteRepository); URL remoteRepositoryUrl = getURL(remoteRepository); org.mule.maven.client.api.model.RemoteRepository.RemoteRepositoryBuilder builder = new org.mule.maven.client.api.model.RemoteRepository.RemoteRepositoryBuilder(); authentication.ifPresent(builder::withAuthentication); return builder .withId(id) .withUrl(remoteRepositoryUrl) .build(); }
Source:
public boolean isEnabledForMultipleContexts() { return enabledForMultipleContexts; }

Target:
protected boolean isEnabledForMultipleContexts() { return enabledForMultipleContexts; }
Source:
public EventProcessor buildEventProcessor() { EventPosition initialEventPosition = this.initialEventPosition == null ? EventPosition.earliest() : this.initialEventPosition; return new EventProcessor(buildAsyncClient(), this.consumerGroupName, this.partitionProcessorFactory, initialEventPosition, partitionManager); }

Target:
public EventProcessor buildEventProcessor() { EventPosition initialEventPosition = this.initialEventPosition == null ? EventPosition.earliest() : this.initialEventPosition; final TracerProvider tracerProvider = new TracerProvider(ServiceLoader.load(Tracer.class)); return new EventProcessor(buildAsyncClient(), consumerGroupName, partitionProcessorFactory, initialEventPosition, partitionManager, tracerProvider); }
Source:
private RSDL getRSDL(Application application) { for (Object obj : application.getSingletons()) { if (obj instanceof BackendApiResource) { BackendApiResource resource = (BackendApiResource) obj; return resource.getRSDL(); } } return null; }

Target:
private RSDL getRSDL(Application application) { RSDL rsdl = null; for (Object obj : application.getSingletons()) { if (obj instanceof BackendApiResource) { BackendApiResource resource = (BackendApiResource) obj; rsdl = resource.getRSDL(); break; } } assert (rsdl != null) : "Resource that generates RSDL, BackendApiResource, not found (this should never happen)"; return rsdl; }
Source:
private BlameScmResult doShellAnnotate( IntegrityScmProviderRepository iRepo, ScmFileSet workingDirectory, String filename ) { BlameScmResult result; Commandline shell = new Commandline(); shell.setWorkingDirectory( workingDirectory.getBasedir() ); shell.setExecutable( "si" ); shell.createArg().setValue( "annotate" ); shell.createArg().setValue( "--hostname=" + iRepo.getHost() ); shell.createArg().setValue( "--port=" + iRepo.getPort() ); shell.createArg().setValue( "--user=" + iRepo.getUser() ); shell.createArg().setValue( "--fields=date,revision,author" ); shell.createArg().setValue( '"' + filename + '"' ); IntegrityBlameConsumer shellConsumer = new IntegrityBlameConsumer( getLogger() ); String commandLine = CommandLineUtils.toString( shell.getCommandline() ); try { if ( getLogger().isDebugEnabled() ) { getLogger().debug( "Executing: " + commandLine ); } int exitCode = CommandLineUtils.executeCommandLine( shell, shellConsumer, new CommandLineUtils.StringStreamConsumer() ); boolean success = ( exitCode == 0 ? true : false ); ScmResult scmResult = new ScmResult( commandLine, "", "Exit Code: " + exitCode, success ); return new BlameScmResult( shellConsumer.getBlameList(), scmResult ); } catch ( CommandLineException cle ) { getLogger().error( "Command Line Exception: " + cle.getMessage() ); result = new BlameScmResult( commandLine, cle.getMessage(), "", false ); } return result; }

Target:
private BlameScmResult doShellAnnotate( IntegrityScmProviderRepository iRepo, ScmFileSet workingDirectory, String filename ) { BlameScmResult result; Commandline shell = new Commandline(); shell.setWorkingDirectory( workingDirectory.getBasedir() ); shell.setExecutable( "si" ); shell.createArg().setValue( "annotate" ); shell.createArg().setValue( "--hostname=" + iRepo.getHost() ); shell.createArg().setValue( "--port=" + iRepo.getPort() ); shell.createArg().setValue( "--user=" + iRepo.getUser() ); shell.createArg().setValue( "--fields=date,revision,author" ); shell.createArg().setValue( '"' + filename + '"' ); IntegrityBlameConsumer shellConsumer = new IntegrityBlameConsumer( getLogger() ); String commandLine = CommandLineUtils.toString( shell.getCommandline() ); try { getLogger().debug( "Executing: " + commandLine ); int exitCode = CommandLineUtils.executeCommandLine( shell, shellConsumer, new CommandLineUtils.StringStreamConsumer() ); boolean success = ( exitCode == 0 ? true : false ); ScmResult scmResult = new ScmResult( commandLine, "", "Exit Code: " + exitCode, success ); return new BlameScmResult( shellConsumer.getBlameList(), scmResult ); } catch ( CommandLineException cle ) { getLogger().error( "Command Line Exception: " + cle.getMessage() ); result = new BlameScmResult( commandLine, cle.getMessage(), "", false ); } return result; }
Source:
public static List<String> getLocalesKeys(BackendLocal backend, ConfigurationValues configValues) { if (!configValues.equals(ConfigurationValues.UnsupportedLocalesFilter) && !configValues.equals(ConfigurationValues.UnsupportedDisplayedLocales)) { throw new IllegalArgumentException("Passed in config value not related to locales"); } List<String> result = new ArrayList<String>(); String locales = backend.runPublicQuery(VdcQueryType.GetConfigurationValue, new GetConfigurationValueParameters(configValues, ConfigCommon.defaultConfigurationVersion)).getReturnValue(); if (locales != null && !locales.isEmpty()) { String[] localeKeys = locales.split(" *, *"); for (String localeKey: localeKeys) { try { org.apache.commons.lang.LocaleUtils.toLocale(localeKey.trim()); result.add(localeKey.trim()); } catch (IllegalArgumentException iae) { } } } return result; }

Target:
public static List<String> getLocalesKeys(BackendLocal backend, ConfigurationValues configValues) { if (!configValues.equals(ConfigurationValues.UnsupportedLocalesFilter) && !configValues.equals(ConfigurationValues.UnsupportedDisplayedLocales)) { throw new IllegalArgumentException("Passed in config value not related to locales"); } List<String> result = new ArrayList<String>(); String locales = backend.runPublicQuery(VdcQueryType.GetConfigurationValue, new GetConfigurationValueParameters(configValues, ConfigCommon.defaultConfigurationVersion)).getReturnValue(); if (locales != null && !locales.isEmpty()) { String[] localeKeys = locales.trim().split(" *, *"); for (String localeKey: localeKeys) { try { org.apache.commons.lang.LocaleUtils.toLocale(localeKey); result.add(localeKey); } catch (IllegalArgumentException iae) { } } } return result; }
Source:
protected ByteStreamSplitValuesReader(int elementSizeInBytes) { numStreams = elementSizeInBytes; this.elementSizeInBytes = elementSizeInBytes; indexInStream = 0; numberOfValues = 0; }

Target:
protected ByteStreamSplitValuesReader(int elementSizeInBytes) { this.elementSizeInBytes = elementSizeInBytes; this.indexInStream = 0; this.valuesCount = 0; }
Source:
public void onPartitionsAssigned(Collection<TopicPartition> partitions) { log.debug("controlLoop partitions assigned"); acknowlegmentHandler.addPartitions(partitions); for (TopicPartition partition : partitions) { flowControl.merge(partition, new AtomicInteger(), (oldValue, newValue) -> oldValue == null ? newValue : oldValue); } }

Target:
public void onPartitionsAssigned(Collection<TopicPartition> partitions) { log.debug("controlLoop partitions assigned"); acknowledgmentHandler.addPartitions(partitions); for (TopicPartition partition : partitions) { flowControl.merge(partition, new AtomicInteger(), (oldValue, newValue) -> oldValue == null ? newValue : oldValue); } }
Source:
private Profile[] findExistingProfiles( List<PagedFile> pagedFiles ) { return pagedFiles.stream() .map( pf -> pf.file().getParentFile() ) .distinct() .flatMap( dir -> Profile.findProfilesInDirectory( fs, dir ) ) .sorted() .toArray( Profile[]::new ); }

Target:
private Profile[] findExistingProfiles( List<PagedFile> pagedFiles ) { return pagedFiles.stream() .map( pf -> pf.file().getParentFile() ) .distinct() .flatMap( dir -> Profile.findProfilesInDirectory( fs, dir ) ) .toArray( Profile[]::new ); }
Source:
public ProtocolVersion getLowerSupported() { switch (this) { case V5: return V4; case V4: return V3; case V3: return V2; case V2: return V1; } return null; }

Target:
public ProtocolVersion getLowerSupported() { return lowerSupported; }
Source:
public int getMaxSnapshotID() { return (1 << SNAPSHOT_ID_BIT_WIDTH); }

Target:
public int getMaxSnapshotID() { return ((1 << SNAPSHOT_ID_BIT_WIDTH) - 1); }
Source:
static String findProjectBaseDir(Map<String, Object> properties) { Path rootBaseDir = Paths.get(properties.get("sonar.projectBaseDir").toString()).toAbsolutePath().normalize(); List<Path> allProjectsBaseDir = properties.entrySet().stream() .filter(e -> e.getKey().endsWith(".projectBaseDir")) .map(e -> Paths.get(e.getValue().toString())) .collect(Collectors.toList()); for (Path baseDir : allProjectsBaseDir) { if (!baseDir.toAbsolutePath().normalize().startsWith(rootBaseDir)) { int c1 = baseDir.getNameCount(); int c2 = rootBaseDir.getNameCount(); Path newBaseDir = rootBaseDir.getRoot(); for (int i = 0; i < c1 && i < c2 && baseDir.getName(i).equals(rootBaseDir.getName(i)); i++) { newBaseDir = newBaseDir.resolve(rootBaseDir.getName(i)); } rootBaseDir = newBaseDir; } } return rootBaseDir.toString(); }

Target:
static String findProjectBaseDir(Map<String, Object> properties) { Path rootBaseDir = Paths.get(properties.get("sonar.projectBaseDir").toString()).toAbsolutePath().normalize(); List<Path> allProjectsBaseDir = properties.entrySet().stream() .filter(e -> e.getKey().endsWith(".projectBaseDir")) .map(e -> Paths.get(e.getValue().toString())) .collect(Collectors.toList()); for (Path baseDir : allProjectsBaseDir) { Path normalizedBaseDir = baseDir.toAbsolutePath().normalize(); if (!normalizedBaseDir.getRoot().equals(rootBaseDir.getRoot())) { continue; } if (!normalizedBaseDir.startsWith(rootBaseDir)) { int c1 = normalizedBaseDir.getNameCount(); int c2 = rootBaseDir.getNameCount(); Path newBaseDir = rootBaseDir.getRoot(); for (int i = 0; i < c1 && i < c2 && normalizedBaseDir.getName(i).equals(rootBaseDir.getName(i)); i++) { newBaseDir = newBaseDir.resolve(rootBaseDir.getName(i)); } rootBaseDir = newBaseDir; } } return rootBaseDir.toString(); }
Source:
public IContentProvider getContentProvider() { if (useDynamic) return dynamicProvider; return super.getContentProvider(); }

Target:
public IContentProvider getContentProvider() { if (useDynamic) { return dynamicProvider; } return super.getContentProvider(); }
Source:
private <T> T executeRawQuery( SQLiteDatabase database, String query, ExecuteResultHandler<T> handler) { Cursor cursor = database.rawQuery(query, null); try { return handler.handleResult(cursor); } finally { cursor.close(); } }

Target:
private <T> T executeRawQuery( SQLiteDatabase database, String query, ExecuteResultHandler<T> handler) { database.execSQL(query); return handler.handleRawQuery(); }
Source:
public void registerHandlers() { SessionFactory session = gov.hhs.fha.nhinc.event.persistence.HibernateUtil.getSessionFactory(); session = gov.hhs.fha.nhinc.direct.messagemonitoring.persistence.HibernateUtil.getSessionFactory(); LOG.debug("Registering event Loggers"); EventLoggerFactory.getInstance().registerLoggers(); LOG.debug("Registering handlers..."); getDirectReceiver(); }

Target:
public void registerHandlers() { SessionFactory session = gov.hhs.fha.nhinc.event.persistence.HibernateUtil.getSessionFactory(); session = gov.hhs.fha.nhinc.direct.messagemonitoring.persistence.HibernateUtil.getSessionFactory(); LOG.trace("Registering event Loggers"); EventLoggerFactory.getInstance().registerLoggers(); LOG.trace("Registering handlers..."); getDirectReceiver(); }
Source:
public void testSerialTypes() { List<Row> results = Lists.newArrayList( tEnv.sqlQuery(String.format("select * from %s", TABLE_SERIAL_TYPE)).execute().collect()); assertEquals("[" + "2767," + "2147483647," + "32767," + "2147483647," + "9223372036854775807," + "9223372036854775807]", results.toString()); }

Target:
public void testSerialTypes() { List<Row> results = Lists.newArrayList( tEnv.sqlQuery(String.format("select * from %s", TABLE_SERIAL_TYPE)).execute().collect()); assertEquals("[" + "32767," + "2147483647," + "32767," + "2147483647," + "9223372036854775807," + "9223372036854775807]", results.toString()); }
Source:
public void testBatchMessageThreadPoolSize() throws InterruptedException { for (MockParticipantManager participant : _participants) { int customizedPoolSize = 10; participant.getStateMachineEngine().registerStateModelFactory("OnlineOffline", new TestOnlineOfflineStateModelFactory(customizedPoolSize), "TestFactory"); } String dbName = "TestDBABatch"; IdealState idealState = new FullAutoModeISBuilder(dbName).setStateModel("OnlineOffline") .setStateModelFactoryName("TestFactory").setNumPartitions(100).setNumReplica(1).build(); idealState.setBatchMessageMode(true); _setupTool.getClusterManagementTool().addResource(CLUSTER_NAME, dbName, idealState); _setupTool.rebalanceStorageCluster(CLUSTER_NAME, dbName, 1); Thread.sleep(2000L); for (int i = 0; i < NODE_NR; i++) { DefaultMessagingService svc = (DefaultMessagingService) (_participants[i].getMessagingService()); HelixTaskExecutor helixExecutor = svc.getExecutor(); ThreadPoolExecutor executor = (ThreadPoolExecutor) (helixExecutor._batchMessageExecutorService); Assert.assertNotNull(executor); Assert.assertTrue(executor.getPoolSize() > 0); } }

Target:
public void testBatchMessageThreadPoolSize() throws InterruptedException { int customizedPoolSize = 5; _participants[0].getStateMachineEngine().registerStateModelFactory("OnlineOffline", new TestOnlineOfflineStateModelFactory(customizedPoolSize, 2000), "TestFactory"); for (int i = 1; i < _participants.length; i++) { _participants[i].syncStop(); } Thread.sleep(2000L); int numberOfDbs = 10; for (int i = 0; i < numberOfDbs; i++) { String dbName = "TestDBABatch" + i; IdealState idealState = new FullAutoModeISBuilder(dbName).setStateModel("OnlineOffline") .setStateModelFactoryName("TestFactory").setNumPartitions(10).setNumReplica(1).build(); idealState.setBatchMessageMode(true); _setupTool.getClusterManagementTool().addResource(CLUSTER_NAME, dbName, idealState); _setupTool.rebalanceStorageCluster(CLUSTER_NAME, dbName, 1); } Thread.sleep(2000L); DefaultMessagingService svc = (DefaultMessagingService) (_participants[0].getMessagingService()); HelixTaskExecutor helixExecutor = svc.getExecutor(); ThreadPoolExecutor executor = (ThreadPoolExecutor) (helixExecutor._batchMessageExecutorService); Assert.assertNotNull(executor); Assert.assertTrue(executor.getPoolSize() >= numberOfDbs); BestPossibleExternalViewVerifier verifier = new BestPossibleExternalViewVerifier.Builder(CLUSTER_NAME).setZkAddr(ZK_ADDR).build(); Assert.assertTrue(verifier.verify()); }
Source:
public void setForShareSupported(boolean forShareSupported) { this.forShareSupported = forShareSupported; }

Target:
protected void setForShareSupported(boolean forShareSupported) { this.forShareSupported = forShareSupported; }
Source:
public void prepare(WorkerTopologyContext context, GlobalStreamId stream, List<Integer> targetTasks) { random = new Random(); sourceNodeInfo = new NodeInfo(context.getThisWorkerHost(), Sets.newHashSet((long) context.getThisWorkerPort())); taskToNodePort = context.getTaskToNodePort(); this.targetTasks = targetTasks; CAPACITY = targetTasks.size() == 1 ? 1 : targetTasks.size() * MAX_WEIGHT; conf = context.getConf(); dnsToSwitchMapping = ReflectionUtils.newInstance((String) conf.get(Config.STORM_NETWORK_TOPOGRAPHY_PLUGIN)); localityGroup = new HashMap<>(); currentScope = Scope.WORKER_LOCAL; higherBound = ObjectReader.getDouble(conf.get(Config.TOPOLOGY_LOCALITYAWARE_HIGHER_BOUND_PERCENT)); lowerBound = ObjectReader.getDouble(conf.get(Config.TOPOLOGY_LOCALITYAWARE_LOWER_BOUND_PERCENT)); rets = (List<Integer>[]) new List<?>[targetTasks.size()]; int i = 0; for (int target : targetTasks) { rets[i] = Arrays.asList(target); orig.put(target, new IndexAndWeights(i)); i++; } choices = new int[CAPACITY]; current = new AtomicInteger(0); prepareChoices = new int[CAPACITY]; updateRing(null); }

Target:
public void prepare(WorkerTopologyContext context, GlobalStreamId stream, List<Integer> targetTasks) { random = new Random(); sourceNodeInfo = new NodeInfo(context.getThisWorkerHost(), Sets.newHashSet((long) context.getThisWorkerPort())); taskToNodePort = context.getTaskToNodePort(); this.targetTasks = targetTasks; capacity = targetTasks.size() == 1 ? 1 : Math.max(1000, targetTasks.size() * 5); conf = context.getConf(); dnsToSwitchMapping = ReflectionUtils.newInstance((String) conf.get(Config.STORM_NETWORK_TOPOGRAPHY_PLUGIN)); localityGroup = new HashMap<>(); currentScope = Scope.WORKER_LOCAL; higherBound = ObjectReader.getDouble(conf.get(Config.TOPOLOGY_LOCALITYAWARE_HIGHER_BOUND_PERCENT)); lowerBound = ObjectReader.getDouble(conf.get(Config.TOPOLOGY_LOCALITYAWARE_LOWER_BOUND_PERCENT)); rets = (List<Integer>[]) new List<?>[targetTasks.size()]; int i = 0; for (int target : targetTasks) { rets[i] = Arrays.asList(target); orig.put(target, new IndexAndWeights(i)); i++; } choices = new int[capacity]; current = new AtomicInteger(0); prepareChoices = new int[capacity]; updateRing(null); }
Source:
public void testDependency001() throws Exception { IncrementalTestHelper iteLib = new IncrementalTestHelper(AbstractTestTools.createTempDir()); iteLib.setIsApiTest(); File f = iteLib.addJavaFile("jack.incremental", "A.java", "package jack.incremental; \n" + "public abstract class A { \n" + "public abstract void m(); }"); iteLib.incrementalBuildFromFolder(); iteLib.snapshotJackFilesModificationDate(); Assert.assertEquals(1, iteLib.getJayceCount()); IncrementalTestHelper iteProg = new IncrementalTestHelper(AbstractTestTools.createTempDir()); iteProg.setIsApiTest(); iteProg.addJavaFile("jack.incremental", "B.java", "package jack.incremental; \n" + "public class B extends A { \n" + " @Override public void m(){} }"); iteProg.incrementalBuildFromFolder(new File[]{iteLib.getCompilerStateFolder()}); iteProg.snapshotJackFilesModificationDate(); Assert.assertEquals(1, iteProg.getJayceCount()); iteLib.deleteJavaFile(f); iteLib.addJavaFile("jack.incremental", "A.java", "package jack.incremental; \n" + "public abstract class A { \n" + "public abstract int m(); }"); iteLib.incrementalBuildFromFolder(); iteLib.snapshotJackFilesModificationDate(); Assert.assertEquals(1, iteLib.getJayceCount()); File testOut = AbstractTestTools.createTempFile("DependenciesTest015-", "-001"); iteProg.setReporterOutputFile(testOut); try { iteProg.incrementalBuildFromFolder(new File[] {iteLib.getCompilerStateFolder()}); Assert.fail(); } catch (FrontendCompilationException e) { Assert.assertTrue( AbstractTestTools.getFileContent(testOut) .contains("The return type is incompatible with A.m()")); } }

Target:
public void testDependency001() throws Exception { IncrementalTestHelper iteLib = new IncrementalTestHelper(AbstractTestTools.createTempDir()); iteLib.setIsApiTest(); File f = iteLib.addJavaFile("jack.incremental", "A.java", "package jack.incremental; \n" + "public abstract class A { \n" + "public abstract void m(); }"); iteLib.incrementalBuildFromFolder(); iteLib.snapshotJackFilesModificationDate(); Assert.assertEquals(1, iteLib.getJayceCount()); IncrementalTestHelper iteProg = new IncrementalTestHelper(AbstractTestTools.createTempDir()); iteProg.setIsApiTest(); iteProg.addJavaFile("jack.incremental", "B.java", "package jack.incremental; \n" + "public class B extends A { \n" + " @Override public void m(){} }"); iteProg.incrementalBuildFromFolder(new File[]{iteLib.getCompilerStateFolder()}); iteProg.snapshotJackFilesModificationDate(); Assert.assertEquals(1, iteProg.getJayceCount()); iteLib.deleteJavaFile(f); iteLib.addJavaFile("jack.incremental", "A.java", "package jack.incremental; \n" + "public abstract class A { \n" + "public abstract int m(); }"); iteLib.incrementalBuildFromFolder(); iteLib.snapshotJackFilesModificationDate(); Assert.assertEquals(1, iteLib.getJayceCount()); ByteArrayOutputStream errOut = new ByteArrayOutputStream(); iteProg.setReporterOutputStream(errOut); try { iteProg.incrementalBuildFromFolder(new File[] {iteLib.getCompilerStateFolder()}); Assert.fail(); } catch (FrontendCompilationException e) { Assert.assertTrue(errOut.toString().contains("The return type is incompatible with A.m()")); } }
Source:
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { final String name = StringUtils.substringAfter(mixinClassName, MIXIN_PREFIX).toLowerCase(); Map<String, Boolean> patches = SpongeImpl.getGlobalConfig().getConfig().getCommands().getMultiWorldCommandPatches(); if (!patches.containsKey(name)) { patches.put(name, false); SpongeImpl.getGlobalConfig().save(); return !this.configState; } return patches.get(name) == this.configState; }

Target:
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { String name = StringUtils.substringAfter(mixinClassName, MIXIN_PREFIX).toLowerCase(Locale.ENGLISH); if (name.equals("showseed")) { name = "seed"; } Map<String, Boolean> patches = SpongeImpl.getGlobalConfig().getConfig().getCommands().getMultiWorldCommandPatches(); if (!patches.containsKey(name)) { patches.put(name, true); SpongeImpl.getGlobalConfig().save(); return this.configState; } return patches.get(name) == this.configState; }
Source:
static MessageProcessor<Integer> defaultQosProcessor() { return message -> { Object header = message.getHeaders().get(MqttHeaders.QOS); Assert.state(header == null || header instanceof Integer, MqttHeaders.QOS + " header must be Integer"); return (Integer) header; }; }

Target:
static MessageProcessor<Integer> defaultQosProcessor() { return message -> message.getHeaders().get(MqttHeaders.QOS, Integer.class); }
Source:
public static void updateCatalogToZK(ZooKeeper zk, int version, long genId, SegmentedCatalog catalogAndDeployment, ZKCatalogStatus catalogStatus, long txnId) throws KeeperException, InterruptedException { assert (catalogAndDeployment != null); makeCatalogHeader(catalogAndDeployment, version, genId); String path = VoltZK.catalogbytes + "/" + version; ByteBuffer buffer = ByteBuffer.allocate(13); buffer.put((byte)ZKCatalogStatus.PENDING.ordinal()); buffer.putInt(catalogAndDeployment.m_data.size()); buffer.putLong(txnId); Stat stat = null; try { zk.create(path, buffer.array(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); } catch (KeeperException.NodeExistsException e) { stat = zk.exists(path, false); stat = zk.setData(path, buffer.array(), stat.getVersion()); List<String> children = zk.getChildren(path, false); for (String child : children) { ZKUtil.deleteRecursively(zk, ZKUtil.joinZKPath(path, child)); } } for (ByteBuffer chunk : catalogAndDeployment.m_data) { zk.create(ZKUtil.joinZKPath(path, "part_"), chunk.array(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT_SEQUENTIAL); } if (catalogStatus == ZKCatalogStatus.COMPLETE) { buffer.position(0); buffer.put((byte)catalogStatus.ordinal()); zk.setData(path, buffer.array(), stat == null ? -1 : stat.getVersion()); List<String> children = zk.getChildren(VoltZK.catalogbytes, false); for (String child : children) { int priorVersion = Integer.parseInt(child); if (priorVersion < version) { hostLog.info("***deleting " + ZKUtil.joinZKPath(VoltZK.catalogbytes, child)); ZKUtil.deleteRecursively(zk, ZKUtil.joinZKPath(VoltZK.catalogbytes, child)); } } } }

Target:
public static void updateCatalogToZK(ZooKeeper zk, int version, long genId, SegmentedCatalog catalogAndDeployment, ZKCatalogStatus catalogStatus, long txnId) throws KeeperException, InterruptedException { assert (catalogAndDeployment != null); makeCatalogHeader(catalogAndDeployment, version, genId); String path = VoltZK.catalogbytes + "/" + version; ByteBuffer buffer = ByteBuffer.allocate(13); buffer.put((byte)ZKCatalogStatus.PENDING.ordinal()); buffer.putInt(catalogAndDeployment.m_data.size()); buffer.putLong(txnId); Stat stat = null; try { zk.create(path, buffer.array(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); } catch (KeeperException.NodeExistsException e) { stat = zk.exists(path, false); stat = zk.setData(path, buffer.array(), stat.getVersion()); List<String> children = zk.getChildren(path, false); for (String child : children) { ZKUtil.deleteRecursively(zk, ZKUtil.joinZKPath(path, child)); } } for (ByteBuffer chunk : catalogAndDeployment.m_data) { zk.create(ZKUtil.joinZKPath(path, "part_"), chunk.array(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT_SEQUENTIAL); } if (catalogStatus == ZKCatalogStatus.COMPLETE) { buffer.position(0); buffer.put((byte)catalogStatus.ordinal()); zk.setData(path, buffer.array(), stat == null ? -1 : stat.getVersion()); List<String> children = zk.getChildren(VoltZK.catalogbytes, false); for (String child : children) { int priorVersion = Integer.parseInt(child); if (priorVersion < version) { ZKUtil.deleteRecursively(zk, ZKUtil.joinZKPath(VoltZK.catalogbytes, child)); } } } }
Source:
public void createNewGroup(Group group) { List<Id> memberIDs = new ArrayList<>(); List<User> members = group.getUsers(); for (User u : members){ memberIDs.add(u.getId()); } Request groupAddRequest = RequestBuilder .GroupCreateRequest(group.getUsers().get(0).getId(), group.getName(), memberIDs); Log.d("REQUEST", "Add new group"); mService.sendRequest(groupAddRequest); }

Target:
public void createNewGroup(Group group) { Objects.requireNonNull(group); List<Id> memberIDs = new ArrayList<>(); List<User> members = group.getUsers(); for (User u : members){ memberIDs.add(u.getId()); } Request groupAddRequest = RequestBuilder .GroupCreateRequest(group.getUsers().get(0).getId(), group.getName(), memberIDs); Log.d("REQUEST", "Add new group"); mService.sendRequest(groupAddRequest); }
Source:
private void resetSearchView() { ((ActionBarActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(false); mSearchView.onActionViewCollapsed(); mSearchView.setQuery("", false); mCurFilter = null; mListView.setSelection(0); if (mListener != null) mListener.showSlidingTabLayout(); }

Target:
private void resetSearchView() { ((ActionBarActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(false); mSearchView.onActionViewCollapsed(); mSearchView.setQuery("", false); mCurFilter = null; mListView.setSelection(0); if (mListener != null) { mListener.showSlidingTabLayout(); } }
Source:
protected TaxonConcept findPrincipal(Taxonomy taxonomy) { List<TaxonConcept> concepts = this.getConcepts(); if (concepts.isEmpty()) return null; if (concepts.size() == 1) return concepts.get(0); concepts.sort((tc1, tc2) -> tc2.getProviderScore() - tc1.getProviderScore()); final int cutoff = taxonomy.getAcceptedCutoff(); List<TaxonConcept> accepted = concepts.stream().filter(tc -> tc.isFormal() && tc.hasAccepted() && tc.getPrincipalScore() > cutoff).collect(Collectors.toList()); if (accepted.size() == 0) return concepts.get(0); if (accepted.size() == 1) return accepted.get(0); List<TaxonConcept> authored = accepted.stream().filter(tc -> tc.isAuthored()).collect(Collectors.toList()); if (authored.size() == 0) return accepted.get(0); if (authored.size() == 1) return authored.get(0); taxonomy.report(IssueType.COLLISION, "scientificName.collision", this, authored.get(0), authored.get(1)); final int score = authored.stream().mapToInt(TaxonConcept::getPrincipalScore).max().orElse(Integer.MIN_VALUE); List<TaxonConcept> candidates = authored.stream().filter(tc -> tc.getPrincipalScore() == score).collect(Collectors.toList()); if (candidates.size() > 1) taxonomy.report(IssueType.PROBLEM, "scientificName.collision.match", this, candidates.get(0), candidates.get(1)); return candidates.get(0); }

Target:
protected TaxonConcept findPrincipal(Taxonomy taxonomy) { List<TaxonConcept> concepts = this.getConcepts(); if (concepts.isEmpty()) return null; if (concepts.size() == 1) return concepts.get(0); concepts.sort(REVERSE_PROVIDER_SCORE_COMPARATOR); final int cutoff = taxonomy.getAcceptedCutoff(); List<TaxonConcept> accepted = concepts.stream().filter(tc -> tc.isFormal() && tc.hasAccepted() && tc.getPrincipalScore() > cutoff).collect(Collectors.toList()); if (accepted.size() == 0) return concepts.get(0); if (accepted.size() == 1) return accepted.get(0); List<TaxonConcept> authored = accepted.stream().filter(tc -> tc.isAuthored()).collect(Collectors.toList()); if (authored.size() == 0) return accepted.get(0); if (authored.size() == 1) return authored.get(0); taxonomy.report(IssueType.COLLISION, "scientificName.collision", this, authored.get(0), authored.get(1)); final int score = authored.stream().mapToInt(TaxonConcept::getPrincipalScore).max().orElse(TaxonomicElement.MIN_SCORE); List<TaxonConcept> candidates = authored.stream().filter(tc -> tc.getPrincipalScore() == score).collect(Collectors.toList()); if (candidates.size() > 1) taxonomy.report(IssueType.PROBLEM, "scientificName.collision.match", this, candidates.get(0), candidates.get(1)); return candidates.get(0); }
Source:
public void delete(SQLiteDatabase db, InstanceAdapter entityAdapter, boolean isSyncAdapter) { TaskAdapter taskAdapter = entityAdapter.taskAdapter(); if (taskAdapter.valueOf(TaskAdapter.ORIGINAL_INSTANCE_ID) != null) { long masterTaskId = taskAdapter.valueOf(TaskAdapter.ORIGINAL_INSTANCE_ID); DateTime originalTime = entityAdapter.valueOf(InstanceAdapter.INSTANCE_ORIGINAL_TIME); mDelegate.delete(db, taskAdapter, false); Cursor c = db.query(TaskDatabaseHelper.Tables.TASKS, null , TaskContract.Tasks._ID + "=" + masterTaskId, null, null, null, null); try { if (c.moveToFirst()) { TaskAdapter masterTaskAdapter = new CursorContentValuesTaskAdapter(masterTaskId, c, new ContentValues()); addExDate(masterTaskAdapter, originalTime); mDelegate.update(db, masterTaskAdapter, false); } } finally { c.close(); } } else if (taskAdapter.isRecurring()) { addExDate(taskAdapter, entityAdapter.valueOf(InstanceAdapter.INSTANCE_ORIGINAL_TIME)); mDelegate.update(db, taskAdapter, false); } else { mDelegate.delete(db, taskAdapter, false); } }

Target:
public void delete(SQLiteDatabase db, InstanceAdapter entityAdapter, boolean isSyncAdapter) { TaskAdapter taskAdapter = entityAdapter.taskAdapter(); if (taskAdapter.valueOf(TaskAdapter.ORIGINAL_INSTANCE_ID) != null) { long masterTaskId = taskAdapter.valueOf(TaskAdapter.ORIGINAL_INSTANCE_ID); DateTime originalTime = entityAdapter.valueOf(InstanceAdapter.INSTANCE_ORIGINAL_TIME); mDelegate.delete(db, taskAdapter, false); try (Cursor c = db.query(TaskDatabaseHelper.Tables.TASKS, null , TaskContract.Tasks._ID + "=" + masterTaskId, null, null, null, null)) { if (c.moveToFirst()) { TaskAdapter masterTaskAdapter = new CursorContentValuesTaskAdapter(masterTaskId, c, new ContentValues()); addExDate(masterTaskAdapter, originalTime); mDelegate.update(db, masterTaskAdapter, false); } } } else if (taskAdapter.isRecurring()) { addExDate(taskAdapter, entityAdapter.valueOf(InstanceAdapter.INSTANCE_ORIGINAL_TIME)); mDelegate.update(db, taskAdapter, false); } else { mDelegate.delete(db, taskAdapter, false); } }
Source:
private static DetailNode getFirstChildOfType(DetailNode node, int tokenType, int offset) { return Arrays.stream(node.getChildren()) .filter(child -> child.getIndex() >= offset && child.getType() == tokenType) .findFirst() .orElse(null); }

Target:
private static Optional<DetailNode> getFirstChildOfType(DetailNode node, int tokenType, int offset) { return Arrays.stream(node.getChildren()) .filter(child -> child.getIndex() >= offset && child.getType() == tokenType) .findFirst(); }
Source:
public void testStartProcessThrowException() throws Exception { Assertions.assertThatThrownBy(() -> { RuleFlowProcess process = new RuleFlowProcess(); process.setId(PROCESS_ID); process.setName("test"); process.setPackageName("org.mycomp.myprocess"); KieSession workingMemory = createKieSession(process); workingMemory.startProcess(PROCESS_ID); }); }

Target:
public void testStartProcessThrowException() throws Exception { RuleFlowProcess process = new RuleFlowProcess(); process.setId(PROCESS_ID); process.setName("test"); process.setPackageName("org.mycomp.myprocess"); KieSession workingMemory = createKieSession(process); assertThatThrownBy(() -> workingMemory.startProcess(PROCESS_ID)) .isInstanceOf(IllegalArgumentException.class); }
Source:
public Metrics metrics(Vertx vertx, VertxOptions options) { MetricsImpl metrics = new MetricsImpl(vertx, options); if (options.isJmxEnabled()) { String jmxDomain = options.getJmxDomain(); if (jmxDomain == null) { jmxDomain = "vertx" + "@" + Integer.toHexString(vertx.hashCode()); } JmxReporter.forRegistry(metrics.registry()).inDomain(jmxDomain).build().start(); } return metrics; }

Target:
public Metrics metrics(Vertx vertx, VertxOptions options) { MetricsImpl metrics = new MetricsImpl(vertx, options); if (options.isJmxEnabled()) { String jmxDomain = options.getJmxDomain(); if (jmxDomain == null) { jmxDomain = "vertx" + "@" + Integer.toHexString(vertx.hashCode()); } JmxReporter reporter = JmxReporter.forRegistry(metrics.registry()).inDomain(jmxDomain).build(); metrics.setDoneHandler(v -> reporter.stop()); reporter.start(); } return metrics; }
Source:
protected final Collection<T> sortItems(Collection<T> items) { if (items == null || comparator == null) { return items; } List<T> sortedList = new ArrayList<T>() { private static final long serialVersionUID = 499355412389856325L; @Override public boolean add(T e) { boolean ret = super.add(e); Collections.sort(this, comparator); return ret; } @Override public boolean addAll(Collection<? extends T> c) { boolean ret = super.addAll(c); Collections.sort(this, comparator); return ret; } }; sortedList.addAll(items); return sortedList; }

Target:
protected final Collection<T> sortItems(Collection<T> items) { if (items == null || comparator == null) { return items; } List<T> sortedList = new ArrayList<T>(items); Collections.sort(sortedList, comparator); return sortedList; }
Source:
public Collection<Staff> selectAll() { String query = "select a from staff a where a.admin = true"; return (List<Staff>)hibernateTemplate.find(query); }

Target:
public Collection<Staff> selectAll() { String query = "select a from staff a " + "left join fetch a.homeAddress " + "left join fetch a.contactMethods " + "where a.isAdmin = true"; return (List<Staff>)hibernateTemplate.find(query); }
Source:
public InputStream getBody() throws IOException { return new FileInputStream(this.cachedFile); }

Target:
public InputStream getBody() throws IOException { if (this.body == null) { this.body = new FileInputStream(this.cachedFile); } return this.body; }
Source:
public static Map<String, GraphQLDirective> nonRepeatableDirectivesByName(List<GraphQLDirective> directives) { Map<String, List<GraphQLDirective>> map = allDirectivesByName(directives); List<GraphQLDirective> singletonDirectives = map.entrySet().stream() .filter(e -> e.getKey() != null && isAllNonRepeatable(e.getValue())) .flatMap(e -> e.getValue().stream()).collect(Collectors.toList()); return FpKit.getByName(singletonDirectives, GraphQLDirective::getName); }

Target:
public static Map<String, GraphQLDirective> nonRepeatableDirectivesByName(List<GraphQLDirective> directives) { List<GraphQLDirective> singletonDirectives = directives.stream() .filter(d -> !d.isRepeatable()).collect(Collectors.toList()); return FpKit.getByName(singletonDirectives, GraphQLDirective::getName); }
Source:
public Person updateFHIRPerson(Person thePerson,String theId){ org.openmrs.api.PersonService personService = Context.getPersonService(); org.openmrs.Person retrievedPerson=personService.getPersonByUuid(theId); if(retrievedPerson!=null){ org.openmrs.Person omrsPerson = FHIRPersonUtil.generateOpenMRSPerson(thePerson); Set<PersonName> all=retrievedPerson.getNames(); boolean needToSetPrefferedName=false; for(PersonName name: omrsPerson.getNames()){ if(name.getPreferred()){ needToSetPrefferedName=true; } } if(needToSetPrefferedName){ for(PersonName name: all){ name.setPreferred(false); } } for(PersonName name: omrsPerson.getNames()){ all.add(name); } retrievedPerson.setNames(all); Set<PersonAddress> allAddress=retrievedPerson.getAddresses(); boolean needToSetHome=false; for(PersonAddress address: omrsPerson.getAddresses()){ if(address.isPreferred()){ needToSetHome=true; } } if(needToSetHome){ for(PersonAddress address: allAddress){ address.setPreferred(false); } } for(PersonAddress address1: omrsPerson.getAddresses()){ allAddress.add(address1); } retrievedPerson.setAddresses(allAddress); retrievedPerson.setPersonVoided(omrsPerson.getVoided()); if(omrsPerson.getVoided()){ retrievedPerson.setPersonVoidReason("Deleted from FHIR module"); } retrievedPerson.setBirthdate(omrsPerson.getBirthdate()); retrievedPerson.setGender(omrsPerson.getGender()); Context.getPersonService().savePerson(retrievedPerson); return FHIRPersonUtil.generatePerson(omrsPerson); }else{ return createFHIRPerson(thePerson); } }

Target:
public Person updateFHIRPerson(Person thePerson, String theId) { org.openmrs.api.PersonService personService = Context.getPersonService(); org.openmrs.Person retrievedPerson = personService.getPersonByUuid(theId); if (retrievedPerson != null) { org.openmrs.Person omrsPerson = FHIRPersonUtil.generateOpenMRSPerson(thePerson); retrievedPerson = FHIRPersonUtil.updatePersonAttributes(omrsPerson, retrievedPerson); Context.getPersonService().savePerson(retrievedPerson); return FHIRPersonUtil.generatePerson(retrievedPerson); } else { if (thePerson.getId() == null) { IdDt uuid = new IdDt(); uuid.setValue(theId); thePerson.setId(uuid); } return createFHIRPerson(thePerson); } }
Source:
public void dispose() { for (Node node : nodeMap.values()) { graph.removeNode(node); } nodeMap.clear(); }

Target:
public void dispose() { for (Node node : nodeMap.values()) { graph.removeNode(node); node.dispose(); } nodeMap.clear(); }
Source:
public VdcActionParametersBase getParameters(Template incoming, VmTemplate entity) { VmTemplate updated = getMapper(modelType, VmTemplate.class).map(incoming, entity); Version compatibilityVersion = Version.getLast(); if (!updated.isBlank()) { compatibilityVersion = lookupCluster(updated.getVdsGroupId()).getCompatibilityVersion(); } updated.setUsbPolicy(VmMapper.getUsbPolicyOnUpdate(incoming.getUsb(), entity.getUsbPolicy(), compatibilityVersion)); UpdateVmTemplateParameters params = new UpdateVmTemplateParameters(updated); if (incoming.isSetRngDevice()) { params.setUpdateRngDevice(true); params.setRngDevice(RngDeviceMapper.map(incoming.getRngDevice(), null)); } if(incoming.isSetSoundcardEnabled()) { params.setSoundDeviceEnabled(incoming.isSoundcardEnabled()); } IconHelper.setIconToParams(incoming, params); DisplayHelper.setGraphicsToParams(incoming.getDisplay(), params); return getMapper(modelType, UpdateVmTemplateParameters.class).map(incoming, params); }

Target:
public VdcActionParametersBase getParameters(Template incoming, VmTemplate entity) { VmTemplate updated = getMapper(modelType, VmTemplate.class).map(incoming, entity); updated.setUsbPolicy(VmMapper.getUsbPolicyOnUpdate(incoming.getUsb(), entity.getUsbPolicy())); UpdateVmTemplateParameters params = new UpdateVmTemplateParameters(updated); if (incoming.isSetRngDevice()) { params.setUpdateRngDevice(true); params.setRngDevice(RngDeviceMapper.map(incoming.getRngDevice(), null)); } if(incoming.isSetSoundcardEnabled()) { params.setSoundDeviceEnabled(incoming.isSoundcardEnabled()); } IconHelper.setIconToParams(incoming, params); DisplayHelper.setGraphicsToParams(incoming.getDisplay(), params); return getMapper(modelType, UpdateVmTemplateParameters.class).map(incoming, params); }
Source:
private void checkDefinition(Definition parsedDef) { CheckRHSVariables checkRHSVariables = new CheckRHSVariables(errors); stream(parsedDef.modules()).forEach(m -> stream(m.localSentences()).forEach(checkRHSVariables::check)); if (!errors.isEmpty()) { kem.addAllKException(errors.stream().map(e -> e.exception).collect(Collectors.toList())); kem.print(); throw KEMException.compilerError("Had " + errors.size() + " structural errors."); } }

Target:
private void checkDefinition(Definition parsedDef) { CheckRHSVariables checkRHSVariables = new CheckRHSVariables(errors); stream(parsedDef.modules()).forEach(m -> stream(m.localSentences()).forEach(checkRHSVariables::check)); if (!errors.isEmpty()) { kem.addAllKException(errors.stream().map(e -> e.exception).collect(Collectors.toList())); throw KEMException.compilerError("Had " + errors.size() + " structural errors."); } }
Source:
private void queryVirtualFunctionMap(IdQueryParameters idQueryParameters) { Frontend.getInstance() .runQuery(QueryType.GetVfToPfMapByHostId, idQueryParameters, new AsyncQuery<QueryReturnValue>(returnValue -> { vfToPfMap = Optional.ofNullable((Map<Guid, Guid>) returnValue.getReturnValue()) .orElse(Collections.emptyMap()); queryIsHostLockedOnNetworkOperation(idQueryParameters); })); }

Target:
private void queryVirtualFunctionMap(IdQueryParameters idQueryParameters) { Frontend.getInstance() .runQuery(QueryType.GetVfToPfMapByHostId, idQueryParameters, new AsyncQuery<QueryReturnValue>(returnValue -> { vfToPfMap = Optional.ofNullable((Map<Guid, Guid>) returnValue.getReturnValue()) .orElse(Collections.emptyMap()); queryHostInterfaces(idQueryParameters); })); }