auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void buildAntProject(Path path) { File buildFile = new File(path.toString() + File.separatorChar + "build.xml"); Project buildProject = new Project(); buildProject.setUserProperty("ant.file", buildFile.getAbsolutePath()); buildProject.init(); buildProject.setBaseDir(path.toAbsolutePath().toFile()); DefaultLogger logger = new DefaultLogger(); logger.setErrorPrintStream(System.err); logger.setOutputPrintStream(System.out); logger.setMessageOutputLevel(Project.MSG_ERR); buildProject.addBuildListener(logger); try { buildProject.fireBuildStarted(); ProjectHelper helper = ProjectHelper.getProjectHelper(); buildProject.addReference("ant.projectHelper", helper); helper.parse(buildProject, buildFile); buildProject.executeTarget("compile-test"); buildProject.fireBuildFinished(null); } catch (BuildException e) { buildProject.fireBuildFinished(e); } }

Target:
protected boolean buildAntProject(Path path) { final File buildFile = new File(path.toString() + File.separatorChar + "build.xml"); final File buildLog; Project buildProject = new Project(); buildProject.setUserProperty("ant.file", buildFile.getAbsolutePath()); buildProject.setProperty("javac.fork", "true"); buildProject.init(); buildProject.setBaseDir(path.toAbsolutePath().toFile()); try { DefaultLogger logger = new DefaultLogger(); buildLog = new File(path.toString(), "build_log.txt"); PrintStream errorPrintStream = new PrintStream(buildLog); logger.setErrorPrintStream(errorPrintStream); logger.setOutputPrintStream(System.out); logger.setMessageOutputLevel(Project.MSG_ERR); buildProject.addBuildListener(logger); try { buildProject.fireBuildStarted(); ProjectHelper helper = ProjectHelper.getProjectHelper(); buildProject.addReference("ant.projectHelper", helper); helper.parse(buildProject, buildFile); buildProject.executeTarget("compile-test"); buildProject.fireBuildFinished(null); return true; } catch (BuildException e) { buildProject.fireBuildFinished(e); buildRunResult = new RunResult(Status.COMPILE_FAILED, ImmutableList.copyOf(new ArrayList<TestResult>()), new ImmutableMap.Builder<String, byte[]>().put(SpecialLogs.COMPILER_OUTPUT, Files.readAllBytes(buildLog.toPath())).build()); return false; } } catch (IOException e) { throw Throwables.propagate(e); } }
Source:
private static <K, V> CacheNotifier<K, V> blockNotifierPartitionStatusChanged(final CheckPoint checkPoint, Cache<K, V> cache) { return Mocks.blockingMock(checkPoint, CacheNotifier.class, cache, (stub, m) -> stub.when(m).notifyPartitionStatusChanged(eq(AvailabilityMode.DEGRADED_MODE), eq(false))); }

Target:
private static <K, V> void blockNotifierPartitionStatusChanged(final CheckPoint checkPoint, Cache<K, V> cache) { Mocks.blockingMock(checkPoint, CacheNotifier.class, cache, (stub, m) -> stub.when(m).notifyPartitionStatusChanged(eq(AvailabilityMode.DEGRADED_MODE), eq(false))); }
Source:
public void onUpgrade(SQLiteDatabase db, int oldVersion) throws SQLException { switch (oldVersion) { case 1: upgradeToVersion2(db); case 2: case 3: upgradeToVersion4(db, oldVersion); case 4: upgradeToVersion5(db); case 5: upgradeToVersion6(db); case 6: upgradeToVersion7(db); case 7: upgradeToVersion8(db); break; case 8: upgradeToVersion9(db); default: Timber.i("Unknown version %s", oldVersion); } }

Target:
public void onUpgrade(SQLiteDatabase db, int oldVersion) throws SQLException { switch (oldVersion) { case 1: upgradeToVersion2(db); case 2: case 3: upgradeToVersion4(db, oldVersion); case 4: upgradeToVersion5(db); case 5: upgradeToVersion6(db); case 6: upgradeToVersion7(db); case 7: upgradeToVersion8(db); case 8: upgradeToVersion9(db); } }
Source:
public void loadIds(Map<ResourceLocation, Integer> ids, Map<ResourceLocation, Integer> missingIds, Map<ResourceLocation, Integer[]> remappedIds, FMLControlledNamespacedRegistry<I> currentRegistry, ResourceLocation registryName) { for (Map.Entry<ResourceLocation, Integer> entry : ids.entrySet()) { ResourceLocation itemName = entry.getKey(); int newId = entry.getValue(); int currId = currentRegistry.getId(itemName); if (currId == -1) { FMLLog.info("Found a missing id from the world %s", itemName); if(!itemName.getResourceDomain().equals("minecraft")) { missingIds.put(itemName, newId); } else { FMLLog.fine("Ignoring missing vanilla id as minecraft will probably take care of it"); } continue; } else if (currId != newId) { FMLLog.fine("Fixed %s id mismatch %s: %d (init) -> %d (map).", registryName, itemName, currId, newId); remappedIds.put(itemName, new Integer[] {currId, newId}); } I obj = currentRegistry.getRaw(itemName); I sub = obj; if (currentRegistry.substitutionOriginals.containsKey(itemName)) { obj = currentRegistry.substitutionOriginals.get(itemName); } add(newId, itemName, obj); if (currentRegistry.substitutionOriginals.containsKey(itemName) && substitutionCallback != null) { substitutionCallback.onSubstituteActivated(slaves, sub, obj, itemName); } } }

Target:
public void loadIds(Map<ResourceLocation, Integer> ids, Map<ResourceLocation, Integer> missingIds, Map<ResourceLocation, Integer[]> remappedIds, FMLControlledNamespacedRegistry<I> currentRegistry, ResourceLocation registryName) { for (Map.Entry<ResourceLocation, Integer> entry : ids.entrySet()) { ResourceLocation itemName = entry.getKey(); int newId = entry.getValue(); int currId = currentRegistry.getId(itemName); if (currId == -1) { FMLLog.info("Found a missing id from the world %s", itemName); missingIds.put(itemName, newId); continue; } else if (currId != newId) { FMLLog.fine("Fixed %s id mismatch %s: %d (init) -> %d (map).", registryName, itemName, currId, newId); remappedIds.put(itemName, new Integer[] {currId, newId}); } I obj = currentRegistry.getRaw(itemName); I sub = obj; if (currentRegistry.substitutionOriginals.containsKey(itemName)) { obj = currentRegistry.substitutionOriginals.get(itemName); } add(newId, itemName, obj); if (currentRegistry.substitutionOriginals.containsKey(itemName) && substitutionCallback != null) { substitutionCallback.onSubstituteActivated(slaves, sub, obj, itemName); } } }
Source:
public Integer addMail(PerunSession sess, ApplicationForm form, ApplicationMail mail) throws PerunException { if (form.getGroup() != null) { if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, form.getVo()) && !AuthzResolver.isAuthorized(sess, Role.GROUPADMIN, form.getGroup())) { throw new PrivilegeException(sess, "addMail"); } } else { if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, form.getVo())) { throw new PrivilegeException(sess, "addMail"); } } int id = Utils.getNewId(jdbc, "APPLICATION_MAILS_ID_SEQ"); mail.setId(id); try { jdbc.update("insert into application_mails(id, form_id, app_type, mail_type, send) values (?,?,?,?,?)", mail.getId(), form.getId(), mail.getAppType().toString(), mail.getMailType().toString(), mail.getSend() ? "1" : "0"); } catch (DuplicateKeyException e) { throw new ApplicationMailExistsException("Application mail already exists.", mail); } for (Locale loc : mail.getMessage().keySet()) { try { jdbc.update("insert into application_mail_texts(mail_id,locale,subject,text) values (?,?,?,?)", mail.getId(), loc.toString(), mail.getMessage(loc).getSubject(), mail.getMessage(loc).getText()); } catch (DuplicateKeyException e) { throw new ApplicationMailExistsException("Application mail already exists.", mail); } } log.info("[MAIL MANAGER] Mail notification definition created: {}", mail); if (form.getGroup() != null) { perun.getAuditer().log(sess, new MailForGroupIdAdded(mail,form.getGroup())); } else { perun.getAuditer().log(sess, new MailForVoIdAdded(mail, form.getVo())); } return id; }

Target:
public Integer addMail(PerunSession sess, ApplicationForm form, ApplicationMail mail) throws ApplicationMailExistsException, PrivilegeException { if (form.getGroup() != null) { if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, form.getVo()) && !AuthzResolver.isAuthorized(sess, Role.GROUPADMIN, form.getGroup())) { throw new PrivilegeException(sess, "addMail"); } } else { if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, form.getVo())) { throw new PrivilegeException(sess, "addMail"); } } int id = Utils.getNewId(jdbc, "APPLICATION_MAILS_ID_SEQ"); mail.setId(id); try { jdbc.update("insert into application_mails(id, form_id, app_type, mail_type, send) values (?,?,?,?,?)", mail.getId(), form.getId(), mail.getAppType().toString(), mail.getMailType().toString(), mail.getSend() ? "1" : "0"); } catch (DuplicateKeyException e) { throw new ApplicationMailExistsException("Application mail already exists.", mail); } for (Locale loc : mail.getMessage().keySet()) { try { jdbc.update("insert into application_mail_texts(mail_id,locale,subject,text) values (?,?,?,?)", mail.getId(), loc.toString(), mail.getMessage(loc).getSubject(), mail.getMessage(loc).getText()); } catch (DuplicateKeyException e) { throw new ApplicationMailExistsException("Application mail already exists.", mail); } } log.info("[MAIL MANAGER] Mail notification definition created: {}", mail); if (form.getGroup() != null) { perun.getAuditer().log(sess, new MailForGroupIdAdded(mail,form.getGroup())); } else { perun.getAuditer().log(sess, new MailForVoIdAdded(mail, form.getVo())); } return id; }
Source:
public void testSwitchingBetweenBrushAndEraser() throws SecurityException, IllegalArgumentException, NoSuchFieldException, IllegalAccessException { assertTrue("Waiting for DrawingSurface", mSolo.waitForView(DrawingSurface.class, 1, TIMEOUT)); PointF screenPoint = new PointF(mScreenWidth / 2, mScreenHeight / 2); PointF canvasPoint = Utils.getCanvasPointFromScreenPoint(screenPoint); ((Bitmap) PrivateAccess.getMemberValue(DrawingSurface.class, PaintroidApplication.drawingSurface, "mWorkingBitmap")).eraseColor(Color.BLACK); int colorBeforeErase = PaintroidApplication.drawingSurface.getPixel(canvasPoint); assertEquals("After painting black, pixel should be black", Color.BLACK, colorBeforeErase); selectTool(ToolType.ERASER); mSolo.clickOnScreen(screenPoint.x, screenPoint.y); mSolo.sleep(SHORT_TIMEOUT); int colorAfterErase = PaintroidApplication.drawingSurface.getPixel(canvasPoint); assertEquals("After erasing, pixel should be transparent again", Color.TRANSPARENT, colorAfterErase); selectTool(ToolType.BRUSH); mSolo.clickOnScreen(screenPoint.x, screenPoint.y); mSolo.sleep(1000); int colorAfterBrush = PaintroidApplication.drawingSurface.getPixel(canvasPoint); assertEquals("Brushing after erase should be black again like before erasing", Color.BLACK, colorAfterBrush); selectTool(ToolType.ERASER); mSolo.clickOnScreen(screenPoint.x, screenPoint.y); mSolo.sleep(SHORT_TIMEOUT); colorAfterErase = PaintroidApplication.drawingSurface.getPixel(canvasPoint); assertEquals("After erasing, pixel should be transparent again", Color.TRANSPARENT, colorAfterErase); }

Target:
public void testSwitchingBetweenBrushAndEraser() throws SecurityException, IllegalArgumentException, NoSuchFieldException, IllegalAccessException { assertTrue("Waiting for DrawingSurface", mSolo.waitForView(DrawingSurface.class, 1, TIMEOUT)); PointF screenPoint = new PointF(mScreenWidth / 2, mScreenHeight / 2); PointF canvasPoint = Utils.getCanvasPointFromScreenPoint(screenPoint); ((Bitmap) PrivateAccess.getMemberValue(DrawingSurface.class, PaintroidApplication.drawingSurface, "mWorkingBitmap")).eraseColor(Color.BLACK); int colorBeforeErase = PaintroidApplication.drawingSurface.getPixel(canvasPoint); assertEquals("After painting black, pixel should be black", Color.BLACK, colorBeforeErase); selectTool(ToolType.ERASER); mSolo.clickOnScreen(screenPoint.x, screenPoint.y); mSolo.sleep(SHORT_TIMEOUT); int colorAfterErase = PaintroidApplication.drawingSurface.getPixel(canvasPoint); assertEquals("After erasing, pixel should be transparent again", Color.TRANSPARENT, colorAfterErase); selectTool(ToolType.BRUSH); mSolo.clickOnScreen(screenPoint.x, screenPoint.y); mSolo.sleep(MEDIUM_TIMEOUT); int colorAfterBrush = PaintroidApplication.drawingSurface.getPixel(canvasPoint); assertEquals("Brushing after erase should be black again like before erasing", Color.BLACK, colorAfterBrush); selectTool(ToolType.ERASER); mSolo.clickOnScreen(screenPoint.x, screenPoint.y); mSolo.sleep(SHORT_TIMEOUT); colorAfterErase = PaintroidApplication.drawingSurface.getPixel(canvasPoint); assertEquals("After erasing, pixel should be transparent again", Color.TRANSPARENT, colorAfterErase); }
Source:
public NexusUnexpectedResponseException( final int statusCode, final String statusMessage ) { this( statusCode, statusMessage, String.format( "Unexpected response: %s %s", String.valueOf( statusCode ), String.valueOf( statusMessage ) ) ); }

Target:
public NexusUnexpectedResponseException( final int statusCode, final String statusMessage ) { this( statusCode, statusMessage, String.format( "Unexpected response: %s %s", statusCode, statusMessage ) ); }
Source:
public Page getPageById(Long id) { return pageRepository.findById(id).orElseThrow(() -> new RestException("Not found", 404)); }

Target:
public Page getPageById(Long id) { return pageRepository.findById(id).orElseThrow(() -> new RestException("Not found", HttpServletResponse.SC_NOT_FOUND)); }
Source:
public RqFake(final List<String> head, final InputStream body) { super( new RqOf( () -> Collections.unmodifiableList(head), () -> body ) ); }

Target:
public RqFake(final List<String> head, final InputStream body) { super(new RequestOf(Collections.unmodifiableList(head), body)); }
Source:
public List<String> getSecurityGroups() { return this.configuration.get(List.class, "security:groups", new ArrayList()); }

Target:
public List<String> getSecurityGroups() { return this.configuration.get(List.class, SECURITY_GROUPS, new ArrayList()); }
Source:
public boolean isTrue(State state, String[] params) { ObjectInstance tool = state.getObject(params[1]); ObjectInstance container = state.getObject(params[2]); Set<String> contents = ContainerFactory.getContentNames(container); if (!params[2].equalsIgnoreCase("")) { if (contents.isEmpty()) { return false; } ObjectInstance ingredient; for (String name : contents) { ingredient = state.getObject(name); boolean match = false; for (IngredientRecipe content : this.topLevelIngredient.getConstituentIngredients()) { if (content.getName().equals(ingredient.getName())) { if (!ToolFactory.toolCanBeUsed(tool, content)) { return false; } if (!ToolFactory.toolHasBeenUsed(tool, content)) { return false; } match = true; break; } } if (!match) { AbstractMap<String, IngredientRecipe> necessaryTraits = this.topLevelIngredient.getNecessaryTraits(); Set<String> toMeltTraits = IngredientFactory.getTraits(ingredient); for (String trait : necessaryTraits.keySet()) { if (toMeltTraits.contains(trait)) { IngredientRecipe ing = necessaryTraits.get(trait); if (ToolFactory.toolCanBeUsed(tool, ing) && ToolFactory.toolHasBeenUsed(tool, ing)) { match = true; break; } } } if (!match) { return false; } } } return true; } else { for (IngredientRecipe content : topLevelIngredient.getConstituentIngredients()) { if (ToolFactory.toolHasBeenUsed(tool, content)) { return true; } } AbstractMap<String, IngredientRecipe> traitMap = topLevelIngredient.getConstituentNecessaryTraits(); for (String trait : traitMap.keySet()) { if (ToolFactory.toolHasBeenUsed(tool, traitMap.get(trait))) { return true; } } return false; } }

Target:
public boolean isTrue(State state, String[] params) { ObjectInstance tool = state.getObject(params[1]); return this.recipe.getRecipeToolAttributes().contains(ToolFactory.getToolAttribute(tool)); }
Source:
public static boolean isFreePlan(long planID) { return planID == 2002 || planID == 1; }

Target:
public static boolean isFreePlan(long planID) { return planID == PlansConstants.JETPACK_FREE_PLAN_ID || planID == PlansConstants.FREE_PLAN_ID; }
Source:
private boolean restore(PageStoreOptions options) { LOG.info("Attempt to restore PageStore with {}", options); Path rootDir = Paths.get(options.getRootDir()); if (!Files.exists(rootDir)) { LOG.error("Failed to restore PageStore: Directory does not exist", rootDir); return false; } long discardedPages = 0; long discardedBytes = 0; try (Stream<PageInfo> stream = mPageStore.getPages()) { Iterator<PageInfo> iterator = stream.iterator(); while (iterator.hasNext()) { PageInfo pageInfo = iterator.next(); if (pageInfo == null) { LOG.error("Invalid page info"); return false; } PageId pageId = pageInfo.getPageId(); ReadWriteLock pageLock = getPageLock(pageId); try (LockResource r = new LockResource(pageLock.readLock())) { boolean enoughSpace; try (LockResource r2 = new LockResource(mMetaLock.writeLock())) { enoughSpace = mMetaStore.bytes() + pageInfo.getPageSize() <= mPageStore.getCacheSize(); if (enoughSpace) { mMetaStore.addPage(pageId, pageInfo); } } if (!enoughSpace) { mPageStore.delete(pageId); discardedPages++; discardedBytes += pageInfo.getPageSize(); } } } } catch (Exception e) { LOG.error("Failed to restore PageStore", e); return false; } LOG.info("Complete Restored PageStore with pages ({} bytes), discarded pages ({} bytes)", mMetaStore.pages(), mMetaStore.bytes(), discardedPages, discardedBytes); return true; }

Target:
private boolean restore(PageStoreOptions options) { LOG.info("Attempt to restore PageStore with {}", options); Path rootDir = Paths.get(options.getRootDir()); if (!Files.exists(rootDir)) { LOG.error("Failed to restore PageStore: Directory does not exist", rootDir); return false; } long discardedPages = 0; long discardedBytes = 0; try (Stream<PageInfo> stream = mPageStore.getPages()) { Iterator<PageInfo> iterator = stream.iterator(); while (iterator.hasNext()) { PageInfo pageInfo = iterator.next(); if (pageInfo == null) { LOG.error("Failed to restore PageStore: Invalid page info"); return false; } PageId pageId = pageInfo.getPageId(); ReadWriteLock pageLock = getPageLock(pageId); try (LockResource r = new LockResource(pageLock.writeLock())) { boolean enoughSpace; try (LockResource r2 = new LockResource(mMetaLock.writeLock())) { enoughSpace = mMetaStore.bytes() + pageInfo.getPageSize() <= mPageStore.getCacheSize(); if (enoughSpace) { mMetaStore.addPage(pageId, pageInfo); } } if (!enoughSpace) { mPageStore.delete(pageId); discardedPages++; discardedBytes += pageInfo.getPageSize(); } } } } catch (Exception e) { LOG.error("Failed to restore PageStore: ", e); return false; } LOG.info("Successfully restored PageStore with pages ({} bytes), " + "discarded pages ({} bytes)", mMetaStore.pages(), mMetaStore.bytes(), discardedPages, discardedBytes); return true; }
Source:
void checkExpiration() { if (!active.get()) { return; } final Timestamp currentTime = Timestamps.getCurrentTime(); if (Timestamps.compare(currentTime, expirationTime) > 0) { log().warn( "Completing bulk write operation before all the events are processed. Took at least seconds.", expirationTime.getSeconds()); complete(); } }

Target:
void checkExpiration() { if (!isInProgress()) { return; } final Timestamp currentTime = Timestamps.getCurrentTime(); if (Timestamps.compare(currentTime, expirationTime) > 0) { log().warn("Completing bulk write operation before all the events are processed."); complete(); } }
Source:
public void savePatientOnThread(UserContext ctx, Patient patient) { Context.setUserContext(ctx); Context.openSessionWithCurrentUser(); authenticate(); PatientIdentifier patientIdentifier = new PatientIdentifier("103-9", new PatientIdentifierType(1), new Location(1)); patientIdentifier.setPreferred(true); patient.addIdentifier(patientIdentifier); try { patientService.savePatient(patient); } catch(org.openmrs.api.IdentifierNotUniqueException e) { isSavePatientThreadsafe.set(true); } Context.closeSessionWithCurrentUser(); }

Target:
public void savePatientOnThread(UserContext ctx, Patient patient) { Context.setUserContext(ctx); Context.openSessionWithCurrentUser(); authenticate(); PatientIdentifier patientIdentifier = new PatientIdentifier("103-9", new PatientIdentifierType(1), new Location(1)); patientIdentifier.setPreferred(true); patient.addIdentifier(patientIdentifier); try { patientService.savePatient(patient); } catch(org.openmrs.api.IdentifierNotUniqueException e) { isSavePatientThreadUnSafe.set(true); } Context.closeSessionWithCurrentUser(); }
Source:
public void visitDistanceType(VisitableElement<Double> visitable) { Double value = visitable.getValue(); if (value == null) { LOGGER.debug("No values found on distance type"); return; } builder.setDistance(value); }

Target:
public void visitDistanceType(VisitableElement<Double> visitable) { super.visitDistanceType(visitable); Double value = visitable.getValue(); if (value == null) { LOGGER.debug("No values found on distance type"); return; } builder.setDistance(value); }
Source:
public Bundle performBitstreamMove(Context context, Bitstream bitstream, Bundle targetBundle) throws SQLException, IOException, AuthorizeException { if (bitstream.getBundles().contains(targetBundle)) { throw new DSpaceBadRequestException("The provided bitstream is already in the target bundle"); } List<Bundle> bundles = new LinkedList<>(); bundles.addAll(bitstream.getBundles()); if (hasSufficientMovePermissions(context, bundles, targetBundle)) { bundleService.addBitstream(context, targetBundle, bitstream); bundleService.update(context, targetBundle); for (Bundle bundle : bundles) { bundleService.removeBitstream(context, bundle, bitstream); bundleService.update(context, bundle); } } return targetBundle; }

Target:
public Bundle performBitstreamMove(Context context, Bitstream bitstream, Bundle targetBundle) throws SQLException, IOException, AuthorizeException { if (bitstream.getBundles().contains(targetBundle)) { throw new DSpaceBadRequestException("The provided bitstream is already in the target bundle"); } bundleService.moveBitstreamToBundle(context, targetBundle, bitstream); return targetBundle; }
Source:
public void handleRequest(Conveyor conv) throws GeoWebCacheException { ConveyorKMLTile tile = (ConveyorKMLTile) conv; TileLayer layer; if (tile.getHint() == HINT_DEBUGGRID) { layer = KMLDebugGridLayer.getInstance(); if (tile.getWrapperMimeType() == null) { tile.setTileLayer(layer); try { layer.getTile(tile); } catch (Exception e) { e.printStackTrace(); } String mimeStr = getMimeTypeOverride(tile); writeTileResponse(tile, false, stats, mimeStr); return; } } else if (tile.getHint() == HINT_SITEMAP_GLOBAL) { layer = null; } else { layer = tld.getTileLayer(tile.getLayerId()); if (layer == null) { throw new ServiceException("No layer provided, request parsed to: " + tile.getLayerId()); } } tile.setTileLayer(layer); if(Objects.nonNull(tile.getLayer())) { if(tile.getTileIndex()[2]<0) { secDispatcher.checkSecurity(tile.getLayer(), null, null); } else { secDispatcher.checkSecurity(tile); } } if (tile.getTileIndex()[2] == -1) { if (log.isDebugEnabled()) { log.debug("Request for super overlay for " + tile.getLayerId() + " received"); } handleSuperOverlay(tile); } else { if (log.isDebugEnabled()) { log.debug("Request for overlay for " + tile.getLayerId()); } handleOverlay(tile); } }

Target:
public void handleRequest(Conveyor conv) throws GeoWebCacheException { ConveyorKMLTile tile = (ConveyorKMLTile) conv; TileLayer layer; if (tile.getHint() == HINT_DEBUGGRID) { layer = KMLDebugGridLayer.getInstance(); if (tile.getWrapperMimeType() == null) { tile.setTileLayer(layer); try { layer.getTile(tile); } catch (Exception e) { e.printStackTrace(); } String mimeStr = getMimeTypeOverride(tile); writeTileResponse(tile, false, stats, mimeStr); return; } } else if (tile.getHint() == HINT_SITEMAP_GLOBAL) { layer = null; } else { layer = tld.getTileLayer(tile.getLayerId()); if (layer == null) { throw new ServiceException("No layer provided, request parsed to: " + tile.getLayerId()); } } tile.setTileLayer(layer); if(Objects.nonNull(tile.getLayer())) { if(tile.getTileIndex()[2]<0) { getSecurityDispatcher().checkSecurity(tile.getLayer(), null, null); } else { getSecurityDispatcher().checkSecurity(tile); } } if (tile.getTileIndex()[2] == -1) { if (log.isDebugEnabled()) { log.debug("Request for super overlay for " + tile.getLayerId() + " received"); } handleSuperOverlay(tile); } else { if (log.isDebugEnabled()) { log.debug("Request for overlay for " + tile.getLayerId()); } handleOverlay(tile); } }
Source:
public void maxUrisTestWithQueryTask() { DataMovementManager dmManager = client.newDataMovementManager(); List<String> outputUris = Collections.synchronizedList(new ArrayList<String>()); DocumentMetadataHandle documentMetadata = new DocumentMetadataHandle().withCollections("maxUrisTest"); WriteBatcher batcher = moveMgr.newWriteBatcher().withDefaultMetadata(documentMetadata); moveMgr.startJob(batcher); for(int i=0; i<100; i++) { batcher.addAs("test"+i+".txt", new StringHandle().with("Test"+i)); } batcher.flushAndWait(); moveMgr.stopJob(batcher); AtomicInteger counter = new AtomicInteger(0); QueryBatcher queryBatcher = dmManager.newQueryBatcher(new StructuredQueryBuilder().collection("maxUrisTest")); int forest_count = queryBatcher.getForestConfig().listForests().length; int maxBatches = forest_count-1; queryBatcher.setMaxBatches(maxBatches); queryBatcher.withBatchSize(10) .onUrisReady(batch -> { outputUris.addAll(Arrays.asList(batch.getItems())); counter.incrementAndGet(); }) .onQueryFailure((QueryBatchException failure) -> { System.out.println(failure.getMessage()); }); dmManager.startJob(queryBatcher); queryBatcher.awaitCompletion(); dmManager.stopJob(queryBatcher); assertTrue("Counter value not as expected", (counter.get() >= maxBatches) && (counter.get()<= (forest_count+maxBatches))); assertTrue("Output list does not contain expected number of outputs", (outputUris.size() >= (maxBatches*10)) && outputUris.size()<= (10*(forest_count+maxBatches))); }

Target:
public void maxUrisTestWithQueryTask() { DataMovementManager dmManager = client.newDataMovementManager(); List<String> outputUris = Collections.synchronizedList(new ArrayList<String>()); DocumentMetadataHandle documentMetadata = new DocumentMetadataHandle().withCollections("maxUrisTest"); WriteBatcher batcher = moveMgr.newWriteBatcher().withDefaultMetadata(documentMetadata); int forests = batcher.getForestConfig().listForests().length; int batchSize = 10; moveMgr.startJob(batcher); for(int i=0; i<((forests+2)*batchSize); i++) { batcher.addAs("test"+i+".txt", new StringHandle().with("Test"+i)); } batcher.flushAndWait(); moveMgr.stopJob(batcher); AtomicInteger counter = new AtomicInteger(0); QueryBatcher queryBatcher = dmManager.newQueryBatcher(new StructuredQueryBuilder().collection("maxUrisTest")); int forest_count = queryBatcher.getForestConfig().listForests().length; queryBatcher.setMaxBatches(1); queryBatcher.withBatchSize(batchSize) .onUrisReady(batch -> { outputUris.addAll(Arrays.asList(batch.getItems())); counter.incrementAndGet(); }) .onQueryFailure((QueryBatchException failure) -> { System.out.println(failure.getMessage()); }); dmManager.startJob(queryBatcher); queryBatcher.awaitCompletion(); dmManager.stopJob(queryBatcher); assertTrue("Counter value not as expected", (counter.get() >= 1) && (counter.get()<= (forest_count+1))); assertTrue("Output list does not contain expected number of outputs", (outputUris.size() >= 10) && outputUris.size()<= (10*(forest_count+1))); }
Source:
void dispatchAirplaneModeChange(boolean airplaneMode) { handler.sendMessage(handler.obtainMessage(AIRPLANE_MODE_CHANGE, airplaneMode ? 1 : 0, 0)); }

Target:
void dispatchAirplaneModeChange(boolean airplaneMode) { handler.sendMessage(handler.obtainMessage(AIRPLANE_MODE_CHANGE, airplaneMode ? AIRPLANE_MODE_ON : AIRPLANE_MODE_OFF, 0)); }
Source:
static void schedule(Event event) { QUEUE.add(event); if (ENABLED) { if (QUEUE.size() >= MAX_QUEUE_SIZE) { sendAllScheduled(); } else { TIMER.cancel(); TIMER = new Timer(); TIMER.schedule(new Task(), WAIT_MS); } } }

Target:
static synchronized void schedule(Event event) { if (ENABLED || QUEUE.size() <= MAX_QUEUE_SIZE) { QUEUE.add(event); } if (ENABLED) { if (QUEUE.size() >= MAX_QUEUE_SIZE) { sendAllScheduled(); } else { TIMER.cancel(); TIMER.purge(); TIMER = new Timer(); TIMER.schedule(new Task(), WAIT_MS); } } }
Source:
public void verifyReadyForGodMode() { if (!inst().isDevServer()) { Assumption.fail("God mode regeneration works only in dev server."); } if (areTestAccountsDefaultValues()) { Assumption.fail("Please change ALL the default accounts in test.properties in order to use God mode," + "e.g change test.student1.account from alice.tmms to alice.tmms.example"); } if (!areAllTestAccountsDifferent()) { Assumption.fail("ALL test accounts used must be different, including after truncation, " + "e.g veryveryveryveryverylong and veryveryveryveryverylengthy are not " + "accepted as two different accounts."); } if (!areAppUrlsDifferent()) { Assumption.fail("App URLs defined in test.properties and build.properties must be different, " + "and neither one can be a substring of the other, e.g localhost:8888 and " + "localhost:88889 are not accepted as two different app URLs."); } }

Target:
public void verifyReadyForGodMode() { if (!inst().isDevServer()) { Assumption.fail("God mode regeneration works only in dev server."); } if (!areTestAccountsReadyForGodMode()) { Assumption.fail("Please append a unique id (e.g your name) to each of the default account in" + "test.properties in order to use God mode, e.g change alice.tmms to " + "alice.tmms.<yourName>, charlie.tmms to charlie.tmms.<yourName>, etc."); } if (!areAppUrlsDifferent()) { Assumption.fail("App URLs defined in test.properties and build.properties must be different, " + "and neither one can be a substring of the other, e.g localhost:8888 as " + "the URL in test.properties, and localhost:88889 as the URL in build.properties, " + "or vice versa, is not an acceptable combination."); } }
Source:
public void testTargetBranch() throws Exception { Repository remoteDb = createBareRepository(); Repository tempDb = createWorkRepository(); try { StringBuilder xmlContent = new StringBuilder(); xmlContent .append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n") .append("<manifest>") .append("<remote name=\"remote1\" fetch=\".\" />") .append("<default revision=\"master\" remote=\"remote1\" />") .append("<project path=\"foo\" name=\"").append(defaultUri) .append("\" />").append("</manifest>"); JGitTestUtil.writeTrashFile(tempDb, "manifest.xml", xmlContent.toString()); RepoCommand command = new RepoCommand(remoteDb); command.setPath( tempDb.getWorkTree().getAbsolutePath() + "/manifest.xml") .setURI(rootUri).setTargetBranch("test").call(); File directory = createTempDirectory("testBareRepo"); Repository localDb = Git .cloneRepository().setDirectory(directory).setBranch("test") .setURI(remoteDb.getDirectory().toURI().toString()).call() .getRepository(); File gitmodules = new File(localDb.getWorkTree(), ".gitmodules"); assertTrue("The .gitmodules file should exist", gitmodules.exists()); BufferedReader reader = new BufferedReader(new FileReader( gitmodules)); String content = reader.readLine(); reader.close(); assertEquals( "The first line of .gitmodules file should be as expected", "[submodule \"foo\"]", content); String gitlink = localDb.resolve(Constants.R_HEADS + "test:foo").name(); localDb.close(); String remote = defaultDb.resolve(Constants.HEAD).name(); assertEquals("The gitlink should be the same as remote head", remote, gitlink); } finally { tempDb.close(); remoteDb.close(); } }

Target:
public void testTargetBranch() throws Exception { try ( Repository remoteDb1 = createBareRepository(); Repository remoteDb2 = createBareRepository(); Repository tempDb = createWorkRepository()) { StringBuilder xmlContent = new StringBuilder(); xmlContent .append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n") .append("<manifest>") .append("<remote name=\"remote1\" fetch=\".\" />") .append("<default revision=\"master\" remote=\"remote1\" />") .append("<project path=\"foo\" name=\"").append(defaultUri) .append("\" />").append("</manifest>"); JGitTestUtil.writeTrashFile(tempDb, "manifest.xml", xmlContent.toString()); RepoCommand command = new RepoCommand(remoteDb1); command .setPath(tempDb.getWorkTree().getAbsolutePath() + "/manifest.xml") .setURI(rootUri) .setTargetBranch("test") .call(); ObjectId branchId = remoteDb1.resolve( Constants.R_HEADS + "test^{tree}"); command = new RepoCommand(remoteDb2); command .setPath(tempDb.getWorkTree().getAbsolutePath() + "/manifest.xml") .setURI(rootUri) .call(); ObjectId defaultId = remoteDb2.resolve(Constants.HEAD + "^{tree}"); assertEquals( "The tree id of branch db and default db should be the same", branchId, defaultId); } }
Source:
private void init() throws Exception { mainFrame = new JFrame("Image drawer example"); mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); String localDataPath = DownloaderUtility.DATAEXAMPLES.Download(); originalImage = ImageIO.read(new File(localDataPath, "Mona_Lisa.png")); BufferedImage generatedImage = new BufferedImage(originalImage.getWidth(), originalImage.getHeight(), originalImage.getType()); int width = originalImage.getWidth(); int height = originalImage.getHeight(); final JLabel originalLabel = new JLabel(new ImageIcon(originalImage)); generatedLabel = new JLabel(new ImageIcon(generatedImage)); originalLabel.setBounds(0,0, width, height); generatedLabel.setBounds(width, 0, width, height); mainFrame.add(originalLabel); mainFrame.add(generatedLabel); mainFrame.setSize(2*width, height +25); mainFrame.setLayout(null); mainFrame.setVisible(true); j2dNil = new Java2DNativeImageLoader(); nn = createNN(); xyOut = calcGrid(); INDArray imageMat = j2dNil.asMatrix(originalImage).castTo(DataType.DOUBLE).div(255.0); blueMat = imageMat .tensorAlongDimension(1, 0, 2, 3).reshape(width * height, 1); greenMat = imageMat .tensorAlongDimension(2, 0, 2, 3).reshape(width * height, 1); redMat = imageMat .tensorAlongDimension(3, 0, 2, 3).reshape(width * height, 1); SwingUtilities.invokeLater(this::onCalc); }

Target:
private void init() throws Exception { mainFrame = new JFrame("Image drawer example"); mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); String localDataPath = DownloaderUtility.DATAEXAMPLES.Download(); originalImage = ImageIO.read(new File(localDataPath, "Mona_Lisa.png")); BufferedImage generatedImage = new BufferedImage(originalImage.getWidth(), originalImage.getHeight(), originalImage.getType()); int width = originalImage.getWidth(); int height = originalImage.getHeight(); final JLabel originalLabel = new JLabel(new ImageIcon(originalImage)); generatedLabel = new JLabel(new ImageIcon(generatedImage)); originalLabel.setBounds(0,0, width, height); generatedLabel.setBounds(width, 0, width, height); mainFrame.add(originalLabel); mainFrame.add(generatedLabel); mainFrame.setSize(2*width, height +25); mainFrame.setLayout(null); mainFrame.setVisible(true); j2dNil = new Java2DNativeImageLoader(); random = new Random(); nn = createNN(); xyOut = calcGrid(); rgb = new FastRGB(originalImage); SwingUtilities.invokeLater(this::onCalc); }
Source:
public void testSelectApplicationNamesIfNotNullReturnNameString() { Applications applications = new Applications("appsHashCode", 1559658285l, new ArrayList<>(Arrays.asList( new Application("foo"), new Application("bar"), new Application("baz")))); HashSet<String> strings = new HashSet<>(Arrays.asList("baz", "bar", "foo")); Assert.assertEquals(strings, EurekaEntityFunctions.selectApplicationNames(applications)); }

Target:
public void testSelectApplicationNamesIfNotNullReturnNameString() { Applications applications = createApplications(new Application("foo"), new Application("bar"), new Application("baz")); HashSet<String> strings = new HashSet<>(Arrays.asList("baz", "bar", "foo")); Assert.assertEquals(strings, EurekaEntityFunctions.selectApplicationNames(applications)); }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } return true; }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } return obj != null && getClass() == obj.getClass(); }
Source:
public boolean intersects(long timestamp) { return (start <= timestamp && end >= timestamp); }

Target:
public boolean intersects(long timestamp) { if (start <= timestamp) { if (end >= timestamp) { return true; } } return false; }
Source:
public void cleanUp() throws Exception { HelixStoreOperator operator = new HelixStoreOperator(helixStore); if (operator.exist("/")) { operator.delete("/"); } if (Files.exists(accountBackupDir)) { Files.walk(accountBackupDir).map(Path::toFile).forEach(File::delete); Files.deleteIfExists(accountBackupDir); } }

Target:
public void cleanUp() throws Exception { HelixStoreOperator operator = new HelixStoreOperator(helixStore); if (operator.exist("/")) { operator.delete("/"); } if (Files.exists(accountBackupDir)) { Utils.deleteFileOrDirectory(accountBackupDir.toFile()); } }
Source:
synchronized void addListener(Consumer<PathChildrenCacheEvent> callback) { callbacks.add(callback); }

Target:
void addListener(Consumer<PathChildrenCacheEvent> callback) { callbacks.add(callback); }
Source:
private void assertNoProductsFound(Response<Search> response) { assertTrue(response.isSuccessful()); Search search = response.body(); List<Product> products = search.getProducts(); assertTrue(products.isEmpty()); Assert.assertEquals(0, (int) Integer.valueOf(search.getCount())); }

Target:
private void assertNoProductsFound(Response<Search> response) { assertTrue(response.isSuccessful()); Search search = response.body(); List<Product> products = search.getProducts(); assertTrue(products.isEmpty()); assertEquals(0, (int) Integer.valueOf(search.getCount())); }
Source:
private void cancel(UUID nodeId) { synchronized (this) { if (isDone()) return; U.log(log, ("Cancelled rebalancing [grp=" + grp.cacheOrGroupName() + ", supplier=" + nodeId + ", topVer=" + topologyVersion() + "]")); cleanupRemoteContexts(nodeId); remaining.remove(nodeId); onDone(false); checkIsDone(); } }

Target:
private void cancel(UUID nodeId) { synchronized (this) { if (isDone()) return; U.log(log, ("Cancelled rebalancing [grp=" + grp.cacheOrGroupName() + ", supplier=" + nodeId + ", topVer=" + topologyVersion() + ']')); cleanupRemoteContexts(nodeId); remaining.remove(nodeId); onDone(false); checkIsDone(); } }
Source:
private void updateReferenceGenomeDaoDependencies() { if (referenceGenomeService != null) referenceGenomeService.setReferenceGenomeDao(referenceGenomeDao); }

Target:
private void updateReferenceGenomeDaoDependencies() { if (projectDao != null) projectDao.setReferenceGenomeDao(referenceGenomeDao); if (referenceGenomeService != null) referenceGenomeService.setReferenceGenomeDao(referenceGenomeDao); }
Source:
public ComplexMetricExtractor getExtractor() { return new ComplexMetricExtractor() { @Override public Class<?> extractedClass() { return ArrayOfDoublesSketch.class; } @Override public Object extractValue(final InputRow inputRow, final String metricName) { final Object object = inputRow.getRaw(metricName); if (object == null || object instanceof ArrayOfDoublesSketch || object instanceof Memory) { return object; } return ArrayOfDoublesSketchOperations.deserialize(object); } }; }

Target:
public ComplexMetricExtractor getExtractor() { return new ComplexMetricExtractor() { @Override public Class<?> extractedClass() { return ArrayOfDoublesSketch.class; } @Override public Object extractValue(final InputRow inputRow, final String metricName) { final Object object = inputRow.getRaw(metricName); if (object == null || object instanceof ArrayOfDoublesSketch) { return object; } return ArrayOfDoublesSketchOperations.deserialize(object); } }; }
Source:
protected void eventHandle(ITmfEvent event) { System.out.println("Handling event from " + event.getTrace().getName()); if (!fTraces.contains(event.getTrace())) { System.out.println("Trace not contained"); try { int quarkId = ss.getQuarkAbsoluteAndAdd(TRACE_QUARK_NAME); ss.modifyAttribute(event.getTimestamp().getValue(), TmfStateValue.newValueInt(++fCount), quarkId); fTraces.add(event.getTrace()); } catch (TimeRangeException | AttributeNotFoundException | StateValueTypeException e) { System.out.println("Exception in handle event: " + e.getMessage()); } } }

Target:
protected void eventHandle(ITmfEvent event) { if (!fTraces.contains(event.getTrace())) { try { int quarkId = ss.getQuarkAbsoluteAndAdd(TRACE_QUARK_NAME); ss.modifyAttribute(event.getTimestamp().getValue(), TmfStateValue.newValueInt(++fCount), quarkId); fTraces.add(event.getTrace()); } catch (TimeRangeException | AttributeNotFoundException | StateValueTypeException e) { } } }
Source:
convert(CompositeFilter filter, RecordSpec<I, R, ?> spec, RecordQueryBuilder<I, R> builder) { if (filter.getFilterCount() > 0) { List<Filter> childFilters = filter.getFilterList(); for (Filter childFilter : childFilters) { convertSingle(childFilter, builder, spec); } } return builder; }

Target:
convert(CompositeFilter filter, RecordSpec<I, R, ?> spec, RecordQueryBuilder<I, R> builder) { for (Filter childFilter : filter.getFilterList()) { convertSingle(childFilter, builder, spec); } return builder; }
Source:
private boolean isAccountExpired(IADsUser usr) { try { Date expirationDate = usr.accountExpirationDate(); if (expirationDate != null) { return new Date().after(expirationDate); } return false; } catch (ComException e) { if (e.getHRESULT() == 0x8000500D) { return false; } throw e; } }

Target:
private boolean isAccountExpired(IADsUser usr) { try { Date expirationDate = usr.accountExpirationDate(); if (expirationDate != null) { return new Date().after(expirationDate); } return false; } catch (ComException e) { if (e.getHRESULT() == E_ADS_PROPERTY_NOT_FOUND) { return false; } throw e; } }
Source:
public void createPartControl(@Nullable Composite parent) { String name = getViewSite().getSecondaryId(); if (name != null) { fViewInfo.setName(checkNotNull(TmfViewFactory.getBaseSecId(name))); } super.createPartControl(parent); setViewTitle(); }

Target:
public void createPartControl(@Nullable Composite parent) { String name = getViewSite().getSecondaryId(); if (name != null) { name = TmfViewFactory.getBaseSecId(name); } if (name != null) { fViewInfo.setName(name); } super.createPartControl(parent); setViewTitle(); }
Source:
private String buildLookupQuery(String table, String filter, String keyColumn, String valueColumn) { String query; if (Strings.isNullOrEmpty(filter)) { query = StringUtils.format( "SELECT %s, %s FROM %s", keyColumn, valueColumn, table ); } else { query = StringUtils.format( "SELECT %s, %s FROM %s WHERE %s", keyColumn, valueColumn, table, filter ); } return query; }

Target:
private String buildLookupQuery(String table, String filter, String keyColumn, String valueColumn) { if (Strings.isNullOrEmpty(filter)) { return StringUtils.format( "SELECT %s, %s FROM %s", keyColumn, valueColumn, table ); } return StringUtils.format( "SELECT %s, %s FROM %s WHERE %s", keyColumn, valueColumn, table, filter ); }
Source:
private String hostName(String host, int port) { if (port == SSH_PORT) { return host; } return String.format("[%s]:%d", host, port); }

Target:
private static String hostName(String host, int port) { if (port == SSH_PORT) { return host; } return String.format("[%s]:%d", host, port); }
Source:
public Map<String, String> getAllMappingUnderPath(String namespace, String path) { if (!_routingZkAddressMap.containsKey(namespace)) { throw new NoSuchElementException( "Failed to get all mapping under path: Namespace " + namespace + " is not found!"); } if (!_routingDataMap.containsKey(namespace)) { throw new IllegalStateException("Failed to get all mapping under path: Namespace " + namespace + " contains invalid routing data!"); } return _routingDataMap.get(namespace).getAllMappingUnderPath(path); }

Target:
public Map<String, String> getAllMappingUnderPath(String namespace, String path) { if (!_routingZkAddressMap.containsKey(namespace)) { throw new NoSuchElementException( "Failed to get all mapping under path: Namespace " + namespace + " is not found!"); } if (!_routingDataMap.containsKey(namespace)) { throw new IllegalStateException("Failed to get all mapping under path: Namespace " + namespace + " contains either empty or invalid routing data!"); } return _routingDataMap.get(namespace).getAllMappingUnderPath(path); }
Source:
public String getDicomViewerUrl(Study study) { if (study == null) throw new IllegalArgumentException("study cannot be null"); else if (study.getStudyInstanceUid() == null) throw new IllegalArgumentException("studyInstanceUid cannot be null"); return study.isCompleted() ? this.radiologyProperties.getDicomViewerUrl() + "studyUID=" + study.getStudyInstanceUid() : null; }

Target:
public String getDicomViewerUrl(Study study) { if (study == null) throw new IllegalArgumentException("study cannot be null"); else if (study.getStudyInstanceUid() == null) throw new IllegalArgumentException("studyInstanceUid cannot be null"); return radiologyProperties.getDicomViewerUrl() + "studyUID=" + study.getStudyInstanceUid(); }
Source:
private void updateElementDiagonosticMap() { elementDiagnosticMap.clear(); Diagnostic diagnostics = Diagnostician.INSTANCE.validate(roomModel); for (Diagnostic diagnostic : diagnostics.getChildren()) { FeatureBasedDiagnostic featureBasedDiagnostic = (FeatureBasedDiagnostic) diagnostic; EObject source = featureBasedDiagnostic.getSourceEObject(); EStructuralFeature feature = featureBasedDiagnostic.getFeature(); int index = featureBasedDiagnostic.getIndex(); EObject eObject = null; if (!feature.isMany()) eObject = (EObject) source.eGet(feature); else if (index != ValidationMessageAcceptor.INSIGNIFICANT_INDEX) { List<?> list = (List<?>) source.eGet(feature); eObject = (EObject) list.get(index); } if (elementDiagnosticMap.get(eObject) == null) elementDiagnosticMap.put(eObject, new ArrayList<Diagnostic>()); elementDiagnosticMap.get(eObject).add(diagnostic); } }

Target:
private void updateElementDiagonosticMap() { elementDiagnosticMap.clear(); Diagnostic diagnostics = Diagnostician.INSTANCE.validate(roomModel); for (Diagnostic diagnostic : diagnostics.getChildren()) { FeatureBasedDiagnostic featureBasedDiagnostic = (FeatureBasedDiagnostic) diagnostic; EObject source = featureBasedDiagnostic.getSourceEObject(); EObject eObject = null; if (source instanceof StateGraph) { EStructuralFeature feature = featureBasedDiagnostic .getFeature(); int index = featureBasedDiagnostic.getIndex(); if (!feature.isMany()) eObject = (EObject) source.eGet(feature); else if (index != ValidationMessageAcceptor.INSIGNIFICANT_INDEX) { List<?> list = (List<?>) source.eGet(feature); eObject = (EObject) list.get(index); } } else if (source instanceof Trigger) eObject = source.eContainer(); else eObject = source; if (elementDiagnosticMap.get(eObject) == null) elementDiagnosticMap.put(eObject, new ArrayList<Diagnostic>()); elementDiagnosticMap.get(eObject).add(diagnostic); } }
Source:
public void testLeftBubblePosition() { Float expectedXLeft = -495.0f; Float expectedYLeft = 347.0f; Sprite sprite = new Sprite(NAME); sprite.look.setX(-540.0f); sprite.look.setY(-897.0f); sprite.look.setHeight(1794.0f); sprite.look.setWidth(1080.0f); ShowBubbleActor bubbleActor = new ShowBubbleActor(NAME, sprite, Constants.SAY_BRICK); assertEquals(expectedXLeft, bubbleActor.calculateLeftImageX(CALC_X_LEFT)); assertEquals(expectedYLeft, bubbleActor.calculateImageY(CALC_Y_LEFT)); }

Target:
public void testLeftBubblePosition() { ShowBubbleActor bubbleActor = new ShowBubbleActor(OBJECT_NAME, sprite, Constants.SAY_BRICK); assertEquals(EXPECTED_X_STD_LEFT, bubbleActor.calculateLeftImageX(CALC_X_LEFT)); assertEquals(EXPECTED_Y_STD, bubbleActor.calculateImageY(CALC_Y_LEFT)); }
Source:
public void testTopNNodeSymbolMapping() { PlanBuilder builder = new PlanBuilder(new PlanNodeIdAllocator(), metadata); ValuesNode values = builder.values(a, b); TopNNode topNNode = builder.topN(10, ImmutableList.of(a, b), values); TopNNode mappedTopNNode = SYMBOL_MAPPER.map(topNNode, values, topNNode.getId()); assertEquals(mappedTopNNode.getOrderBy(), singletonList(A)); }

Target:
public void testTopNNodeSymbolMapping() { PlanBuilder builder = new PlanBuilder(new PlanNodeIdAllocator(), metadata); ValuesNode values = builder.values(a, b); TopNNode topNNode = builder.topN(10, ImmutableList.of(a, b), values); TopNNode mappedTopNNode = SYMBOL_MAPPER.map(topNNode, values); assertEquals(mappedTopNNode.getOrderBy(), singletonList(A)); assertEquals(mappedTopNNode.getOrderings().keySet(), singleton(A)); }
Source:
public static Set<String> getDimensionTypes(WorldProvider provider) { if (provider instanceof Handler) return ((Handler) provider).getDimensionTypes(); Set<String> types = dimensionTypes.get(provider.dimensionId); return types != null ? SET_UNCATEGORIZED : Collections.<String>emptySet(); }

Target:
public static Set<String> getDimensionTypes(WorldProvider provider) { if (provider instanceof Handler) return ((Handler) provider).getDimensionTypes(); Set<String> types = dimensionTypes.get(provider.dimensionId); return types != null ? types : SET_UNCATEGORIZED; }