auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void requestResults(String query, Searcher searcher) { StringNormalizer.Result queryNormalized = StringNormalizer.normalizeWithResult(query, false); queryNormalized = queryNormalized.replaceAll(Character.codePointAt("-", 0), Character.codePointAt(" ", 0)); FuzzyScore fuzzyScore = new FuzzyScore(queryNormalized.codePoints); FuzzyScore.MatchInfo matchInfo = new FuzzyScore.MatchInfo(); for (ContactsPojo pojo : pojos) { boolean match = fuzzyScore.match(pojo.normalizedName.codePoints, matchInfo); pojo.relevance = matchInfo.score; if (match) { List<Pair<Integer, Integer>> positions = matchInfo.getMatchedSequences(); try { pojo.setNameHighlight(positions); } catch (Exception e) { pojo.setNameHighlight(0, pojo.normalizedName.length()); } } if (!pojo.nickname.isEmpty()) { if (fuzzyScore.match(pojo.nickname, matchInfo)) { if (!match || (matchInfo.score > pojo.relevance)) { match = true; pojo.relevance = matchInfo.score; pojo.setNameHighlight(0, 0); } } } if (!match && queryNormalized.length() > 2) { if (fuzzyScore.match(pojo.phoneSimplified, matchInfo)) { match = true; pojo.relevance = matchInfo.score; pojo.setNameHighlight(0, 0); } } if (match) { pojo.relevance += Math.min(15, pojo.timesContacted); if(pojo.starred) { pojo.relevance += 15; } if (!searcher.addResult(pojo)) return; } } }

Target:
public void requestResults(String query, Searcher searcher) { StringNormalizer.Result queryNormalized = StringNormalizer.normalizeWithResult(query, false); queryNormalized = queryNormalized.replaceAll(Character.codePointAt("-", 0), Character.codePointAt(" ", 0)); FuzzyScore fuzzyScore = new FuzzyScore(queryNormalized.codePoints); FuzzyScore.MatchInfo matchInfo = new FuzzyScore.MatchInfo(); for (ContactsPojo pojo : pojos) { boolean match = fuzzyScore.match(pojo.normalizedName.codePoints, matchInfo); pojo.relevance = matchInfo.score; if (match) { List<Pair<Integer, Integer>> positions = matchInfo.getMatchedSequences(); try { pojo.setNameHighlight(positions); } catch (Exception e) { pojo.setNameHighlight(0, pojo.normalizedName.length()); } } if (!pojo.nickname.isEmpty()) { if (fuzzyScore.match(pojo.nickname, matchInfo)) { if (!match || (matchInfo.score > pojo.relevance)) { match = true; pojo.relevance = matchInfo.score; pojo.clearNameHighlight(); } } } if (!match && queryNormalized.length() > 2) { if (fuzzyScore.match(pojo.phoneSimplified, matchInfo)) { match = true; pojo.relevance = matchInfo.score; pojo.clearNameHighlight(); } } if (match) { pojo.relevance += Math.min(15, pojo.timesContacted); if(pojo.starred) { pojo.relevance += 15; } if (!searcher.addResult(pojo)) return; } } }
Source:
public void createContainerWithShmVolume() { try ( BrowserWebDriverContainer webDriverContainer = new BrowserWebDriverContainer() ) { webDriverContainer.start(); assertEquals("Shm mounts present", webDriverContainer.getContainerInfo().getMounts().size(), 1); final InspectContainerResponse.Mount shmMount = webDriverContainer.getContainerInfo().getMounts().get(0); assertEquals("Shm mount source is correct", "/dev/shm", shmMount.getSource()); assertEquals("Shm mount destination is correct", "/dev/shm", shmMount.getDestination().getPath()); assertEquals("Shm mount mode is correct", shmMount.getMode(), "rw"); } }

Target:
public void createContainerWithShmVolume() { try ( BrowserWebDriverContainer webDriverContainer = new BrowserWebDriverContainer() ) { webDriverContainer.start(); final List<InspectContainerResponse.Mount> mounts = webDriverContainer.getContainerInfo().getMounts(); assertEquals("Shm mounts present", mounts.size(), 1); final InspectContainerResponse.Mount shmMount = mounts.get(0); assertEquals("Shm mount source is correct", "/dev/shm", shmMount.getSource()); assertEquals("Shm mount destination is correct", "/dev/shm", shmMount.getDestination().getPath()); assertEquals("Shm mount mode is correct", shmMount.getMode(), "rw"); } }
Source:
private boolean checkForMeteredCondition() { boolean reconnectMeteredConnection = preferences.getBoolean( getString(R.string.preference_reconnect_metered), false); ConnectivityManager connManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE); return reconnectMeteredConnection || !(Build.VERSION.SDK_INT>16 && connManager.isActiveNetworkMetered()); }

Target:
private boolean checkForMeteredCondition() { boolean reconnectMeteredConnection = preferences.getBoolean( getString(R.string.preference_reconnect_metered), false); ConnectivityManager connManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE); return reconnectMeteredConnection || !(Build.VERSION.SDK_INT>Build.VERSION_CODES.JELLY_BEAN && connManager.isActiveNetworkMetered()); }
Source:
public TmfCoreTracer() { }

Target:
private TmfCoreTracer() { }
Source:
public static IType createType(ICPPASTInitCapture capture) { IASTInitializer initializer = capture.getDeclarator().getInitializer(); if (initializer instanceof ICPPASTInitializerList) { IType type = ((ICPPASTInitializerList) initializer).getEvaluation().getType(); if (type instanceof InitializerListType) { ICPPEvaluation[] clauses = ((InitializerListType) type).getEvaluation().getClauses(); if (clauses.length == 1) { return clauses[0].getType(); } } } else if (initializer instanceof ICPPASTConstructorInitializer) { IASTInitializerClause[] arguments = ((ICPPASTConstructorInitializer) initializer).getArguments(); if (arguments.length == 1) { return initalizerClauseType(arguments[0]); } } else if (initializer instanceof IASTEqualsInitializer) { return initalizerClauseType(((IASTEqualsInitializer) initializer).getInitializerClause()); } return ProblemType.CANNOT_DEDUCE_AUTO_TYPE; }

Target:
public static IType createType(ICPPASTInitCapture capture) { IASTDeclarator declarator = capture.getDeclarator(); ICPPASTInitializerClause initClause = getAutoInitClauseForDeclarator(declarator); if (initClause == null) { return ProblemType.CANNOT_DEDUCE_AUTO_TYPE; } return createAutoType(initClause.getEvaluation(), null, declarator); }
Source:
public static GridData setButtonLayoutData(Button button) { button.setFont(JFaceResources.getDialogFont()); GC gc = new GC(button); gc.setFont(button.getFont()); FontMetrics fontMetrics = gc.getFontMetrics(); gc.dispose(); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); int widthHint = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.BUTTON_WIDTH); Point minSize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); data.widthHint = Math.max(widthHint, minSize.x); button.setLayoutData(data); return data; }

Target:
public static void setButtonLayoutData(Button button) { GC gc = new GC(button); gc.setFont(JFaceResources.getDialogFont()); FontMetrics fontMetrics = gc.getFontMetrics(); gc.dispose(); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); int widthHint = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.BUTTON_WIDTH); Point minSize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); data.widthHint = Math.max(widthHint, minSize.x); button.setLayoutData(data); }
Source:
private void setSeverUnitTestMode(ServerContextInformation contextInformation) { if (Boolean.parseBoolean(System.getenv("UNIT_TEST"))) { setUnitTestEnabled(true); contextInformation.setServerUnitTestModeEnabled(true); log.info("Synapse unit testing enabled"); String requestPort = System.getenv("UNIT_TEST_PORT"); int unitTestingAgentPort = -1; try { if (requestPort != null && !requestPort.isEmpty()) { unitTestingAgentPort = Integer.parseInt(requestPort); } else { throw new IOException("Starting TCP port can not be empty or null"); } } catch (NumberFormatException e) { log.error("Given port is not in valid format", e); } catch (IOException e) { log.error("Given port can not be empty or null", e); } if (unitTestingAgentPort > 1023) { UnitTestingExecutor testExecutor = UnitTestingExecutor.getExecuteInstance(); testExecutor.setServerPort(unitTestingAgentPort); testExecutor.setSynapseConfiguration(this.synapseConfig); testExecutor.start(); } else { log.error("Input a TCP port higher than 1023 to start the unit testing framework"); } } }

Target:
private void setSeverUnitTestMode(ServerContextInformation contextInformation) { if (Boolean.parseBoolean(System.getProperty("synapseTest"))) { setUnitTestEnabled(true); contextInformation.setServerUnitTestModeEnabled(true); log.info("Synapse unit testing server enabled"); UnitTestingExecutor testExecutor = UnitTestingExecutor.getExecuteInstance(); testExecutor.setSynapseConfiguration(this.synapseConfig); testExecutor.start(); } }
Source:
public boolean reloadPageCompletion(PagePosition position) throws Exception { if (pageStore != null && !pageStore.checkPageFileExists((int)position.getPageNr())) { return false; } if (pageStore != null && pageStore.getCurrentPage() != null && pageStore.getCurrentPage().getPageId() == position.getPageNr()) { pageStore.forceAnotherPage(); } PageCursorInfo info = new PageCursorInfo(position.getPageNr(), position.getMessageNr(), null); info.setCompleteInfo(position); synchronized (consumedPages) { consumedPages.put(Long.valueOf(position.getPageNr()), info); } return true; }

Target:
public boolean reloadPageCompletion(PagePosition position) throws Exception { if (!pageStore.checkPageFileExists((int)position.getPageNr())) { return false; } if (pageStore.getCurrentPage() != null && pageStore.getCurrentPage().getPageId() == position.getPageNr()) { pageStore.forceAnotherPage(); } PageCursorInfo info = new PageCursorInfo(position.getPageNr(), position.getMessageNr(), null); info.setCompleteInfo(position); synchronized (consumedPages) { consumedPages.put(Long.valueOf(position.getPageNr()), info); } return true; }
Source:
public static synchronized void startUp() throws InterruptedException, IOException { RandomConfigurationSupport randomConfigSupport = new RandomConfigurationSupport(); String transport = System.getProperty("XD_TRANSPORT"); if (application == null) { application = new SingleNodeApplication().run("--transport", StringUtils.hasText(transport) ? transport : "local", "--analytics", "redis"); integrationTestSupport = new SingleNodeIntegrationTestSupport(application); integrationTestSupport.addModuleRegistry(new ArchiveModuleRegistry("classpath:/spring-xd/xd/modules")); Bootstrap bootstrap = new Bootstrap(new String[] { "--port", randomConfigSupport.getAdminServerPort() }); shell = bootstrap.getJLineShellComponent(); } if (!shell.isRunning()) { shell.start(); } }

Target:
public static synchronized void startUp() throws InterruptedException, IOException { RandomConfigurationSupport randomConfigSupport = new RandomConfigurationSupport(); if (application == null) { application = new SingleNodeApplication().run("--transport", "local", "--analytics", "redis"); integrationTestSupport = new SingleNodeIntegrationTestSupport(application); integrationTestSupport.addModuleRegistry(new ArchiveModuleRegistry("classpath:/spring-xd/xd/modules")); Bootstrap bootstrap = new Bootstrap(new String[] { "--port", randomConfigSupport.getAdminServerPort() }); shell = bootstrap.getJLineShellComponent(); } if (!shell.isRunning()) { shell.start(); } }
Source:
public void start(ComponentContext context) { if (Framework.isTestModeSet()) { return; } for (Directory dir : getDirectories()) { try { dir.getSession().close(); } catch (Exception e) { log.error(String.format("Could not open session for directory %s. Error message: %s", dir.getName(), e.getMessage())); } } if (TransactionHelper.isTransactionActiveOrMarkedRollback()) { TransactionHelper.commitOrRollbackTransaction(); TransactionHelper.startTransaction(); } }

Target:
public void start(ComponentContext context) { if (Framework.isTestModeSet()) { return; } for (Directory dir : getDirectories()) { try { dir.getSession().close(); } catch (Exception e) { log.error(e); } } if (TransactionHelper.isTransactionActiveOrMarkedRollback()) { TransactionHelper.commitOrRollbackTransaction(); TransactionHelper.startTransaction(); } }
Source:
public String build() { StringBuilder redirect = new StringBuilder("redirect:"); if (destination != null) { redirect.append(destination); } else { if (path != null) { redirect.append(path); } if (query != null) { redirect.append("?"); redirect.append(query); } if (!parameters.isEmpty()) { if (query == null) { redirect.append("?"); } else { redirect.append("&"); } boolean isFirst = true; for (Entry<String, Object> param : parameters.entrySet()) { if (!isFirst) { redirect.append("&"); } redirect.append(param.getKey()); if (param.getValue() != null) { redirect.append("="); try { String encodedValue = URLEncoder.encode(param.getValue().toString(), "UTF-8"); redirect.append(encodedValue); } catch (UnsupportedEncodingException e) { throw new IllegalStateException(e); } } isFirst = false; } } } return redirect.toString(); }

Target:
public String build() { UriBuilder uri = null; if (destination != null) { uri = UriBuilder.fromUri(destination); } else { uri = UriBuilder.fromPath(""); if (path != null) { uri.path(path); } if (query != null) { uri.replaceQuery(query); } if (!parameters.isEmpty()) { for (Entry<String, Object> param : parameters.entrySet()) { uri.queryParam(param.getKey(), param.getValue() != null ? param.getValue() : ""); } } } return "redirect:" + uri.toString(); }
Source:
public Networks list() { Networks networks; if (isFiltered()) { networks = mapCollection(getBackendCollection(VdcQueryType.GetAllNetworksByUserId, new GetAllNetworkQueryParamenters())); } else { networks = mapCollection(getBackendCollection(queryType, getQueryParameters())); } for (Network network : networks.getNetworks()) { network.setDisplay(null); } return networks; }

Target:
public Networks list() { Networks networks = mapCollection(getBackendCollection(queryType, getQueryParameters())); for (Network network : networks.getNetworks()) { network.setDisplay(null); } return networks; }
Source:
public String serverInfoToJSON(String serverId, String siteUrl, String secureSiteUrl) { Gson gson = new Gson(); JsonObject object = new JsonObject(); object.addProperty("server_id", serverId); object.addProperty("site_url", siteUrl); object.addProperty("secure_site_url", secureSiteUrl); object.addProperty("server_version", CurrentGoCDVersion.getInstance().fullVersion()); return gson.toJson(object); }

Target:
public String serverInfoToJSON(String serverId, String siteUrl, String secureSiteUrl) { Gson gson = new Gson(); JsonObject object = new JsonObject(); object.addProperty("server_id", serverId); object.addProperty("site_url", siteUrl); object.addProperty("secure_site_url", secureSiteUrl); return gson.toJson(object); }
Source:
public GitHubSCMSource(String repoOwnerInternal, String repositoryInternal, String rawUrl, String configurableByScan) { this.configurableByScan = configurableByScan; if(StringUtils.equals("raw", configurableByScan)) { this.rawUrl = rawUrl; this.repoOwner = ""; this.repository = ""; }else{ this.rawUrl = ""; this.repoOwner = repoOwnerInternal; this.repository = repositoryInternal; } pullRequestMetadataCache = new ConcurrentHashMap<>(); pullRequestContributorCache = new ConcurrentHashMap<>(); this.traits = new ArrayList<>(); }

Target:
public GitHubSCMSource(String repoOwnerInternal, String repositoryInternal, String rawUrl, String configurableByScan) { this.configurableByScan = configurableByScan; if(StringUtils.equals("raw", configurableByScan)) { this.rawUrl = rawUrl; this.repoOwner = null; this.repository = null; }else{ this.rawUrl = null; this.repoOwner = repoOwnerInternal; this.repository = repositoryInternal; } pullRequestMetadataCache = new ConcurrentHashMap<>(); pullRequestContributorCache = new ConcurrentHashMap<>(); this.traits = new ArrayList<>(); }
Source:
public boolean cancel(boolean mayInterruptIfRunning) { if (hasListeners.compareAndSet(false, true)) { refreshListeners.put(this, true); } return super.cancel(mayInterruptIfRunning); }

Target:
public boolean cancel(boolean mayInterruptIfRunning) { boolean result = super.cancel(mayInterruptIfRunning); if (result) { notDoneNrtFutures.remove(this); } return result; }
Source:
private void compareSnapshotFiles( Set<String> firstSnapshotFileNames, Set<String> secondSnapshotFileNames, FileSystemAbstraction fileSystem ) { Set<String> firstSnapshotIndexesSegments = firstSnapshotFileNames.stream() .filter( this::segmentsFilePredicate ) .collect( Collectors.toSet() ); Set<String> secondSnapshotIndexesSegments = secondSnapshotFileNames.stream() .filter( this::segmentsFilePredicate ) .collect( Collectors.toSet() ); assertThat( format( "Should have %d modified index segment files. Snapshot segment files are: %s", NUMBER_OF_INDEXES, firstSnapshotIndexesSegments ), firstSnapshotIndexesSegments, hasSize( NUMBER_OF_INDEXES ) ); for ( String fileName : firstSnapshotIndexesSegments ) { assertFalse( "Snapshot segments fileset should not have files from another snapshot set." + describeFileSets( firstSnapshotIndexesSegments, secondSnapshotIndexesSegments ), secondSnapshotIndexesSegments.contains( fileName ) ); String path = FilenameUtils.getFullPath( fileName ); assertTrue( "Snapshot should contain files for index in path: " + path + "." + describeFileSets( firstSnapshotIndexesSegments, secondSnapshotIndexesSegments ), secondSnapshotIndexesSegments.stream().anyMatch( name -> name.startsWith( path ) ) ); assertTrue( format( "Snapshot segment file '%s' should exist.", fileName ), fileSystem.fileExists( new File( fileName ) ) ); } }

Target:
private void compareSnapshotFiles( Set<String> firstSnapshotFileNames, Set<String> secondSnapshotFileNames, FileSystemAbstraction fileSystem ) { assertThat( format( "Should have %d modified index segment files. Snapshot segment files are: %s", NUMBER_OF_INDEXES, firstSnapshotFileNames ), firstSnapshotFileNames, hasSize( NUMBER_OF_INDEXES ) ); for ( String fileName : firstSnapshotFileNames ) { assertFalse( "Snapshot segments fileset should not have files from another snapshot set." + describeFileSets( firstSnapshotFileNames, secondSnapshotFileNames ), secondSnapshotFileNames.contains( fileName ) ); String path = FilenameUtils.getFullPath( fileName ); assertTrue( "Snapshot should contain files for index in path: " + path + "." + describeFileSets( firstSnapshotFileNames, secondSnapshotFileNames ), secondSnapshotFileNames.stream().anyMatch( name -> name.startsWith( path ) ) ); assertTrue( format( "Snapshot segment file '%s' should exist.", fileName ), fileSystem.fileExists( new File( fileName ) ) ); } }
Source:
private void decorateRepositoryGroup(RepositoryTreeNode<?> node, IDecoration decoration) { RepositoryCache cache = org.eclipse.egit.core.Activator.getDefault() .getRepositoryCache(); RepositoryGroup group = ((RepositoryGroupNode) node).getGroup(); boolean markGroupDirty = false; for (String repoDir : group.getRepositoryDirectories()) { Repository repo = cache.getRepository(new File(repoDir)); if (repo != null && RepositoryUtil.hasChanges(repo)) { markGroupDirty = true; break; } } if (markGroupDirty) { decoration.addPrefix(HAS_CHANGES_PREFIX); } else { ensureCorrectLabelCaching(decoration); } }

Target:
private void decorateRepositoryGroup(RepositoryTreeNode<?> node, IDecoration decoration) { RepositoryCache cache = org.eclipse.egit.core.Activator.getDefault() .getRepositoryCache(); RepositoryGroup group = ((RepositoryGroupNode) node).getGroup(); boolean markGroupDirty = false; for (File repoDir : group.getRepositoryDirectories()) { Repository repo = cache.getRepository(repoDir); if (repo != null && RepositoryUtil.hasChanges(repo)) { markGroupDirty = true; break; } } if (markGroupDirty) { decoration.addPrefix(HAS_CHANGES_PREFIX); } else { ensureCorrectLabelCaching(decoration); } }
Source:
public void testThatFilterDoesntRemoveStorageDomainFromList() { List<StorageDomain> filteredDomains = filterStorageDomain(false); assertEquals(filteredDomains, Arrays.asList(storageDomain)); }

Target:
public void testThatFilterDoesntRemoveStorageDomainFromList() { List<StorageDomain> filteredDomains = new ArrayList<>(filterStorageDomain(false)); assertEquals(filteredDomains, Arrays.asList(storageDomain)); }
Source:
public SelectQuery( @JsonProperty("dataSource") DataSource dataSource, @JsonProperty("intervals") QuerySegmentSpec querySegmentSpec, @JsonProperty("descending") boolean descending, @JsonProperty("filter") DimFilter dimFilter, @JsonProperty("granularity") Granularity granularity, @JsonProperty("dimensions") List<DimensionSpec> dimensions, @JsonProperty("metrics") List<String> metrics, @JsonProperty("virtualColumns") VirtualColumns virtualColumns, @JsonProperty("pagingSpec") PagingSpec pagingSpec, @JsonProperty("context") Map<String, Object> context ) { super(dataSource, querySegmentSpec, descending, context, granularity == null ? Granularities.ALL : granularity); this.dimFilter = dimFilter; this.dimensions = dimensions; this.virtualColumns = VirtualColumns.nullToEmpty(virtualColumns); this.metrics = metrics; this.pagingSpec = pagingSpec; Preconditions.checkNotNull(pagingSpec, "must specify a pagingSpec"); Preconditions.checkArgument(checkPagingSpec(pagingSpec, descending), "invalid pagingSpec"); }

Target:
public SelectQuery( @JsonProperty("dataSource") DataSource dataSource, @JsonProperty("intervals") QuerySegmentSpec querySegmentSpec, @JsonProperty("descending") boolean descending, @JsonProperty("filter") DimFilter dimFilter, @JsonProperty("granularity") Granularity granularity, @JsonProperty("dimensions") List<DimensionSpec> dimensions, @JsonProperty("metrics") List<String> metrics, @JsonProperty("virtualColumns") VirtualColumns virtualColumns, @JsonProperty("pagingSpec") PagingSpec pagingSpec, @JsonProperty("context") Map<String, Object> context ) { super(dataSource, querySegmentSpec, descending, context, Granularities.nullToAll(granularity)); this.dimFilter = dimFilter; this.dimensions = dimensions; this.virtualColumns = VirtualColumns.nullToEmpty(virtualColumns); this.metrics = metrics; this.pagingSpec = pagingSpec; Preconditions.checkNotNull(pagingSpec, "must specify a pagingSpec"); Preconditions.checkArgument(checkPagingSpec(pagingSpec, descending), "invalid pagingSpec"); }
Source:
private void ensureOrderTypeIsSet(Order order, OrderContext orderContext) { Order previousOrder = order.getPreviousOrder(); if (order.getOrderType() == null) { OrderType orderType = null; if (orderContext != null) { orderType = orderContext.getOrderType(); } if (orderType == null) { orderType = getOrderTypeByConcept(order.getConcept()); } if (orderType == null && order instanceof DrugOrder) { orderType = Context.getOrderService().getOrderTypeByUuid(OrderType.DRUG_ORDER_TYPE_UUID); } if (orderType == null && order instanceof TestOrder) { orderType = Context.getOrderService().getOrderTypeByUuid(OrderType.TEST_ORDER_TYPE_UUID); } if (orderType == null) { throw new OrderEntryException("Order.type.cannot.determine"); } if (previousOrder != null && !orderType.equals(previousOrder.getOrderType())) { throw new OrderEntryException("Order.type.does.not.match"); } order.setOrderType(orderType); } }

Target:
private void ensureOrderTypeIsSet(Order order, OrderContext orderContext) { if (order.getOrderType() != null) { return; } OrderType orderType = null; if (orderContext != null) { orderType = orderContext.getOrderType(); } if (orderType == null) { orderType = getOrderTypeByConcept(order.getConcept()); } if (orderType == null && order instanceof DrugOrder) { orderType = Context.getOrderService().getOrderTypeByUuid(OrderType.DRUG_ORDER_TYPE_UUID); } if (orderType == null && order instanceof TestOrder) { orderType = Context.getOrderService().getOrderTypeByUuid(OrderType.TEST_ORDER_TYPE_UUID); } if (orderType == null) { throw new OrderEntryException("Order.type.cannot.determine"); } Order previousOrder = order.getPreviousOrder(); if (previousOrder != null && !orderType.equals(previousOrder.getOrderType())) { throw new OrderEntryException("Order.type.does.not.match"); } order.setOrderType(orderType); }
Source:
public DescribeAlarmsResult describeAlarms(String awsRegion) { final DefaultAWSCredentialsProviderChain credentialsProviderChain = new DefaultAWSCredentialsProviderChain(); final AWSStaticCredentialsProvider credentialProvider = new AWSStaticCredentialsProvider(credentialsProviderChain.getCredentials()); return AmazonCloudWatchClientBuilder .standard() .withCredentials(credentialProvider) .withRegion(awsRegion) .build() .describeAlarms(); }

Target:
public DescribeAlarmsResult describeAlarms(String awsRegion) { return AmazonCloudWatchClientBuilder .standard() .withRegion(awsRegion) .build() .describeAlarms(); }
Source:
public static CallExpression call(FunctionManager functionManager, String name, Type returnType, List<RowExpression> arguments) { FunctionHandle functionHandle = functionManager.lookupFunction(name, fromTypes(arguments.stream().map(RowExpression::getType).collect(toImmutableList()))); return new CallExpression(name, functionHandle, returnType, arguments); }

Target:
public static CallExpression call(FunctionManager functionManager, String name, Type returnType, List<RowExpression> arguments) { FunctionHandle functionHandle = functionManager.lookupFunction(name, fromTypes(arguments.stream().map(RowExpression::getType).collect(toImmutableList()))); return call(name, functionHandle, returnType, arguments); }
Source:
} catch (UnsatisfiedLinkError e) { tempOpenCvLoaded = false; System.out.println("OpenCV native library failed to load " + e.toString()); }

Target:
} catch (UnsatisfiedLinkError e) { tempOpenCvLoaded = false; exception = e; }
Source:
public BertMaskedLMMasker(Random r, double maskProb, double maskTokenProb, double randomTokenProb){ Preconditions.checkArgument(maskProb > 0 && maskProb < 1, "Probability must be beteen 0 and 1, got %s", maskProb); this.r = r; this.maskProb = maskProb; this.maskTokenProb = maskTokenProb; this.randomTokenProb = randomTokenProb; }

Target:
public BertMaskedLMMasker(Random r, double maskProb, double maskTokenProb, double randomTokenProb){ Preconditions.checkArgument(maskProb > 0 && maskProb < 1, "Probability must be beteen 0 and 1, got %s", maskProb); Preconditions.checkState(maskTokenProb >=0 && maskTokenProb <= 1.0, "Mask token probability must be between 0 and 1, got %s", maskTokenProb); Preconditions.checkState(randomTokenProb >=0 && randomTokenProb <= 1.0, "Random token probability must be between 0 and 1, got %s", randomTokenProb); Preconditions.checkState(maskTokenProb + randomTokenProb <= 1.0, "Sum of maskTokenProb (%s) and randomTokenProb (%s) must be <= 1.0, got sum is %s", maskTokenProb, randomTokenProb, (maskTokenProb + randomTokenProb)); this.r = r; this.maskProb = maskProb; this.maskTokenProb = maskTokenProb; this.randomTokenProb = randomTokenProb; }
Source:
public void putEntry(ArchiveOutputStream out, String path, FileMode mode, ObjectLoader loader) throws IOException { if (FileMode.SYMLINK.equals(mode)) { final TarArchiveEntry entry = new TarArchiveEntry( path, TarConstants.LF_SYMLINK); entry.setLinkName(new String( loader.getCachedBytes(100), "UTF-8")); out.putArchiveEntry(entry); out.closeArchiveEntry(); return; } if (path.endsWith("/") != FileMode.TREE.equals(mode)) { throw new IllegalArgumentException( "TarFormat.putEntry: path " + path + " does not match mode " + mode); } final TarArchiveEntry entry = new TarArchiveEntry(path); if (FileMode.TREE.equals(mode)) { out.putArchiveEntry(entry); out.closeArchiveEntry(); return; } if (FileMode.REGULAR_FILE.equals(mode)) { } else if (FileMode.EXECUTABLE_FILE.equals(mode)) { entry.setMode(mode.getBits()); } else { throw new IllegalArgumentException( "TarFormat.putEntry: Unsupported mode " + mode); } entry.setSize(loader.getSize()); out.putArchiveEntry(entry); loader.copyTo(out); out.closeArchiveEntry(); }

Target:
public void putEntry(ArchiveOutputStream out, String path, FileMode mode, ObjectLoader loader) throws IOException { if (mode == FileMode.SYMLINK) { final TarArchiveEntry entry = new TarArchiveEntry( path, TarConstants.LF_SYMLINK); entry.setLinkName(new String( loader.getCachedBytes(100), "UTF-8")); out.putArchiveEntry(entry); out.closeArchiveEntry(); return; } if (path.endsWith("/") && mode != FileMode.TREE) throw new IllegalArgumentException(MessageFormat.format( ArchiveText.get().pathDoesNotMatchMode, path, mode)); if (!path.endsWith("/") && mode == FileMode.TREE) path = path + "/"; final TarArchiveEntry entry = new TarArchiveEntry(path); if (mode == FileMode.TREE) { out.putArchiveEntry(entry); out.closeArchiveEntry(); return; } if (mode == FileMode.REGULAR_FILE) { } else if (mode == FileMode.EXECUTABLE_FILE) { entry.setMode(mode.getBits()); } else { throw new IllegalArgumentException(MessageFormat.format( ArchiveText.get().unsupportedMode, mode)); } entry.setSize(loader.getSize()); out.putArchiveEntry(entry); loader.copyTo(out); out.closeArchiveEntry(); }
Source:
public void onTerminate() { disposable.dispose(); super.onTerminate(); }

Target:
public void onTerminate() { if (disposable != null) { disposable.dispose(); } super.onTerminate(); }
Source:
public static <T extends Annotation> T findAnnotation(Class<?> clazz, Class<T> annotationClass) { T ann = clazz.getAnnotation(annotationClass); if (ann == null && clazz != Object.class) { ann = clazz.getAnnotation(annotationClass); if (ann == null) { ann = clazz.getPackage().getAnnotation(annotationClass); } if (ann == null && clazz != Object.class) { ann = findAnnotation(clazz.getSuperclass(), annotationClass); } } return ann; }

Target:
public static <T extends Annotation> T findAnnotation(Class<?> clazz, Class<T> annotationClass) { T ann = clazz.getAnnotation(annotationClass); while (ann == null && clazz != null) { ann = clazz.getAnnotation(annotationClass); if (ann == null) { ann = clazz.getPackage().getAnnotation(annotationClass); } if (ann == null) { clazz = clazz.getSuperclass(); if (clazz != null) { ann = clazz.getAnnotation(annotationClass); } } } return ann; }
Source:
public void testStopStartConsensus() throws Exception { Atomix atomix1 = startAtomix(1, Arrays.asList(1), Profile.CONSENSUS).get(30, TimeUnit.SECONDS); atomix1.stop().get(30, TimeUnit.SECONDS); try { atomix1.start().get(30, TimeUnit.SECONDS); fail("Expected CompletionException"); } catch (ExecutionException ex) { assertTrue(ex.getCause() instanceof IllegalStateException); assertEquals("Atomix instance shutdown", ex.getCause().getMessage()); } }

Target:
public void testStopStartConsensus() throws Exception { Atomix atomix1 = startAtomix(1, Arrays.asList(1), Profile.CONSENSUS).get(30, TimeUnit.SECONDS); atomix1.stop().get(30, TimeUnit.SECONDS); try { atomix1.start().get(30, TimeUnit.SECONDS); fail("Expected ExecutionException"); } catch (ExecutionException ex) { assertTrue(ex.getCause() instanceof IllegalStateException); assertEquals("Atomix instance shutdown", ex.getCause().getMessage()); } }
Source:
public static NewParam createOrganizationParameter(NewAction action) { return action.createParam(PARAM_ORGANIZATION) .setDescription("Key of organization, used when group name is set") .setExampleValue("my-org") .setSince("6.2") .setInternal(true); }

Target:
public static NewParam createOrganizationParameter(NewAction action) { return action.createParam(PARAM_ORGANIZATION) .setDescription("Key of organization, used when group name is set") .setExampleValue("my-org") .setInternal(true); }
Source:
public String generateUnifiedResourceName(String namespace, String libraryIdentifier, String subNamespace, String identifier) { String urn = namespace + ':' + libraryIdentifier + '-' + subNamespace + "-id" + identifier; return SCHEME + ':' + urn + getCheckDigit(urn); }

Target:
public String generateUnifiedResourceName(String namespace, String libraryIdentifier, String subNamespace, String identifier) { String urn = namespace + ':' + libraryIdentifier + '-' + subNamespace + "-" + identifier; return SCHEME + ':' + urn + getCheckDigit(urn); }
Source:
public void initializeUI(UIBuilder builder) throws Exception { Project project = Projects.getSelectedProject(projectFactory, builder.getUIContext()); if (project != null) { MetadataFacet facet = project.getFacet(MetadataFacet.class); Coordinate c = facet.getOutputDependency().getCoordinate(); named.setDefaultValue(AddonId.from(c.getGroupId() + ":" + c.getArtifactId(), c.getVersion()) .toCoordinates()); } named.setCompleter(new UICompleter<String>() { @Override public Iterable<String> getCompletionProposals(UIContext context, InputComponent<?, String> input, String value) { Set<String> items = new TreeSet<String>(); Set<Addon> addons = furnace.getAddonRegistry().getAddons(); for (Addon addon : addons) { items.add(addon.getId().getName()); } return items; } }); named.addValidator(new UIValidator() { @Override public void validate(UIValidationContext context) { String coordinate = (String) context.getCurrentInputComponent().getValue(); try { AddonId addonId = CoordinateUtils.resolveCoordinate(coordinate, Versions.getSpecificationVersionFor(this.getClass()), resolver); Set<Addon> addons = furnace.getAddonRegistry().getAddons(); boolean match = false; for (Addon addon : addons) { if (addon.getId().getName().equals(addonId.getName())) { match = true; break; } } if (!match) { context.addValidationError(context.getCurrentInputComponent(), "\"" + coordinate + "\" does not refer to any installed Addon coordinate"); } } catch (IllegalArgumentException e) { context.addValidationError(context.getCurrentInputComponent(), "\"" + coordinate + "\" is not a valid Addon coordinate"); } } }); builder.add(named); }

Target:
public void initializeUI(UIBuilder builder) throws Exception { named.setCompleter(new UICompleter<String>() { @Override public Iterable<String> getCompletionProposals(UIContext context, InputComponent<?, String> input, String value) { Set<String> items = new TreeSet<String>(); Set<Addon> addons = furnace.getAddonRegistry().getAddons(); for (Addon addon : addons) { items.add(addon.getId().getName()); } return items; } }); named.addValidator(new UIValidator() { @Override public void validate(UIValidationContext context) { String coordinate = (String) context.getCurrentInputComponent().getValue(); try { AddonId addonId = CoordinateUtils.resolveCoordinate(coordinate, Versions.getSpecificationVersionFor(this.getClass()), resolver); Set<Addon> addons = furnace.getAddonRegistry().getAddons(); boolean match = false; for (Addon addon : addons) { if (addon.getId().getName().equals(addonId.getName())) { match = true; break; } } if (!match) { context.addValidationError(context.getCurrentInputComponent(), "\"" + coordinate + "\" does not refer to any installed Addon coordinate"); } } catch (IllegalArgumentException e) { context.addValidationError(context.getCurrentInputComponent(), "\"" + coordinate + "\" is not a valid Addon coordinate"); } } }); builder.add(named); }
Source:
private static Point lineIntersection(Point a, Point b, Point p, Point q) { double a1 = b.getY() - a.getY(); double b1 = a.getX() - b.getX(); double c1 = a1 * a.getX() + b1 * a.getY(); double a2 = q.getY() - p.getY(); double b2 = p.getX() - q.getX(); double c2 = a2 * p.getX() + b2 * p.getY(); double determinate = a1 * b2 - a2 * b1; double x = (b2 * c1 - b1 * c2) / determinate; double y = (a1 * c2 - a2 * c1) / determinate; return new Point(x, y); }

Target:
private static Point lineIntersection(Point a, Point b, Point p, Point q) { double a1 = b.getY() - a.getY(); double b1 = a.getX() - b.getX(); double c1 = a1 * a.getX() + b1 * a.getY(); double a2 = q.getY() - p.getY(); double b2 = p.getX() - q.getX(); double c2 = a2 * p.getX() + b2 * p.getY(); double determinant = a1 * b2 - a2 * b1; double x = (b2 * c1 - b1 * c2) / determinant; double y = (a1 * c2 - a2 * c1) / determinant; return new Point(x, y); }
Source:
private Map<String, Object> processUserList(String query, int start, int limit, boolean includeAnonymous, boolean includeDefault) { Map<String, Object> results = new UsersListTemplate("", 0, query, start, limit, includeAnonymous, includeDefault) { UserAPI userAPI = APILocator.getUserAPI(); @Override public int getUserCount() { try { return new Long(userAPI.getCountUsersByNameOrEmailOrUserID(this.filter, this.includeAnonymous, this.includeDefault)).intValue(); } catch (DotDataException e) { Logger.error(this, e.getMessage(), e); return 0; } } @Override public List<User> getUsers() { try { int page = (start / limit) + 1; int pageSize = limit; return userAPI.getUsersByNameOrEmailOrUserID(filter, page, pageSize, this.includeAnonymous, this.includeDefault); } catch (DotDataException e) { Logger.error(this, e.getMessage(), e); return new ArrayList<User>(); } } }.perform(); return results; }

Target:
private Map<String, Object> processUserList(String query, int start, int limit, boolean includeAnonymous, boolean includeDefault) { Map<String, Object> results = new UsersListTemplate("", 0, query, start, limit, includeAnonymous, includeDefault) { @Override public int getUserCount() { try { return toInt(userAPI.getCountUsersByNameOrEmailOrUserID(this.filter, this.includeAnonymous, this.includeDefault), 0); } catch (DotDataException e) { Logger.error(this, e.getMessage(), e); return 0; } } @Override public List<User> getUsers() { try { int page = (start / limit) + 1; int pageSize = limit; return userAPI.getUsersByNameOrEmailOrUserID(filter, page, pageSize, this.includeAnonymous, this.includeDefault); } catch (DotDataException e) { Logger.error(this, e.getMessage(), e); return new ArrayList<User>(); } } }.perform(); return results; }
Source:
public void parse(String[] args, SnipeData v) { String handle = args[0].toLowerCase(); Matcher performersMatch = PERFORMER.matcher(handle); if (performersMatch.matches()) { placeMethod = stringToMethod(performersMatch.group(1)); if (placeMethod == PerformerType.NONE) { throw new IllegalArgumentException("Unknown placement method '" + performersMatch.group(1) + "'"); } replaceMethod = stringToMethod(performersMatch.group(2)); usePhysics = !performersMatch.group(3).equals("p"); parameters(Arrays.copyOfRange(args, 1, args.length), v); } else { parameters(args, v); } v.getVoxelMessage().performerData(placeMethod, replaceMethod, usePhysics); }

Target:
public void parse(String[] args, SnipeData v) { String handle = args[0].toLowerCase(); Matcher performersMatch = PERFORMER.matcher(handle); if (performersMatch.matches()) { this.placeMethod = stringToMethod(performersMatch.group(1)); if (this.placeMethod == PerformerType.NONE) { throw new IllegalArgumentException("Unknown placement method '" + performersMatch.group(1) + "'"); } this.replaceMethod = stringToMethod(performersMatch.group(2)); this.usePhysics = !performersMatch.group(3).equals("p"); parameters(Arrays.copyOfRange(args, 1, args.length), v); } else { parameters(args, v); } v.getVoxelMessage().performerData(this.placeMethod, this.replaceMethod, this.usePhysics); }
Source:
public void addMpathwayDataToSession(HttpServletRequest request, WAPIResultWrapper wrappedResult, String mpathwaysTermId) { try{ M_log.debug("Mapth Wrapped Result: " + wrappedResult.toJson().toString()); ArrayList<String> mPathwayData = new ArrayList<String>(); JSONArray mPathJsonArray; JSONObject result = new JSONObject(wrappedResult.toJson()); mPathJsonArray = result.getJSONObject("Result").getJSONObject("getInstrClassListResponse").getJSONArray("InstructedClass"); M_log.debug("mPathJsonArray: " + mPathJsonArray); for(int i = 0; i < mPathJsonArray.length(); i++){ JSONObject childJSONObject = mPathJsonArray.getJSONObject(i); if(childJSONObject.get("InstructorRole").equals("Primary Instructor") || childJSONObject.get("InstructorRole").equals("Secondary Instructor") || childJSONObject.get("InstructorRole").equals("Faculty grader") || childJSONObject.get("InstructorRole").equals("Graduate Student Instructor")){ M_log.debug("Class Number: " + childJSONObject.get("ClassNumber")); mPathwayData.add(mpathwaysTermId + childJSONObject.get("ClassNumber").toString()); } } for(String course : mPathwayData){ M_log.debug("Course: " + course); } HttpSession session = request.getSession(true); session.setAttribute(M_PATH_DATA,mPathwayData); } catch(JSONException e){ M_log.error(e.getMessage()); return; } }

Target:
public void addMpathwayDataToSession(HttpServletRequest request, WAPIResultWrapper wrappedResult, String mpathwaysTermId) { try{ M_log.debug("Mapth Wrapped Result: " + wrappedResult.toJson().toString()); ArrayList<String> mPathwayData = new ArrayList<String>(); JSONArray mPathJsonArray; JSONObject result = new JSONObject(wrappedResult.toJson()); mPathJsonArray = result.getJSONObject("Result").getJSONObject("getInstrClassListResponse").getJSONArray("InstructedClass"); M_log.debug("mPathJsonArray: " + mPathJsonArray); for(int i = 0; i < mPathJsonArray.length(); i++){ JSONObject childJSONObject = mPathJsonArray.getJSONObject(i); if(allowedRoles.contains(childJSONObject.get("InstructorRole"))){ M_log.debug("Class Number: " + childJSONObject.get("ClassNumber")); mPathwayData.add(mpathwaysTermId + childJSONObject.get("ClassNumber").toString()); } } if(M_log.isDebugEnabled()){ for(String course : mPathwayData){ M_log.debug("Course: " + course); } } HttpSession session = request.getSession(true); session.setAttribute(M_PATH_DATA,mPathwayData); } catch(JSONException e){ M_log.error(e.getMessage()); return; } }
Source:
public String toString() { return String.format("%s %s %s %s -> %s (± %s)", paramKey, group, name, implementation, getScoreFormatted(), getScoreErrorPct()); }

Target:
public String toString() { return String.format("%s %s %s %s -> %s (± %s)", paramKey, target, operation, implementation, getScoreFormatted(), getScoreErrorPct()); }
Source:
public IFile createBookmarksFile() throws CoreException { TmfExperimentFolder experimentFolder = getProject().getExperimentsFolder(); IFolder res = getResource(); if (experimentFolder != null) { res = experimentFolder.getResource(); } return createBookmarksFile(res, ITmfEventsEditorConstants.EXPERIMENT_EDITOR_INPUT_TYPE); }

Target:
public IFile createBookmarksFile() throws CoreException { TmfExperimentFolder experimentFolder = getProject().getExperimentsFolder(); if (experimentFolder == null) { throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TmfProject_ExperimentFolderNotExists)); } return createBookmarksFile(experimentFolder.getResource(), ITmfEventsEditorConstants.EXPERIMENT_EDITOR_INPUT_TYPE); }
Source:
public static boolean isOpenCvLoaded() { return OPEN_CV_LOADED; }

Target:
public static boolean isOpenCvLoaded() throws UnsatisfiedLinkError { if (!openCvLoaded) { if (exception != null) { throw exception; } else { throw new UnsatisfiedLinkError("OpenCV native library failed to load"); } } return openCvLoaded; }
Source:
private String keyCodeToString(GameKeyEvent event){ int code = event.getKeyCode(); switch(code){ case KeyEvent.VK_UP: return "UP"; case KeyEvent.VK_DOWN: return "DOWN"; case KeyEvent.VK_RIGHT: return "RIGHT"; case KeyEvent.VK_LEFT: return "LEFT"; default: return "undefined"; } }

Target:
private String keyCodeToString(GameKeyEvent event){ int code = event.getKeyCode(); switch(code){ case KeyEvent.VK_UP: return TestCase.UP; case KeyEvent.VK_DOWN: return TestCase.DOWN; case KeyEvent.VK_RIGHT: return TestCase.RIGHT; case KeyEvent.VK_LEFT: return TestCase.LEFT; default: return "undefined"; } }
Source:
public void removeEntries(List<BibEntry> bibEntries) { StringBuilder query = new StringBuilder() .append("DELETE FROM ") .append(escape("ENTRY")) .append(" WHERE ") .append(escape("SHARED_ID")) .append(" IN ("); for (int i = 0; i < bibEntries.size() - 1; i++) { query.append("?, "); } query.append("?)"); try (PreparedStatement preparedStatement = connection.prepareStatement(query.toString())) { for (int j = 0; j < bibEntries.size(); j++) { preparedStatement.setInt(j + 1, bibEntries.get(j).getSharedBibEntryData().getSharedID()); } preparedStatement.executeUpdate(); } catch (SQLException e) { LOGGER.error("SQL Error: ", e); } }

Target:
public void removeEntries(List<BibEntry> bibEntries) { Objects.requireNonNull(bibEntries); if (bibEntries.isEmpty()) { return; } StringBuilder query = new StringBuilder() .append("DELETE FROM ") .append(escape("ENTRY")) .append(" WHERE ") .append(escape("SHARED_ID")) .append(" IN ("); query.append("?, ".repeat(bibEntries.size() - 1)); query.append("?)"); try (PreparedStatement preparedStatement = connection.prepareStatement(query.toString())) { for (int j = 0; j < bibEntries.size(); j++) { preparedStatement.setInt(j + 1, bibEntries.get(j).getSharedBibEntryData().getSharedID()); } preparedStatement.executeUpdate(); } catch (SQLException e) { LOGGER.error("SQL Error: ", e); } }
Source:
protected void populateGlobalProperties() { String externalAddress = getExternalAddress(); String externalIP = getExternalIp(externalAddress); globalPropertiesMap.put("internalIp", cheDockerIp); globalPropertiesMap.put("externalAddress", externalAddress); globalPropertiesMap.put("externalIP", externalIP); globalPropertiesMap.put("workspaceId", getWorkspaceId()); globalPropertiesMap.put("workspaceIdWithoutPrefix", getWorkspaceId().replaceFirst("workspace","")); globalPropertiesMap.put("machineName", getMachineName()); globalPropertiesMap.put("wildcardNipDomain", getWildcardNipDomain(externalAddress)); globalPropertiesMap.put("wildcardXipDomain", getWildcardXipDomain(externalAddress)); globalPropertiesMap.put("chePort", chePort); globalPropertiesMap.put("isDevMachine", getIsDevMachine()); }

Target:
protected void populateGlobalProperties() { String externalAddress = getExternalAddress(); String externalIP = getExternalIp(externalAddress); globalPropertiesMap.put("internalIp", cheDockerIp); globalPropertiesMap.put("externalAddress", externalAddress); globalPropertiesMap.put("externalIP", externalIP); globalPropertiesMap.put("workspaceId", getWorkspaceId()); globalPropertiesMap.put("workspaceIdWithoutPrefix", getWorkspaceId().replaceFirst(CHE_WORKSPACE_ID_PREFIX,"")); globalPropertiesMap.put("machineName", getMachineName()); globalPropertiesMap.put("wildcardNipDomain", getWildcardNipDomain(externalAddress)); globalPropertiesMap.put("wildcardXipDomain", getWildcardXipDomain(externalAddress)); globalPropertiesMap.put("chePort", chePort); globalPropertiesMap.put(IS_DEV_MACHINE_MACRO, getIsDevMachine()); }
Source:
public WeightedDoubleReservoirSample(int maxSamples) { checkArgument(maxSamples > 0, "Maximum number of reservoir samples must be positive"); checkArgument(maxSamples <= MAX_SAMPLES_LIMIT, "Maximum number of reservoir samples is capped"); this.size = 0; this.samples = new double[maxSamples]; this.weights = new double[maxSamples]; checkArguments(); }

Target:
public WeightedDoubleReservoirSample(int maxSamples) { checkArgument(maxSamples > 0, format("Maximum number of samples must be positive: %s", maxSamples)); checkArgument( maxSamples <= MAX_SAMPLES_LIMIT, format("Maximum number of samples must not exceed limit: %s %s", maxSamples, MAX_SAMPLES_LIMIT)); this.samples = new double[maxSamples]; this.weights = new double[maxSamples]; }
Source:
@Override public void draw(Canvas canvas) { if (!animating) { super.draw(canvas); } else { float normalized = (SystemClock.uptimeMillis() - startTimeMillis) / FADE_DURATION; if (normalized >= 1f) { animating = false; placeholder = null; super.draw(canvas); } else { if (placeholder != null) { placeholder.draw(canvas); } int partialAlpha = (int) (ALPHA * normalized); setAlpha(partialAlpha); super.draw(canvas); setAlpha(ALPHA); } } if (debugging) { drawDebugIndicator(canvas); } }

Target:
@Override public void draw(Canvas canvas) { if (!animating) { super.draw(canvas); } else { float normalized = (SystemClock.uptimeMillis() - startTimeMillis) / FADE_DURATION; if (normalized >= 1f) { animating = false; placeholder = null; super.draw(canvas); } else { if (placeholder != null) { placeholder.draw(canvas); } int partialAlpha = (int) (alpha * normalized); setAlpha(partialAlpha); super.draw(canvas); setAlpha(alpha); } } if (debugging) { drawDebugIndicator(canvas); } }
Source:
public void process() { enchants.forEach((e) -> enchantments.put(Enchantment.fromId(e.id), e.lvl)); }

Target:
public void process() { enchants.forEach(e -> enchantments.put(Enchantment.fromId(e.id), e.lvl)); }