auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public String exportWorklistAsZip(List<DocumentModel> documents, boolean exportAllBlobs) { try { DownloadService dnd = Framework.getService(DownloadService.class); DocumentListZipExporter zipExporter = new DocumentListZipExporter(); File tmpFile = zipExporter.exportWorklistAsZip(documents, documentManager, exportAllBlobs); if (tmpFile == null) { facesMessages.add(StatusMessage.Severity.INFO, messages.get("label.clipboard.emptyDocuments")); return null; } try { Blob blob = new FileBlob("zip"); blob.setMimeType("application/zip"); blob.setFilename("clipboard.zip"); Files.move(tmpFile.toPath(), blob.getFile().toPath(), StandardCopyOption.REPLACE_EXISTING); String key = dnd.store(Collections.singletonList(new FileBlob(tmpFile))); String url = BaseURL.getBaseURL() + "/" + dnd.getDownloadUrl(key); ExternalContext context = FacesContext.getCurrentInstance().getExternalContext(); context.redirect(url); return ""; } finally { tmpFile.delete(); } } catch (IOException io) { throw new NuxeoException("Error while redirecting for clipboard content", io); } }

Target:
public String exportWorklistAsZip(List<DocumentModel> documents, boolean exportAllBlobs) { Blob blob = null; try { DownloadService downloadService = Framework.getService(DownloadService.class); DocumentListZipExporter zipExporter = new DocumentListZipExporter(); blob = zipExporter.exportWorklistAsZip(documents, documentManager, exportAllBlobs); if (blob == null) { facesMessages.add(StatusMessage.Severity.INFO, messages.get("label.clipboard.emptyDocuments")); return null; } blob.setMimeType("application/zip"); blob.setFilename("clipboard.zip"); String key = downloadService.storeBlobs(Collections.singletonList(blob)); String url = BaseURL.getBaseURL() + "/" + downloadService.getDownloadUrl(key); ExternalContext context = FacesContext.getCurrentInstance().getExternalContext(); context.redirect(url); return ""; } catch (IOException io) { if (blob != null) { blob.getFile().delete(); } throw new NuxeoException("Error while redirecting for clipboard content", io); } }
Source:
public void recognizeContent() throws IOException { File form = new File("local/file_path/filename.png"); byte[] fileContent = Files.readAllBytes(form.toPath()); InputStream inputStream = new ByteArrayInputStream(fileContent); SyncPoller<FormRecognizerOperationResult, List<FormPage>> recognizeContentPoller = formRecognizerClient.beginRecognizeContent(inputStream, form.length()); List<FormPage> contentPageResults = recognizeContentPoller.getFinalResult(); for (int i = 0; i < contentPageResults.size(); i++) { FormPage formPage = contentPageResults.get(i); System.out.printf("----Recognizing content info for page %d ----%n", i); System.out.printf("Has width: %f and height: %f, measured with unit: %s.%n", formPage.getWidth(), formPage.getHeight(), formPage.getUnit()); formPage.getTables().forEach(formTable -> { System.out.printf("Table has %d rows and %d columns.%n", formTable.getRowCount(), formTable.getColumnCount()); formTable.getCells().forEach(formTableCell -> System.out.printf("Cell has text %s.%n", formTableCell.getText())); }); formPage.getSelectionMarks().forEach(selectionMark -> { StringBuilder boundingBoxStr = new StringBuilder(); selectionMark.getBoundingBox().getPoints().forEach( point -> boundingBoxStr.append(String.format("[%.2f, %.2f]", point.getX(), point.getY()))); System.out.printf("Page: %s, Selection mark is %s within bounding box %s has a confidence score %.2f.%n", selectionMark.getPageNumber(), selectionMark.getState(), boundingBoxStr, selectionMark.getConfidence()); }); } }

Target:
public void recognizeContent() throws IOException { File form = new File("local/file_path/filename.png"); byte[] fileContent = Files.readAllBytes(form.toPath()); InputStream inputStream = new ByteArrayInputStream(fileContent); SyncPoller<FormRecognizerOperationResult, List<FormPage>> recognizeContentPoller = formRecognizerClient.beginRecognizeContent(inputStream, form.length()); List<FormPage> contentPageResults = recognizeContentPoller.getFinalResult(); for (int i = 0; i < contentPageResults.size(); i++) { FormPage formPage = contentPageResults.get(i); System.out.printf("----Recognizing content info for page %d ----%n", i); System.out.printf("Has width: %f and height: %f, measured with unit: %s.%n", formPage.getWidth(), formPage.getHeight(), formPage.getUnit()); formPage.getTables().forEach(formTable -> { System.out.printf("Table has %d rows and %d columns.%n", formTable.getRowCount(), formTable.getColumnCount()); formTable.getCells().forEach(formTableCell -> System.out.printf("Cell has text %s.%n", formTableCell.getText())); }); formPage.getSelectionMarks().forEach(selectionMark -> System.out.printf( "Page: %s, Selection mark is %s within bounding box %s has a confidence score %.2f.%n", selectionMark.getPageNumber(), selectionMark.getState(), selectionMark.getBoundingBox().toString(), selectionMark.getConfidence())); } }
Source:
public static <T> T findOne(List<T> list, Predicate<T> filter) { return list .stream() .filter(filter) .findFirst() .orElse(null); }

Target:
public static <T> Optional<T> findOne(List<T> list, Predicate<T> filter) { return list .stream() .filter(filter) .findFirst(); }
Source:
public void testBindListWithHashPrefixParser() { handle.registerRowMapper(FieldMapper.factory(Thing.class)); handle.createUpdate("insert into thing (<columns>) values (<values>)") .setSqlParser(new HashPrefixSqlParser()) .defineList("columns", "id", "foo") .bindList("values", 3, "abc") .execute(); List<Thing> list = handle.createQuery("select id, foo from thing where id in (<ids>)") .setSqlParser(new HashPrefixSqlParser()) .bindList("ids", 1, 3) .mapTo(Thing.class) .list(); assertThat(list) .extracting(Thing::getId, Thing::getFoo, Thing::getBar, Thing::getBaz) .containsExactly( tuple(1, "foo1", null, null), tuple(3, "abc", null, null)); }

Target:
public void testBindListWithHashPrefixParser() { handle .registerRowMapper(FieldMapper.factory(Thing.class)) .setSqlParser(new HashPrefixSqlParser()); handle.createUpdate("insert into thing (<columns>) values (<values>)") .defineList("columns", "id", "foo") .bindList("values", 3, "abc") .execute(); List<Thing> list = handle.createQuery("select id, foo from thing where id in (<ids>)") .bindList("ids", 1, 3) .mapTo(Thing.class) .list(); assertThat(list) .extracting(Thing::getId, Thing::getFoo, Thing::getBar, Thing::getBaz) .containsExactly( tuple(1, "foo1", null, null), tuple(3, "abc", null, null)); }
Source:
public LeafNode getNode() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { PubSubManager pubSubManager = PubSubManager.getInstance(connection()); try { pubSubManager.createNode(GeoLocation.NAMESPACE); } catch (Exception e) { } return pubSubManager.getNode(GeoLocation.NAMESPACE); }

Target:
private LeafNode getNode() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { return PubSubManager.getInstance(connection()).getOrCreateLeafNode(GeoLocation.NAMESPACE); }
Source:
private static Function<String, Pattern> createRefPatternProvider() { return input -> { try { return Pattern.compile(".*\\Q" + input.trim() + "\\E.*", Pattern.CASE_INSENSITIVE); } catch (Exception e) { return null; } }; }

Target:
private static Function<String, Pattern> createRefPatternProvider() { return input -> { try { String quotedInput = Pattern.quote(input.trim()); return Pattern.compile( "refs/(heads|tags|notes)/.*" + quotedInput + ".*" + "|" + quotedInput + ".*", Pattern.CASE_INSENSITIVE); } catch (Exception e) { return null; } }; }
Source:
public RxJavaProcessor processor() { return new RxJavaProcessor<String, String>() { @Override public Observable<String> process(Observable<String> inputStream) { return inputStream.map(data -> { logger.info("Got data = " + data); return data; }) .buffer(5) .map(data -> String.valueOf(avg(data))); } }; }

Target:
public RxJavaProcessor<String,String> processor() { return inputStream -> inputStream.map(data -> { logger.info("Got data = " + data); return data; }).buffer(5).map(data -> String.valueOf(avg(data))); }
Source:
public boolean isGood() { return !"unknown".equalsIgnoreCase(version); }

Target:
public boolean isGood() { return !UNKNOWN_VERSION.equalsIgnoreCase(version); }
Source:
void shareScreen(Bitmap bitmap) { try { File file = new File(this.getExternalCacheDir(), "screen.png"); FileOutputStream fOut = new FileOutputStream(file); bitmap.compress(Bitmap.CompressFormat.PNG, 100, fOut); fOut.flush(); fOut.close(); file.setReadable(true, false); Uri fileUri = FileProvider.getUriForFile(getApplicationContext(), getPackageName()+".provider", file); grantUriPermission(getPackageName(), fileUri, Intent.FLAG_GRANT_READ_URI_PERMISSION); final Intent intent = new Intent(android.content.Intent.ACTION_SEND); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra(Intent.EXTRA_STREAM, fileUri); intent.setType("image/png"); startActivity(Intent.createChooser(intent, getString(R.string.achiev_activity_share_screen))); } catch (IOException e) { e.printStackTrace(); } }

Target:
void shareScreen(Bitmap bitmap) { try { File file = new File(this.getExternalCacheDir(), "screen.png"); FileOutputStream fOut = new FileOutputStream(file); bitmap.compress(Bitmap.CompressFormat.PNG, 100, fOut); fOut.flush(); fOut.close(); file.setReadable(true, false); Uri fileUri = FileProvider.getUriForFile(getApplicationContext(), getPackageName()+".provider", file); grantUriPermission(getPackageName(), fileUri, Intent.FLAG_GRANT_READ_URI_PERMISSION); final Intent intent = new Intent(android.content.Intent.ACTION_SEND); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra(Intent.EXTRA_STREAM, fileUri); intent.setType("image/png"); startActivity(Intent.createChooser(intent, getString(R.string.share_image_via))); } catch (IOException e) { e.printStackTrace(); } }
Source:
protected List<ILinkEvent> getLinkList(long startTime, long endTime, long resolution, IProgressMonitor monitor) { @SuppressWarnings("null") @NonNull List<ILinkEvent> list = Collections.EMPTY_LIST; return list; }

Target:
protected List<ILinkEvent> getLinkList(long startTime, long endTime, long resolution, IProgressMonitor monitor) { return Collections.EMPTY_LIST; }
Source:
public void testListConsumerGroupsWithStates() throws Exception { try (AdminClientUnitTestEnv env = new AdminClientUnitTestEnv(mockCluster(1, 0))) { env.kafkaClient().setNodeApiVersions(NodeApiVersions.create()); env.kafkaClient().prepareResponse(prepareMetadataResponse(env.cluster(), Errors.NONE)); env.kafkaClient().prepareResponseFrom( new ListGroupsResponse( new ListGroupsResponseData() .setErrorCode(Errors.NONE.code()) .setGroups(Arrays.asList( new ListGroupsResponseData.ListedGroup() .setGroupId("group-1") .setProtocolType(ConsumerProtocol.PROTOCOL_TYPE) .setGroupState("Stable"), new ListGroupsResponseData.ListedGroup() .setGroupId("group-2") .setGroupState("Empty") ))), env.cluster().nodeById(0)); final ListConsumerGroupsOptions options = new ListConsumerGroupsOptions().inAnyState(); final ListConsumerGroupsResult result = env.adminClient().listConsumerGroups(options); Collection<ConsumerGroupListing> listings = result.valid().get(); assertEquals(2, listings.size()); List<ConsumerGroupListing> expected = new ArrayList<>(); expected.add(new ConsumerGroupListing("group-2", true, ConsumerGroupState.EMPTY)); expected.add(new ConsumerGroupListing("group-1", false, ConsumerGroupState.STABLE)); assertEquals(expected, listings); assertEquals(0, result.errors().get().size()); } }

Target:
public void testListConsumerGroupsWithStates() throws Exception { try (AdminClientUnitTestEnv env = new AdminClientUnitTestEnv(mockCluster(1, 0))) { env.kafkaClient().setNodeApiVersions(NodeApiVersions.create()); env.kafkaClient().prepareResponse(prepareMetadataResponse(env.cluster(), Errors.NONE)); env.kafkaClient().prepareResponseFrom( new ListGroupsResponse(new ListGroupsResponseData() .setErrorCode(Errors.NONE.code()) .setGroups(Arrays.asList( new ListGroupsResponseData.ListedGroup() .setGroupId("group-1") .setProtocolType(ConsumerProtocol.PROTOCOL_TYPE) .setGroupState("Stable"), new ListGroupsResponseData.ListedGroup() .setGroupId("group-2") .setGroupState("Empty")))), env.cluster().nodeById(0)); final ListConsumerGroupsOptions options = new ListConsumerGroupsOptions(); final ListConsumerGroupsResult result = env.adminClient().listConsumerGroups(options); Collection<ConsumerGroupListing> listings = result.valid().get(); assertEquals(2, listings.size()); List<ConsumerGroupListing> expected = new ArrayList<>(); expected.add(new ConsumerGroupListing("group-2", true, Optional.of(ConsumerGroupState.EMPTY))); expected.add(new ConsumerGroupListing("group-1", false, Optional.of(ConsumerGroupState.STABLE))); assertEquals(expected, listings); assertEquals(0, result.errors().get().size()); } }
Source:
protected ApplicationReport getApplicationByName(String appName) { List<ApplicationReport> appList = getApplicationList(); if (appName == null) { throw new CliException("Invalid application name provided by user"); } for (ApplicationReport ar : appList) { if ((ar.getName().equals(appName)) && (ar.getYarnApplicationState() != YarnApplicationState.KILLED) && (ar.getYarnApplicationState() != YarnApplicationState.FINISHED)) { LOG.debug("Application Name: Application ID: Application State: {}", ar.getName(), ar.getApplicationId().toString(), YarnApplicationState.FINISHED); return ar; } } return null; }

Target:
protected ApplicationReport getApplicationByName(String appName) { if (appName == null) { throw new CliException("Invalid application name provided by user"); } List<ApplicationReport> appList = getApplicationList(); for (ApplicationReport ar : appList) { if ((ar.getName().equals(appName)) && (ar.getYarnApplicationState() != YarnApplicationState.KILLED) && (ar.getYarnApplicationState() != YarnApplicationState.FINISHED)) { LOG.debug("Application Name: Application ID: Application State: {}", ar.getName(), ar.getApplicationId().toString(), YarnApplicationState.FINISHED); return ar; } } return null; }
Source:
private static String stripCommentLines(String commitMessage) { StringBuilder result = new StringBuilder(); for (String line : commitMessage.split("\n")) { if (!line.trim().startsWith("#")) { result.append(line).append("\n"); } } if (!commitMessage.endsWith("\n")) { result.deleteCharAt(result.length() - 1); } return result.toString(); }

Target:
private static String stripCommentLines(String commitMessage) { StringBuilder result = new StringBuilder(); for (String line : commitMessage.split("\n")) { if (!line.trim().startsWith("#")) result.append(line).append("\n"); } if (!commitMessage.endsWith("\n")) result.deleteCharAt(result.length() - 1); return result.toString(); }
Source:
} catch (Exception e) { throw new RuntimeException("Cannot access Unsafe methods", e); }

Target:
catch (Exception e) { throw new RuntimeException("Cannot access Unsafe methods", e); }
Source:
public void testSemiJoin() { ExecutionContext<Object[]> ctx = executionContext(F.first(nodes()), UUID.randomUUID(), 0); ScanNode<Object[]> persons = new ScanNode<>(ctx, Arrays.asList( new Object[]{0, "Igor", 1}, new Object[]{1, "Roman", 2}, new Object[]{2, "Ivan", null}, new Object[]{3, "Alexey", 1} )); ScanNode<Object[]> deps = new ScanNode<>(ctx, Arrays.asList( new Object[]{1, "Core"}, new Object[]{2, "SQL"} )); SemiJoinNode<Object[]> join = new SemiJoinNode<>( ctx, r -> r[0] == r[4] ); join.register(F.asList(deps, persons)); ProjectNode<Object[]> project = new ProjectNode<>(ctx, r -> new Object[]{r[1]}); project.register(join); RootNode<Object[]> node = new RootNode<>(ctx, r -> {}); node.register(project); assert node.hasNext(); ArrayList<Object[]> rows = new ArrayList<>(); while (node.hasNext()) rows.add(node.next()); assertEquals(2, rows.size()); Assert.assertArrayEquals(new Object[]{"Core"}, rows.get(0)); Assert.assertArrayEquals(new Object[]{"SQL"}, rows.get(1)); }

Target:
public void testSemiJoin() { ExecutionContext<Object[]> ctx = executionContext(F.first(nodes()), UUID.randomUUID(), 0); ScanNode<Object[]> persons = new ScanNode<>(ctx, Arrays.asList( new Object[]{0, "Igor", 1}, new Object[]{1, "Roman", 2}, new Object[]{2, "Ivan", null}, new Object[]{3, "Alexey", 1} )); ScanNode<Object[]> deps = new ScanNode<>(ctx, Arrays.asList( new Object[]{1, "Core"}, new Object[]{2, "SQL"}, new Object[]{3, "QA"} )); SemiJoinNode<Object[]> join = new SemiJoinNode<>( ctx, r -> r[0] == r[4] ); join.register(F.asList(deps, persons)); ProjectNode<Object[]> project = new ProjectNode<>(ctx, r -> new Object[]{r[1]}); project.register(join); RootNode<Object[]> node = new RootNode<>(ctx, r -> {}); node.register(project); assert node.hasNext(); ArrayList<Object[]> rows = new ArrayList<>(); while (node.hasNext()) rows.add(node.next()); assertEquals(2, rows.size()); Assert.assertArrayEquals(new Object[]{"Core"}, rows.get(0)); Assert.assertArrayEquals(new Object[]{"SQL"}, rows.get(1)); }
Source:
private HostVO getHost(Long zoneId, boolean computeClusterMustSupportResign) { if (zoneId == null) { throw new CloudRuntimeException("Zone ID cannot be null."); } List<? extends Cluster> clusters = _mgr.searchForClusters(zoneId, new Long(0), Long.MAX_VALUE, HypervisorType.XenServer.toString()); if (clusters == null) { clusters = new ArrayList<>(); } Collections.shuffle(clusters, new Random(System.nanoTime())); clusters: for (Cluster cluster : clusters) { if (cluster.getAllocationState() == AllocationState.Enabled) { List<HostVO> hosts = _hostDao.findByClusterId(cluster.getId()); if (hosts != null) { Collections.shuffle(hosts, new Random(System.nanoTime())); for (HostVO host : hosts) { if (host.getResourceState() == ResourceState.Enabled) { if (computeClusterMustSupportResign) { if (computeClusterSupportsResign(cluster.getId())) { return host; } else { continue clusters; } } else { return host; } } } } } } return null; }

Target:
private HostVO getHost(Long zoneId, boolean computeClusterMustSupportResign) { Preconditions.checkArgument(zoneId != null, "Zone ID cannot be null."); List<HostVO> hosts = _hostDao.listByDataCenterIdAndHypervisorType(zoneId, HypervisorType.XenServer); if (hosts == null) { return null; } List<Long> clustersToSkip = new ArrayList<>(); Collections.shuffle(hosts, RANDOM); for (HostVO host : hosts) { if (computeClusterMustSupportResign) { long clusterId = host.getClusterId(); if (clustersToSkip.contains(clusterId)) { continue; } if (clusterDao.getSupportsResigning(clusterId)) { return host; } else { clustersToSkip.add(clusterId); } } else { return host; } } return null; }
Source:
protected int handlePriority(ReaderWay way, int priorityFromRelation) { TreeMap<Double, Integer> weightToPrioMap = new TreeMap<>(); if (priorityFromRelation == 0) { weightToPrioMap.put(0d, UNCHANGED.getValue()); } else { weightToPrioMap.put(110d, priorityFromRelation); } super.collect(way, weightToPrioMap); return weightToPrioMap.lastEntry().getValue(); }

Target:
protected int handlePriority(ReaderWay way, int priorityFromRelation) { TreeMap<Double, Integer> weightToPrioMap = new TreeMap<>(); weightToPrioMap.put(100d, super.handlePriority(way, priorityFromRelation)); if (way.hasTag("wheelchair", "designated")) { weightToPrioMap.put(102d, VERY_NICE.getValue()); } else if (way.hasTag("wheelchair", "limited")) { weightToPrioMap.put(102d, REACH_DEST.getValue()); } return weightToPrioMap.lastEntry().getValue(); }
Source:
private Consumer<String> transmitConsumer(String wsPath) { return id -> { try { RegisteredProject project = projectManager .getClosest(wsPath) .orElseThrow(() -> new NotFoundException("Can't find a project")); String projectFsPath = pathTransformer.transform(project.getPath()).toString(); GitConnection connection = gitConnectionFactory.getConnection(projectFsPath); Status status = connection.status(emptyList()); Status statusDto = newDto(Status.class); statusDto.setAdded(status.getAdded()); statusDto.setUntracked(status.getUntracked()); statusDto.setChanged(status.getChanged()); statusDto.setModified(status.getModified()); statusDto.setMissing(status.getMissing()); statusDto.setRemoved(status.getRemoved()); statusDto.setConflicting(status.getConflicting()); Map<String, List<EditedRegion>> modifiedFiles = new HashMap<>(); for (String file : status.getChanged()) { modifiedFiles.put(file, connection.getEditedRegions(file)); } StatusChangedEventDto statusChangeEventDto = newDto(StatusChangedEventDto.class) .withProjectName(connection.getWorkingDir().getName()) .withStatus(status) .withModifiedFiles(modifiedFiles); transmit(statusChangeEventDto, id); } catch (ServerException | NotFoundException e) { String errorMessage = e.getMessage(); if (!(COMMIT_IN_PROGRESS_ERROR.equals(errorMessage)) && !(NOT_A_GIT_REPOSITORY_ERROR.equals(errorMessage))) { LOG.error(errorMessage); } } }; }

Target:
private Consumer<String> transmitConsumer(String wsPath) { return id -> { try { RegisteredProject project = projectManager .getClosest(wsPath) .orElseThrow(() -> new NotFoundException("Can't find a project")); String projectFsPath = pathTransformer.transform(project.getPath()).toString(); GitConnection connection = gitConnectionFactory.getConnection(projectFsPath); Status status = connection.status(emptyList()); Status statusDto = newDto(Status.class); statusDto.setAdded(status.getAdded()); statusDto.setUntracked(status.getUntracked()); statusDto.setChanged(status.getChanged()); statusDto.setModified(status.getModified()); statusDto.setMissing(status.getMissing()); statusDto.setRemoved(status.getRemoved()); statusDto.setConflicting(status.getConflicting()); Map<String, List<EditedRegion>> modifiedFiles = new HashMap<>(); for (String file : status.getChanged()) { modifiedFiles.put(file, connection.getEditedRegions(file)); } StatusChangedEventDto statusChangeEventDto = newDto(StatusChangedEventDto.class) .withProjectName(connection.getWorkingDir().getName()) .withStatus(status) .withModifiedFiles(modifiedFiles); transmit(statusChangeEventDto, id); } catch (GitCommitInProgressException | GitInvalidRepositoryException e) { } catch (ServerException | NotFoundException e) { LOG.error(e.getMessage()); } }; }
Source:
private String appendIgnoresToFilter(String filterString) { if (filterString != null && !filterString.isEmpty()) { filterString += ","; } filterString += "!" + storeAndForwardPrefix; filterString += ",!" + managementAddress; filterString += ",!" + managementNotificationAddress; filterString += ",!" + ADVISORY_TOPIC_PREFIX; return filterString; }

Target:
private String appendIgnoresToFilter(String filterString) { if (filterString != null && !filterString.isEmpty()) { filterString += ","; } filterString += "!" + storeAndForwardPrefix; filterString += ",!" + managementAddress; filterString += ",!" + managementNotificationAddress; final String originalFilterString = filterString; for (String ignoredPrefix : clusterManager.getIgnoredAddressPrefixes()) { final String ignoredPrefixPredicate = "!" + ignoredPrefix; if (!originalFilterString.contains(ignoredPrefixPredicate)) { if (originalFilterString.contains(ignoredPrefix)) { logger.warnf("%s will be ignored even if configured differently: please consider removing it from cluster configuration", ignoredPrefix); } filterString += "," + ignoredPrefixPredicate; } } return filterString; }
Source:
private synchronized void setComplete() { cancelIfNotDone(mutateRowsFuture); cancelIfNotDone(stalenessFuture); mutateRowsFuture = null; for(Future<?> future: futures) { if (!future.isDone()) { future.cancel(true); } } futures.clear(); if (!completionFuture.isDone()) { completionFuture.set(""); } }

Target:
private synchronized void setComplete() { cancelIfNotDone(stalenessFuture); cancelIfNotDone(mutateRowsFuture); mutateRowsFuture = null; for (SettableFuture<?> future : futures) { if (!future.isDone()) { future.setException(MISSING_ENTRY_EXCEPTION); } } futures.clear(); if (!completionFuture.isDone()) { completionFuture.set(""); } }
Source:
protected boolean shouldMoveTo(World world, BlockPos pos) { Block block = world.getBlockState(pos).getBlock(); if (block instanceof BlockApiculture && TileUtil.getTile(world, pos) instanceof TileBeeHouse) { TileBeeHouse beeHouse = (TileBeeHouse) TileUtil.getTile(world, pos); InventoryBeeHousing inventory = (InventoryBeeHousing) beeHouse.getBeeInventory(); if (inventory.isEmpty()) { return false; } if (!inventory.getStackInSlot(SLOT_QUEEN).isEmpty()) { EnumBeeType type = ((ItemBeeGE) inventory.getStackInSlot(SLOT_QUEEN).getItem()).getType(); if (type == EnumBeeType.QUEEN) { return false; } if (type == EnumBeeType.PRINCESS && !inventory.getStackInSlot(SLOT_DRONE).isEmpty() && !hasDrone) { return false; } } boolean foundPrincess = hasPrincess; boolean foundDrone = hasDrone; if (foundDrone && foundPrincess) { return true; } for (ItemStack stack : InventoryUtil.getStacks(inventory, SLOT_PRODUCT_1, SLOT_PRODUCT_COUNT)) { if (stack != ItemStack.EMPTY && stack.getItem() instanceof ItemBeeGE) { EnumBeeType type = ((ItemBeeGE) stack.getItem()).getType(); if (type == EnumBeeType.PRINCESS) { foundPrincess = true; } if (type == EnumBeeType.DRONE) { foundDrone = true; } if (foundDrone && foundPrincess) { return true; } } } return false; } return false; }

Target:
protected boolean shouldMoveTo(World world, BlockPos pos) { pos = pos.north().up(); Block block = world.getBlockState(pos).getBlock(); if (block instanceof BlockApiculture && TileUtil.getTile(world, pos) instanceof TileBeeHouse) { TileBeeHouse beeHouse = (TileBeeHouse) TileUtil.getTile(world, pos); InventoryBeeHousing inventory = (InventoryBeeHousing) beeHouse.getBeeInventory(); if (inventory.isEmpty()) { return false; } if (!inventory.getStackInSlot(SLOT_QUEEN).isEmpty()) { EnumBeeType type = ((ItemBeeGE) inventory.getStackInSlot(SLOT_QUEEN).getItem()).getType(); if (type == EnumBeeType.QUEEN) { return false; } if (type == EnumBeeType.PRINCESS && !inventory.getStackInSlot(SLOT_DRONE).isEmpty() && !hasDrone) { return false; } } boolean foundPrincess = hasPrincess; boolean foundDrone = hasDrone; if (foundDrone && foundPrincess) { return true; } for (ItemStack stack : InventoryUtil.getStacks(inventory, SLOT_PRODUCT_1, SLOT_PRODUCT_COUNT)) { if (!stack.isEmpty() && stack.getItem() instanceof ItemBeeGE) { EnumBeeType type = ((ItemBeeGE) stack.getItem()).getType(); if (type == EnumBeeType.PRINCESS) { foundPrincess = true; } if (type == EnumBeeType.DRONE) { foundDrone = true; } if (foundDrone && foundPrincess) { return true; } } } return false; } return false; }
Source:
public void getBiome(BlockPos pos, CallbackInfoReturnable<Biome> cir) { ICubicWorld cworld = (ICubicWorld) world; if(!cworld.isCubicWorld()) return; cir.cancel(); int x = (pos.getX() >> 4) - this.chunkX; int z = (pos.getZ() >> 4) - this.chunkZ; if (!withinBounds(x, z)) { cir.setReturnValue(Biomes.PLAINS); return; } ICube cube = ((IColumn)this.chunkArray[x][z]).getCube(Coords.blockToCube(pos.getY())); cir.setReturnValue(cube.getBiome(pos, this.world.getBiomeProvider())); }

Target:
public void getBiome(BlockPos pos, CallbackInfoReturnable<Biome> cir) { ICubicWorld cworld = (ICubicWorld) world; if(!cworld.isCubicWorld()) return; cir.cancel(); int chunkX = Coords.blockToCube(pos.getX()) - this.chunkX; int chunkZ = Coords.blockToCube(pos.getZ()) - this.chunkZ; if (!withinBounds(chunkX, chunkZ)) { cir.setReturnValue(Biomes.PLAINS); return; } ICube cube = ((IColumn)this.chunkArray[chunkX][chunkZ]).getCube(Coords.blockToCube(pos.getY())); cir.setReturnValue(cube.getBiome(pos)); }
Source:
private Optional<NodeDocument> getNodeInfo(Integer nodeId) { OnmsNode onmsNode = null; try (Timer.Context ctx = nodeLoadTimer.time()) { onmsNode = nodeDao.get(nodeId); } if (onmsNode != null) { final NodeDocument nodeDocument = new NodeDocument(); nodeDocument.setForeignSource(onmsNode.getForeignSource()); nodeDocument.setForeignId(onmsNode.getForeignId()); nodeDocument.setNodeId(onmsNode.getId()); nodeDocument.setCategories(onmsNode.getCategories().stream().map(OnmsCategory::getName).collect(Collectors.toList())); return Optional.of(nodeDocument); } return Optional.empty(); }

Target:
private Optional<NodeDocument> getNodeInfo(Integer nodeId) { OnmsNode onmsNode = null; try (Timer.Context ctx = nodeLoadTimer.time()) { onmsNode = nodeDao.get(nodeId); } return mapOnmsNodeToNodeDocument(onmsNode); }
Source:
protected void configureSystemProperties( String solutionRootPath, String root ) { fillMissedSystemProperty( "karaf.home", root ); fillMissedSystemProperty( "karaf.base", root ); fillMissedSystemProperty( "karaf.history", root + "/data/history.txt" ); fillMissedSystemProperty( "karaf.instances", root + "/instances" ); fillMissedSystemProperty( "karaf.startLocalConsole", "false" ); fillMissedSystemProperty( "karaf.startRemoteShell", "true" ); fillMissedSystemProperty( "karaf.lock", "false" ); fillMissedSystemProperty( "karaf.etc", root + "/etc" ); final String karafLogsPath = getCustomPropertyValue( root, PENTAHO_KARAF_LOGS, solutionRootPath + "/logs" ); fillMissedSystemProperty( PENTAHO_KARAF_LOGS, karafLogsPath ); KettleClientEnvironment.ClientType clientType = getClientType(); String extraKettleEtc = translateToExtraKettleEtc( clientType ); if ( extraKettleEtc != null && new File( root + extraKettleEtc ).exists() ) { System.setProperty( "felix.fileinstall.dir", root + "/etc" + "," + root + extraKettleEtc ); } else { System.setProperty( "felix.fileinstall.dir", root + "/etc" ); } System.setProperty( "embedded.karaf.mode", "true" ); File file = new File( solutionRootPath + "/system/osgi/log4j.xml" ); if ( file.exists() ) { System.setProperty( "log4j.configuration", file.toURI().toString() ); } else { logger.warn( file.toURI().toString() + " file not exist" ); } }

Target:
protected void configureSystemProperties( String solutionRootPath, String root ) { fillMissedSystemProperty( "karaf.home", root ); fillMissedSystemProperty( "karaf.base", root ); fillMissedSystemProperty( "karaf.history", root + "/data/history.txt" ); fillMissedSystemProperty( "karaf.instances", root + "/instances" ); fillMissedSystemProperty( "karaf.startLocalConsole", "false" ); fillMissedSystemProperty( "karaf.startRemoteShell", "true" ); fillMissedSystemProperty( "karaf.lock", "false" ); fillMissedSystemProperty( "karaf.etc", root + "/etc" ); final String karafLogsPath = this.karafCustomProperties.getProperty( KARAF_LOGS_PATH, solutionRootPath + "/logs" ); fillMissedSystemProperty( KARAF_LOGS_PATH, karafLogsPath ); KettleClientEnvironment.ClientType clientType = getClientType(); String extraKettleEtc = translateToExtraKettleEtc( clientType ); if ( extraKettleEtc != null && new File( root + extraKettleEtc ).exists() ) { System.setProperty( "felix.fileinstall.dir", root + "/etc" + "," + root + extraKettleEtc ); } else { System.setProperty( "felix.fileinstall.dir", root + "/etc" ); } System.setProperty( "embedded.karaf.mode", "true" ); File file = new File( solutionRootPath + "/system/osgi/log4j.xml" ); if ( file.exists() ) { System.setProperty( "log4j.configuration", file.toURI().toString() ); } else { logger.warn( file.toURI().toString() + " file not exist" ); } }
Source:
private boolean spongeImpl$throwEventForChangingBlockDuringUpdate(final net.minecraft.world.World world, final BlockPos pos, final BlockState blockState) { return this.spongeImpl$strikeBlockAndAddSnapshot(world, pos, blockState); }

Target:
private boolean impl$throwEventForChangingBlockDuringUpdate(final net.minecraft.world.World world, final BlockPos pos, final BlockState blockState) { return this.impl$strikeBlockAndAddSnapshot(world, pos, blockState); }
Source:
private TableDescriptor cleanupTempTableOnCommitOrRollback(TableDescriptor td, boolean dropAndRedeclare) throws StandardException{ getDataDictionary().startWriting(this); TransactionController tc=getTransactionExecute(); long conglomId= tc.createConglomerate(td.getTableType() == TableDescriptor.EXTERNAL_TYPE, "heap", td.getEmptyExecRow().getRowArray(), null, td.getColumnCollationIds(), null, (TransactionController.IS_TEMPORARY| TransactionController.IS_KEPT), 0); long cid=td.getHeapConglomerateId(); ConglomerateDescriptor cgd=td.getConglomerateDescriptor(cid); td.getConglomerateDescriptorList().dropConglomerateDescriptorByUUID( cgd.getUUID()); cgd=getDataDictionary().getDataDescriptorGenerator().newConglomerateDescriptor(conglomId,null,false,null,false,null,td.getUUID(), td.getSchemaDescriptor().getUUID()); ConglomerateDescriptorList conglomList= td.getConglomerateDescriptorList(); conglomList.add(cgd); td.resetHeapConglomNumber(); if(dropAndRedeclare){ tc.dropConglomerate(cid); replaceDeclaredGlobalTempTable(td.getName(),td); } return (td); }

Target:
private TableDescriptor cleanupTempTableOnCommitOrRollback(TableDescriptor td, boolean dropAndRedeclare) throws StandardException{ getDataDictionary().startWriting(this); TransactionController tc=getTransactionExecute(); long conglomId= tc.createConglomerate(td.getTableType() == TableDescriptor.EXTERNAL_TYPE, "heap", td.getEmptyExecRow().getRowArray(), null, td.getColumnCollationIds(), null, (TransactionController.IS_TEMPORARY| TransactionController.IS_KEPT), Conglomerate.Priority.NORMAL); long cid=td.getHeapConglomerateId(); ConglomerateDescriptor cgd=td.getConglomerateDescriptor(cid); td.getConglomerateDescriptorList().dropConglomerateDescriptorByUUID( cgd.getUUID()); cgd=getDataDictionary().getDataDescriptorGenerator().newConglomerateDescriptor(conglomId,null,false,null,false,null,td.getUUID(), td.getSchemaDescriptor().getUUID()); ConglomerateDescriptorList conglomList= td.getConglomerateDescriptorList(); conglomList.add(cgd); td.resetHeapConglomNumber(); if(dropAndRedeclare){ tc.dropConglomerate(cid); replaceDeclaredGlobalTempTable(td.getName(),td); } return (td); }
Source:
public void releaseProducer(final Producer<String, String> producer) { final int newUseCount = useCount.get(producer).decrementAndGet(); assert newUseCount >= 0; if (newUseCount == 0) { final boolean deleteProducer; rwLock.readLock().lock(); try { deleteProducer = producer != activeProducer; } finally { rwLock.readLock().unlock(); } if (deleteProducer) { useCount.remove(producer); producer.close(); } } }

Target:
public void releaseProducer(final Producer<String, String> producer) { useCountMetric.dec(); final AtomicInteger counter = useCount.get(producer); if (counter != null && 0 == counter.decrementAndGet()) { final boolean deleteProducer; rwLock.readLock().lock(); try { deleteProducer = producer != activeProducer; } finally { rwLock.readLock().unlock(); } if (deleteProducer) { rwLock.writeLock().lock(); try { if (counter.get() == 0 && null != useCount.remove(producer)) { LOG.info("Stopping producer instance - It was reported that instance should be refreshed " + "and it is not used anymore: " + producer); producer.close(); } } finally { rwLock.writeLock().unlock(); } } } }
Source:
public static <T> Set<T> makeSet(int initialCapacity) { return new MiniSet<T>(); }

Target:
public static <T> Set<T> makeSet(int initialCapacity) { if (initialCapacity > MiniSet.MAX_OPTIMIZED_CAPACITY) { return new HashSet<>(); } else { return new MiniSet<T>(); } }
Source:
private Collection<ColumnId> asColumns(Collection<String> names) { Collection<ColumnId> ids = new ArrayList<>(); for (String name : names) { ids.add(new ColumnId( tableId, name )); } return ids; }

Target:
private Collection<ColumnId> asColumns(Collection<String> names) { return names.stream() .map(name -> new ColumnId(tableId, name)) .collect(Collectors.toList()); }
Source:
protected void performAction() { Context ctx = extension.getView().getSiteTreePanel().getSelectedContext(); if (ctx == null) { View.getSingleton() .showWarningDialog( Constant.messages.getString("exportUrls.popup.context.error")); if (LOG.isDebugEnabled()) { LOG.debug("No context selected, when trying to export URLs for a context."); } return; } File file = super.getOutputFile(); if (file == null) { return; } List<Context> contexts = extension.getView().getSiteTreePanel().getSelectedContexts(); SortedSet<String> allUrls = new TreeSet<String>(); for (Context c : contexts) { allUrls.addAll(this.getOutputSet(c)); } super.writeURLs(file, allUrls); }

Target:
protected void performAction() { Context ctx = extension.getView().getSiteTreePanel().getSelectedContext(); if (ctx == null) { View.getSingleton() .showWarningDialog( Constant.messages.getString("exportUrls.popup.context.error")); if (LOG.isDebugEnabled()) { LOG.debug("No context selected, when trying to export URLs for a context."); } return; } File file = super.getOutputFile(); if (file == null) { return; } List<Context> contexts = extension.getView().getSiteTreePanel().getSelectedContexts(); SortedSet<String> allUrls = new TreeSet<String>(); for (Context c : contexts) { this.getOutputSet(c, allUrls); } super.writeURLs(file, allUrls); }
Source:
public ClusteredTierClientEntity fetchOrCreateClusteredStoreEntity(UUID clientId, String clusterTierManagerIdentifier, String storeIdentifier, ServerStoreConfiguration clientStoreConfiguration, boolean autoCreate) throws EntityNotFoundException, CachePersistenceException { EntityRef<ClusteredTierClientEntity, ClusteredTierEntityConfiguration> entityRef; try { entityRef = connection.getEntityRef(ClusteredTierClientEntity.class, ENTITY_VERSION, clusterTierManagerIdentifier + storeIdentifier); } catch (EntityNotProvidedException e) { throw new AssertionError(e); } if (autoCreate) { while (true) { try { entityRef.create(new ClusteredTierEntityConfiguration(clusterTierManagerIdentifier, storeIdentifier, clientStoreConfiguration)); } catch (EntityAlreadyExistsException e) { } catch (EntityConfigurationException e) { throw new CachePersistenceException("Unable to create clustered tier", e); } catch (EntityException e) { throw new AssertionError(e); } try { ClusteredTierClientEntity entity = entityRef.fetchEntity(); entity.setClientId(clientId); entity.setStoreIdentifier(storeIdentifier); entity.setTimeouts(entityTimeouts); return entity; } catch (EntityNotFoundException e) { } catch (EntityException e) { throw new AssertionError(e); } } } else { try { ClusteredTierClientEntity entity = entityRef.fetchEntity(); entity.setClientId(clientId); entity.setStoreIdentifier(storeIdentifier); entity.setTimeouts(entityTimeouts); return entity; } catch (EntityNotFoundException e) { throw e; } catch (EntityException e) { throw new AssertionError(e); } } }

Target:
public ClusteredTierClientEntity fetchOrCreateClusteredStoreEntity(UUID clientId, String clusterTierManagerIdentifier, String storeIdentifier, ServerStoreConfiguration clientStoreConfiguration, boolean autoCreate) throws EntityNotFoundException, CachePersistenceException { EntityRef<InternalClusterTierClientEntity, ClusteredTierEntityConfiguration> entityRef; try { entityRef = connection.getEntityRef(InternalClusterTierClientEntity.class, ENTITY_VERSION, clusterTierManagerIdentifier + storeIdentifier); } catch (EntityNotProvidedException e) { throw new AssertionError(e); } if (autoCreate) { while (true) { try { entityRef.create(new ClusteredTierEntityConfiguration(clusterTierManagerIdentifier, storeIdentifier, clientStoreConfiguration)); } catch (EntityAlreadyExistsException e) { } catch (EntityConfigurationException e) { throw new CachePersistenceException("Unable to create clustered tier", e); } catch (EntityException e) { throw new AssertionError(e); } try { InternalClusterTierClientEntity entity = entityRef.fetchEntity(); entity.setClientId(clientId); entity.setStoreIdentifier(storeIdentifier); entity.setTimeouts(entityTimeouts); return entity; } catch (EntityNotFoundException e) { } catch (EntityException e) { throw new AssertionError(e); } } } else { try { InternalClusterTierClientEntity entity = entityRef.fetchEntity(); entity.setClientId(clientId); entity.setStoreIdentifier(storeIdentifier); entity.setTimeouts(entityTimeouts); return entity; } catch (EntityNotFoundException e) { throw e; } catch (EntityException e) { throw new AssertionError(e); } } }
Source:
public CompletableFuture<Void> modifyTable(TableDescriptor newDescriptor) { return getDescriptor(newDescriptor.getTableName()).thenApply(descriptor -> tableModificationAdapter .buildModifications(new HTableDescriptor(newDescriptor), new HTableDescriptor(descriptor))) .thenApply(modifications -> { modifyColumns(newDescriptor.getTableName(), modifications); return null; }); }

Target:
public CompletableFuture<Void> modifyTable(TableDescriptor newDescriptor) { return getDescriptor(newDescriptor.getTableName()).thenApply(descriptor -> tableModificationAdapter .buildModifications(new HTableDescriptor(newDescriptor), new HTableDescriptor(descriptor))) .thenApply(modifications -> { try { modifyColumns(newDescriptor.getTableName(), modifications).get(); } catch (InterruptedException | ExecutionException e) { throw new CompletionException(e); } return null; }); }
Source:
public void testPermissionsForAddingTemplateDedicatedHostChanged(){ setupDedicatedHostForVm(false); PermissionSubject editDefaultHostPermission = new PermissionSubject(spId, VdcObjectType.StoragePool, ActionGroup.EDIT_ADMIN_TEMPLATE_PROPERTIES); List<PermissionSubject> permissionCheckSubjects = cmd.getPermissionCheckSubjects(); permissionCheckSubjects.stream().filter(permissionSubject -> ActionGroup.EDIT_ADMIN_TEMPLATE_PROPERTIES.equals(permissionSubject.getActionGroup())). forEach(permissionSubject -> {verifyPermissions(editDefaultHostPermission, permissionSubject);}); }

Target:
public void testPermissionsForAddingTemplateDedicatedHostChanged(){ setupDedicatedHostForVmAndTemplate(false); PermissionSubject editDefaultHostPermission = new PermissionSubject(spId, VdcObjectType.StoragePool, ActionGroup.EDIT_ADMIN_TEMPLATE_PROPERTIES); List<PermissionSubject> permissionCheckSubjects = cmd.getPermissionCheckSubjects(); permissionCheckSubjects.stream() .filter(permissionSubject -> ActionGroup.EDIT_ADMIN_TEMPLATE_PROPERTIES == permissionSubject.getActionGroup()) .forEach(permissionSubject -> {verifyPermissions(editDefaultHostPermission, permissionSubject);}); }
Source:
@Override public boolean filter(Object context, Descriptor descriptor) { if (context instanceof MultiBranchProject && descriptor instanceof BranchPropertyDescriptor) { return ((BranchPropertyDescriptor) descriptor).isApplicable((MultiBranchProject) context); } else { return true; } }

Target:
public boolean filter(Object context, Descriptor descriptor) { if (context instanceof MultiBranchProject && descriptor instanceof BranchPropertyDescriptor) { return ((BranchPropertyDescriptor) descriptor).isApplicable((MultiBranchProject) context); } else { return true; } }
Source:
private void saveDigest(PipelineTemplate pipelineTemplate) { String digestId = String.format("%s@SHA256%s", pipelineTemplate.getId(), computeSHA256Digest(pipelineTemplate)); try { checkForDuplicatePipelineTemplate(digestId); } catch (DuplicateEntityException dee) { log.debug("Duplicate pipeline digest calculated, not updating key {}", digestId); return; } getPipelineTemplateDAO().create(digestId, pipelineTemplate); }

Target:
private void saveDigest(PipelineTemplate pipelineTemplate) { String digestId = String.format("%s@sha256:%s", pipelineTemplate.getId(), computeSHA256Digest(pipelineTemplate)); try { checkForDuplicatePipelineTemplate(digestId); } catch (DuplicateEntityException dee) { log.debug("Duplicate pipeline digest calculated, not updating key {}", digestId); return; } getPipelineTemplateDAO().create(digestId, pipelineTemplate); }
Source:
public void decrementConsumers() { if (numberOfConsumers > 0) { numberOfConsumers--; } else { ActiveMQServerLogger.LOGGER.consumerCountError("Tried to decrement consumer count below 0: " + this); } }

Target:
public void decrementConsumers() { numberOfConsumers.getAndUpdate(value -> { if (value > 0) { return value--; } else { ActiveMQServerLogger.LOGGER.consumerCountError("Tried to decrement consumer count below 0: " + this); return value; } }); }
Source:
public void initChannel(SocketChannel socket) throws IOException, NoSuchAlgorithmException, CertificateException { ChannelPipeline pipeline = socket.pipeline(); pipeline.addLast(LOGGER_HANDLER, loggingHandler); if(server.isSslEnable()) { SslHandler sslHandler = sslBuilder.build(socket.alloc()); pipeline.addLast(SSL_HANDLER, sslHandler); } pipeline.addLast(idleExecutorGroup, KEEP_ALIVE_HANDLER, new IdleStateHandler(60*15, 5, 0)); pipeline.addLast(BEATS_PARSER, new BeatsParser()); pipeline.addLast(BEATS_HANDLER, beatsHandler); }

Target:
public void initChannel(SocketChannel socket) throws IOException, NoSuchAlgorithmException, CertificateException { ChannelPipeline pipeline = socket.pipeline(); pipeline.addLast(LOGGER_HANDLER, loggingHandler); if(enableSSL) { SslHandler sslHandler = sslBuilder.build(socket.alloc()); pipeline.addLast(SSL_HANDLER, sslHandler); } pipeline.addLast(idleExecutorGroup, KEEP_ALIVE_HANDLER, new IdleStateHandler(IDLESTATE_READER_IDLE_TIME_SECONDS, IDLESTATE_WRITER_IDLE_TIME_SECONDS , IDLESTATE_ALL_IDLE_TIME_SECONDS)); pipeline.addLast(BEATS_PARSER, new BeatsParser()); pipeline.addLast("acker", new AckEncoder()); pipeline.addLast(BEATS_HANDLER, beatsHandler); }
Source:
public void onEntityDestroyed(EntityRef entity) { if (!entity.isPersistent()) { return; } entityDeltas.remove(entity.getId()); destroyedEntities.add(entity.getId()); }

Target:
public void onEntityDestroyed(EntityRef entity) { if (entity.isPersistent()) { entityDeltas.remove(entity.getId()); destroyedEntities.add(entity.getId()); } }
Source:
public CompletableSource apply(Completable upstream) { return Completable.amb( Arrays.asList( upstream, takeUntilEvent(lifecycle, event) .flatMap(Functions.CANCEL_COMPLETABLE) .ignoreElements() ) ); }

Target:
public CompletableSource apply(Completable upstream) { return Completable.ambArray( upstream, takeUntilEvent(lifecycle, event) .flatMap(Functions.CANCEL_COMPLETABLE) .ignoreElements() ); }
Source:
public void process(Region region, EntityBuffer buffer) { if (region.getRegion().encompasses(0, 64, 276)) { Prefab chooseFactionNpc = Assets.getPrefab("LightAndShadow:MagicFool").get(); EntityStore entity = new EntityStore(chooseFactionNpc); entity.addComponent(new LocationComponent(new Vector3f(0, 61, 276))); buffer.enqueue(entity); Prefab beaconMark = Assets.getPrefab("BeaconMark").get(); EntityStore entityStore = new EntityStore(beaconMark); entityStore.addComponent(new LocationComponent(new Vector3f(0, 63, 276))); buffer.enqueue(entityStore); } }

Target:
public void process(Region region, EntityBuffer buffer) { if (region.getRegion().encompasses( 0, LASUtils.FLOATING_PLATFORM_HEIGHT_LEVEL + 4, LASUtils.FLOATING_PLATFORM_POSITION.z + LASUtils.NPC_OFFSET)) { Prefab chooseFactionNpc = Assets.getPrefab("LightAndShadow:MagicFool").get(); EntityStore entity = new EntityStore(chooseFactionNpc); entity.addComponent(new LocationComponent(new Vector3f( 0, LASUtils.FLOATING_PLATFORM_HEIGHT_LEVEL + 1, LASUtils.FLOATING_PLATFORM_POSITION.z + LASUtils.NPC_OFFSET))); buffer.enqueue(entity); Prefab beaconMark = Assets.getPrefab("BeaconMark").get(); EntityStore entityStore = new EntityStore(beaconMark); entityStore.addComponent(new LocationComponent(new Vector3f( 0, LASUtils.FLOATING_PLATFORM_HEIGHT_LEVEL + 3, LASUtils.FLOATING_PLATFORM_POSITION.z + LASUtils.NPC_OFFSET))); buffer.enqueue(entityStore); } }