auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private BallColor getCombinedBallColor() { Boolean taskIsBuilding = false; Boolean oneTaskIsIncomplete = false; Result combinedResult = null; for(Job job : this.folder.getAllJobs()) { Run build = job.getLastBuild(); if(build == null) { oneTaskIsIncomplete = true; continue; } if(build.isBuilding()) { taskIsBuilding = true; build = job.getLastCompletedBuild(); if(build == null) continue; } Result result = build.getResult(); if(combinedResult == null) { combinedResult = result; } else { combinedResult = combinedResult.combine(result); } } BallColor cumulativeIcon = null; if(oneTaskIsIncomplete) { cumulativeIcon = BallColor.NOTBUILT; } else if(combinedResult != null) { cumulativeIcon = combinedResult.color; } if(taskIsBuilding) { cumulativeIcon = cumulativeIcon.anime(); } return cumulativeIcon; }

Target:
private BallColor getCombinedBallColor() { Boolean taskIsBuilding = false; Boolean oneTaskIsIncomplete = false; Result combinedResult = null; for(Job job : this.folder.getAllJobs()) { Run build = job.getLastBuild(); if(build == null) { oneTaskIsIncomplete = true; continue; } if(build.isBuilding()) { taskIsBuilding = true; build = job.getLastCompletedBuild(); if(build == null) continue; } if (oneTaskIsIncomplete) { break; } Result result = build.getResult(); if(combinedResult == null) { combinedResult = result; } else { combinedResult = combinedResult.combine(result); } } BallColor cumulativeIcon = null; if(oneTaskIsIncomplete) { cumulativeIcon = BallColor.NOTBUILT; } else { assert combinedResult != null; cumulativeIcon = combinedResult.color; } if(taskIsBuilding) { cumulativeIcon = cumulativeIcon.anime(); } return cumulativeIcon; }
Source:
public void close() { if (creditConsumer != null) { creditConsumer.unregister(); } if (endHandler != null) { vertx.runOnContext(v -> endHandler.handle(null)); } }

Target:
public synchronized void close() { checkClosed(); closed = true; if (pending.isEmpty()) { handleClosed(); } }
Source:
private HystrixConcurrencyStrategy getConcurrencyStrategy() { HystrixConcurrencyStrategy registeredStrategy = HystrixPlugins.getInstance() .getConcurrencyStrategy(); if (registeredStrategy != null && !registeredStrategy.equals(HystrixConcurrencyStrategyDefault.getInstance()) && !registeredStrategy.equals(existingConcurrencyStrategy)) { throw new IllegalStateException("Multiple HystrixConcurrencyStrategy detected."); } return existingConcurrencyStrategy != null ? existingConcurrencyStrategy : registeredStrategy; }

Target:
private HystrixConcurrencyStrategy getConcurrencyStrategy() { HystrixConcurrencyStrategy registeredStrategy = HystrixPlugins.getInstance() .getConcurrencyStrategy(); if (existingConcurrencyStrategy == null) { return registeredStrategy; } if (registeredStrategy instanceof HystrixConcurrencyStrategyDefault){ return existingConcurrencyStrategy; } if (!existingConcurrencyStrategy.equals(registeredStrategy)){ throw new IllegalStateException("Multiple HystrixConcurrencyStrategy detected."); } return existingConcurrencyStrategy; }
Source:
public CompletableFuture<String> generateMap(String mapName) { Matcher matcher = GENERATED_MAP_PATTERN.matcher(mapName); if (!matcher.find()) { return CompletableFuture.supplyAsync(() -> { throw new IllegalArgumentException("Map name is not a generated map"); }); } return generateMap(matcher.group(1), matcher.group(2)); }

Target:
public CompletableFuture<String> generateMap(String mapName) { Matcher matcher = GENERATED_MAP_PATTERN.matcher(mapName); if (!matcher.find()) { return CompletableFuture.failedFuture(new InvalidParameterException("Map name is not a generated map")); } return generateMap(matcher.group(1), matcher.group(2)); }
Source:
@Override public Iterator<? extends TripPatternInfo<TripSchedule>> patternIterator( IntIterator stops ) { Set<TripPatternInfo<TripSchedule>> activeTripPatternsForGivenStops = new HashSet<>(); int stopIndex = stops.next(); while (stopIndex > 0) { activeTripPatternsForGivenStops.addAll(activeTripPatternsPerStop.get(stopIndex)); stopIndex = stops.next(); } return activeTripPatternsForGivenStops.iterator(); }

Target:
@Override public Iterator<? extends TripPatternInfo<TripSchedule>> patternIterator( IntIterator stops ) { Set<TripPatternInfo<TripSchedule>> activeTripPatternsForGivenStops = new HashSet<>(); while (stops.hasNext()) { activeTripPatternsForGivenStops.addAll(activeTripPatternsPerStop.get(stops.next())); } return activeTripPatternsForGivenStops.iterator(); }
Source:
public Single<String> getP18ForItem(String entityId) { return depictsInterface.getImageForEntity(entityId) .map(commonsFilename -> { String name; try { JsonObject claims = commonsFilename.getAsJsonObject("claims").getAsJsonObject(); JsonObject p18 = claims.get("P18").getAsJsonArray().get(0).getAsJsonObject(); JsonObject mainsnak = p18.get("mainsnak").getAsJsonObject(); JsonObject datavalue = mainsnak.get("datavalue").getAsJsonObject(); JsonPrimitive value = datavalue.get("value").getAsJsonPrimitive(); name = value.toString(); name = name.substring(1, name.length() - 1); } catch (Exception e) { name=""; } if (!name.isEmpty()){ return getThumbnailUrl(name); } else return NO_DEPICTED_IMAGE; }) .singleOrError(); }

Target:
public Single<String> getP18ForItem(String entityId) { return depictsInterface.getImageForEntity(entityId) .map(claimsResponse -> { final List<Statement_partial> imageClaim = claimsResponse.getClaims() .get(WikidataProperties.IMAGE.getPropertyName()); if (imageClaim != null) { final DataValueString dataValue = (DataValueString) imageClaim .get(0) .getMainSnak() .getDataValue(); return getThumbnailUrl((dataValue.getValue())); } return NO_DEPICTED_IMAGE; }) .singleOrError(); }
Source:
public void onPause() { super.onPause(); mapView.onPause(); if (offlineManager != null) { offlineManager.listOfflineRegions(new OfflineManager.ListOfflineRegionsCallback() { @Override public void onList(OfflineRegion[] offlineRegions) { if (offlineRegions.length > 0) { offlineRegions[(offlineRegions.length - 1)].delete(new OfflineRegion.OfflineRegionDeleteCallback() { @Override public void onDelete() { Toast.makeText(SimpleOfflineMapActivity.this, "Yosemite offline map deleted", Toast.LENGTH_LONG).show(); } @Override public void onError(String error) { Log.e(TAG, "On Delete error: " + error); } }); } } @Override public void onError(String error) { Log.e(TAG, "onListError: " + error); } }); } }

Target:
public void onPause() { super.onPause(); mapView.onPause(); if (offlineManager != null) { offlineManager.listOfflineRegions(new OfflineManager.ListOfflineRegionsCallback() { @Override public void onList(OfflineRegion[] offlineRegions) { if (offlineRegions.length > 0) { offlineRegions[(offlineRegions.length - 1)].delete(new OfflineRegion.OfflineRegionDeleteCallback() { @Override public void onDelete() { Toast.makeText( SimpleOfflineMapActivity.this, getString(R.string.basic_offline_deleted_toast), Toast.LENGTH_LONG ).show(); } @Override public void onError(String error) { Log.e(TAG, "On Delete error: " + error); } }); } } @Override public void onError(String error) { Log.e(TAG, "onListError: " + error); } }); } }
Source:
public String getSampleRequestPayload() { return "{\n" + " \"eventType\": rmwebhook-create\n" + " \"resource\": {" + " \"webhookName\": \"webhook name\"\n" + " \"payloadUrl\": \"<LINK_0>\"\n" + " \"secret\": \"secret\"\n" + " }" + "}"; }

Target:
public String getSampleRequestPayload() { return "{\n" + " \"eventType\": rmwebhook-create\n" + " \"resource\": {" + " \"webhookName\": \"webhook name\"\n" + " \"payloadUrl\": \"<LINK_1>\"\n" + " \"secret\": \"secret\"\n" + " }" + "}"; }
Source:
public void setup() { Values.setNanoPrecision( 6 ); }

Target:
public void setup() { prevPrecision = Values.getNanoPrecision(); Values.setNanoPrecision( 6 ); }
Source:
private Tuple<MoveValidationResult, List<Unit>> validateMoveWithDependents( final List<Unit> units, final Map<Unit, Unit> unitsToTransports, final Route route) { final List<Unit> bestWithDependents = addMustMoveWith(units); final MoveValidationResult result; getData().acquireReadLock(); try { final MoveDescription move = new MoveDescription(bestWithDependents, route, unitsToTransports, dependentUnits); result = AbstractMoveDelegate.validateMove( moveType, move, getCurrentPlayer(), nonCombat, getUndoableMoves(), getData()); } finally { getData().releaseReadLock(); } return Tuple.of(result, bestWithDependents); }

Target:
private MoveValidationResultWithDependents validateMoveWithDependents( final List<Unit> units, final Map<Unit, Unit> unitsToTransports, final Route route) { final List<Unit> unitsWithDependents = addMustMoveWith(units); final MoveValidationResult result; getData().acquireReadLock(); try { final MoveDescription move = new MoveDescription(unitsWithDependents, route, unitsToTransports, dependentUnits); result = AbstractMoveDelegate.validateMove( moveType, move, getCurrentPlayer(), nonCombat, getUndoableMoves(), getData()); } finally { getData().releaseReadLock(); } return new MoveValidationResultWithDependents(result, unitsWithDependents); }
Source:
protected void onCreate(Bundle savedInstanceState) { Utilities.setActivityTheme(this, getApplicationContext()); super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_entry); mAmountView = (EditText) findViewById(R.id.entry_amount); mBudgetView = (Spinner) findViewById(R.id.spinner_budget); mDateView = (DatePicker) findViewById(R.id.entry_date_picker); mNotesView = (EditText) findViewById(R.id.entry_notes); mAddButtonView = (Button) findViewById(R.id.add_entry_button); addItemsToBudgetSpinner(); Bundle bundle = getIntent().getExtras(); addMode = bundle.getBoolean("Add", true); if (addMode) { setTitle(MessageFormat.format(getTitle().toString(), getString(R.string.title_entry_add))); mAddButtonView.setText(getString(R.string.entry_activity_button_add)); } else { setTitle(MessageFormat.format(getTitle().toString(), getString(R.string.title_entry_edit))); mAddButtonView.setText(getString(R.string.entry_activity_button_edit)); Budget b = Budget.getBudgetById(bundle.getLong("BudgetId")); Entry e = b.getEntryById(bundle.getLong("EntryId")); mAmountView.setText("" + (double) e.getAmount() / Utilities.DOLLOR_IN_CENTS); LocalDate date = e.getDate(); mDateView.updateDate(date.getYear(), date.getMonthOfYear(), date.getDayOfMonth()); mNotesView.setText(e.getNotes()); ArrayAdapter<String> editAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, new String[]{b.getName()}); mBudgetView.setAdapter(editAdapter); mBudgetView.setEnabled(false); } getIntent().setAction("Already created"); }

Target:
protected void onCreate(Bundle savedInstanceState) { Utilities.setActivityTheme(this, getApplicationContext()); super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_entry); mAmountView = (EditText) findViewById(R.id.entry_amount); mBudgetView = (Spinner) findViewById(R.id.spinner_budget); mDateView = (DatePicker) findViewById(R.id.entry_date_picker); mNotesView = (EditText) findViewById(R.id.entry_notes); mAddButtonView = (Button) findViewById(R.id.add_entry_button); Log.d(TAG, "After views"); addItemsToBudgetSpinner(); Log.d(TAG, "After budget spinner"); Bundle bundle = getIntent().getExtras(); addMode = bundle == null ? true : bundle.getBoolean("Add", true); if (addMode) { setTitle(MessageFormat.format(getTitle().toString(), getString(R.string.title_entry_add))); mAddButtonView.setText(getString(R.string.entry_activity_button_add)); } else { setTitle(MessageFormat.format(getTitle().toString(), getString(R.string.title_entry_edit))); mAddButtonView.setText(getString(R.string.entry_activity_button_edit)); Budget b = Budget.getBudgetById(bundle.getLong("BudgetId")); Entry e = b.getEntryById(bundle.getLong("EntryId")); mAmountView.setText(Utilities.amountToDollarsNoDollarSign(e.getAmount())); LocalDate date = e.getDate(); mDateView.updateDate(date.getYear(), date.getMonthOfYear() - 1, date.getDayOfMonth()); mNotesView.setText(e.getNotes()); ArrayAdapter<String> editAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, new String[]{b.getName()}); mBudgetView.setAdapter(editAdapter); mBudgetView.setEnabled(false); } getIntent().setAction("Already created"); }
Source:
private TradeInfo parseTradeInfo(CsvRow row) { TradeInfoBuilder infoBuilder = TradeInfo.builder(); String scheme = row.findField(ID_SCHEME_FIELD).orElse(DEFAULT_TRADE_SCHEME); row.findValue(ID_FIELD).ifPresent(id -> infoBuilder.id(StandardId.of(scheme, id))); String schemeCpty = row.findField(CTPY_SCHEME_FIELD).orElse(DEFAULT_CTPY_SCHEME); Optional<String> cptyOption = row.findValue(CTPY_FIELD); if (cptyOption.isPresent() && !cptyOption.get().equals(EMPTY)) { infoBuilder.counterparty(StandardId.of(schemeCpty, cptyOption.get())); } row.findValue(TRADE_DATE_FIELD).ifPresent(dateStr -> infoBuilder.tradeDate(LoaderUtils.parseDate(dateStr))); row.findValue(TRADE_TIME_FIELD).ifPresent(timeStr -> infoBuilder.tradeTime(LoaderUtils.parseTime(timeStr))); row.findValue(TRADE_ZONE_FIELD).ifPresent(zoneStr -> infoBuilder.zone(ZoneId.of(zoneStr))); resolver.parseTradeInfo(row, infoBuilder); return infoBuilder.build(); }

Target:
private TradeInfo parseTradeInfo(CsvRow row) { TradeInfoBuilder infoBuilder = TradeInfo.builder(); String scheme = row.findField(ID_SCHEME_FIELD).orElse(DEFAULT_TRADE_SCHEME); row.findValue(ID_FIELD).ifPresent(id -> infoBuilder.id(StandardId.of(scheme, id))); String schemeCpty = row.findValue(CPTY_SCHEME_FIELD).orElse(DEFAULT_CPTY_SCHEME); row.findValue(CPTY_FIELD).ifPresent(cpty -> infoBuilder.counterparty(StandardId.of(schemeCpty, cpty))); row.findValue(TRADE_DATE_FIELD).ifPresent(dateStr -> infoBuilder.tradeDate(LoaderUtils.parseDate(dateStr))); row.findValue(TRADE_TIME_FIELD).ifPresent(timeStr -> infoBuilder.tradeTime(LoaderUtils.parseTime(timeStr))); row.findValue(TRADE_ZONE_FIELD).ifPresent(zoneStr -> infoBuilder.zone(ZoneId.of(zoneStr))); resolver.parseTradeInfo(row, infoBuilder); return infoBuilder.build(); }
Source:
public void testJerseyClientBuilder(@ArquillianResource URL webAppURL) throws Exception { reloadServer(); final URI uri = new URI(webAppURL.toExternalForm() + JerseyClientTestServlet.SERVLET_PATH.substring(1)); Utils.makeCall(uri, true ? HttpServletResponse.SC_OK : HttpServletResponse.SC_INTERNAL_SERVER_ERROR); }

Target:
public void testJerseyClientBuilder(@ArquillianResource URL webAppURL) throws Exception { final URI uri = new URI(webAppURL.toExternalForm() + JerseyClientTestServlet.SERVLET_PATH.substring(1)); Utils.makeCall(uri, HttpServletResponse.SC_OK); }
Source:
private void updatedMap() { document.setMetaDataDirty(true); this.setCollection(map.values()); }

Target:
private void updatedMap() { document.setMetaDataDirty(true); this.setCollection(new ArrayList<>(map.values())); }
Source:
public Map<String, ConnectionProfile> loadConnectionProfiles() { IConnectionProfile[] connectionProfiles = ProfileManager.getInstance() .getProfiles(); Map<String, ConnectionProfile> result = new LinkedHashMap<String, ConnectionProfile>(); for (IConnectionProfile currentProfile : connectionProfiles) { ConnectionProfile profile = new ConnectionProfile(); String profileName = currentProfile.getName(); profile.setName(profileName); Properties props = currentProfile.getProperties(currentProfile.getProviderId()); String driverClass = props.getProperty(DRIVER_CLASS); if (driverClass == null) { driverClass = ConnectionProfileUtil.getDriverClass(profileName); } if (driverClass != null) { profile.setDriver(driverClass); } else { continue; } String driverLocation = props.getProperty(DRIVER_LOCATION); if (driverLocation == null) { driverLocation = ConnectionProfileUtil.getConnectionProfileDriverURL(profileName)[0]; } if (driverLocation != null) { profile.setPath(driverLocation); } else { continue; } profile.setUser(props.getProperty(USER_NAME)); profile.setPassword(props.getProperty(PASSWORD)); profile.setUrl(props.getProperty(URL)); profile.setDialect(props.getProperty(HIBERNATE_DIALECT)); profile.setSavePassword(Boolean.parseBoolean(props .getProperty(SAVE_PWD))); result.put(profile.getName(), profile); } return result; }

Target:
public Map<String, ConnectionProfile> loadConnectionProfiles() { IConnectionProfile[] connectionProfiles = ProfileManager.getInstance() .getProfiles(); Map<String, ConnectionProfile> result = new LinkedHashMap<String, ConnectionProfile>(); for (IConnectionProfile currentProfile : connectionProfiles) { ConnectionProfile profile = new ConnectionProfile(); String profileName = currentProfile.getName(); profile.setName(profileName); Properties props = currentProfile.getProperties(currentProfile.getProviderId()); String driverClass = props.getProperty(DRIVER_CLASS); if (driverClass == null) { driverClass = ConnectionProfileUtil.getDriverClass(profileName); } if (driverClass != null) { profile.setDriver(driverClass); } else { logInfo( "Value for " + DRIVER_CLASS + " in connection profile " + profileName + "was null. Ignoring this connection profile."); continue; } String driverLocation = props.getProperty(DRIVER_LOCATION); if (driverLocation == null) { driverLocation = ConnectionProfileUtil.getConnectionProfileDriverURL(profileName)[0]; } if (driverLocation != null) { profile.setPath(driverLocation); } else { logInfo( "Value for " + DRIVER_LOCATION + " in connection profile " + currentProfile.getName() + "was null. Ignoring this connection profile."); continue; } profile.setUser(props.getProperty(USER_NAME)); profile.setPassword(props.getProperty(PASSWORD)); profile.setUrl(props.getProperty(URL)); profile.setDialect(props.getProperty(HIBERNATE_DIALECT)); profile.setSavePassword(Boolean.parseBoolean(props .getProperty(SAVE_PWD))); result.put(profile.getName(), profile); } return result; }
Source:
public boolean verify(JComponent input) { if (input instanceof JTextField) { LOGGER.debug("Verify scale user input.."); JTextField ftf = (JTextField) input; String text = ftf.getText(); NumberFormat ft = NumberFormat.getIntegerInstance(); String[] scaleParts = text.split(":"); if(scaleParts.length!=2) { invalidateUserInput(); } else { try { if(ft.parse(scaleParts[0]).intValue()==1) { try { setUserDefinedScaleDenominator(ft.parse(scaleParts[1]).longValue()); } catch (java.beans.PropertyVetoException ex) { invalidateUserInput(); return true; } LOGGER.debug("User scale input accepted.."); } } catch( ParseException ex) { LOGGER.error(I18N.tr("The format of a scale is 1:number"),ex); invalidateUserInput(); return true; } } } return true; }

Target:
public boolean verify(JComponent input) { if (input instanceof JTextField) { LOGGER.debug("Verify scale user input.."); JTextField ftf = (JTextField) input; String text = ftf.getText(); NumberFormat ft = NumberFormat.getIntegerInstance(); String[] scaleParts = text.split(":"); if(scaleParts.length!=2) { LOGGER.error(I18N.tr("The format of a scale is 1:number")); invalidateUserInput(); } else { try { if(ft.parse(scaleParts[0]).intValue()==1) { setUserDefinedScaleDenominator(ft.parse(scaleParts[1]).longValue()); LOGGER.debug("User scale input accepted.."); } else { throw new ParseException(I18N.tr("The only accepted value on nominator is 1"), 0); } } catch( ParseException ex) { LOGGER.error(ex.getLocalizedMessage()); invalidateUserInput(); } catch (PropertyVetoException ex) { LOGGER.error(ex.getLocalizedMessage()); invalidateUserInput(); } } } return true; }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CheckpointStatistics that = (CheckpointStatistics) o; return id == that.id && savepoint == that.savepoint && triggerTimestamp == that.triggerTimestamp && latestAckTimestamp == that.latestAckTimestamp && stateSize == that.stateSize && duration == that.duration && alignmentBuffered == that.alignmentBuffered && Objects.equals(processedData, that.processedData) && Objects.equals(persistedData, that.persistedData) && numSubtasks == that.numSubtasks && numAckSubtasks == that.numAckSubtasks && status == that.status && Objects.equals(checkpointStatisticsPerTask, that.checkpointStatisticsPerTask); }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CheckpointStatistics that = (CheckpointStatistics) o; return id == that.id && savepoint == that.savepoint && triggerTimestamp == that.triggerTimestamp && latestAckTimestamp == that.latestAckTimestamp && stateSize == that.stateSize && duration == that.duration && alignmentBuffered == that.alignmentBuffered && processedData == processedData && persistedData == that.persistedData && numSubtasks == that.numSubtasks && numAckSubtasks == that.numAckSubtasks && status == that.status && Objects.equals(checkpointStatisticsPerTask, that.checkpointStatisticsPerTask); }
Source:
protected Size onSuggestedResolutionUpdated(@NonNull Size suggestedResolution) { MeteringRepeatingConfig configWithDefaults = (MeteringRepeatingConfig) getUseCaseConfig(); SurfaceTexture surfaceTexture = new SurfaceTexture(0); surfaceTexture.setDefaultBufferSize(0, 0); Surface surface = new Surface(surfaceTexture); SessionConfig.Builder builder = SessionConfig.Builder.createFrom(configWithDefaults); builder.setTemplateType(CameraDevice.TEMPLATE_PREVIEW); if (mDeferrableSurface != null) { mDeferrableSurface.close(); } mDeferrableSurface = new ImmediateSurface(surface); mDeferrableSurface.getTerminationFuture().addListener(() -> { Log.d(TAG, "Release metering surface and surface texture"); surface.release(); surfaceTexture.release(); }, CameraXExecutors.directExecutor()); builder.addSurface(mDeferrableSurface); updateSessionConfig(builder.build()); notifyActive(); return new Size(0, 0); }

Target:
protected Size onSuggestedResolutionUpdated(@NonNull Size suggestedResolution) { MeteringRepeatingConfig configWithDefaults = (MeteringRepeatingConfig) getUseCaseConfig(); SurfaceTexture surfaceTexture = new SurfaceTexture(0); surfaceTexture.setDefaultBufferSize(0, 0); Surface surface = new Surface(surfaceTexture); SessionConfig.Builder builder = SessionConfig.Builder.createFrom(configWithDefaults); builder.setTemplateType(CameraDevice.TEMPLATE_PREVIEW); if (mDeferrableSurface != null) { mDeferrableSurface.close(); } mDeferrableSurface = new ImmediateSurface(surface); mDeferrableSurface.getTerminationFuture().addListener(() -> { if (DEBUG) { Log.d(TAG, "Release metering surface and surface texture"); } surface.release(); surfaceTexture.release(); }, CameraXExecutors.directExecutor()); builder.addSurface(mDeferrableSurface); updateSessionConfig(builder.build()); notifyActive(); return new Size(0, 0); }
Source:
protected boolean handles(EObject owner, EReference reference) { return !(owner instanceof Template) && EcoreUtil.getRootContainer(owner) instanceof TemplateCollection && !reference.isContainment(); }

Target:
protected boolean handles(EObject owner, EReference reference) { return !(owner instanceof Template) && !reference.isContainment() && EcoreUtil.getRootContainer(owner) instanceof TemplateCollection; }
Source:
private void deleteNoteAttachmentWithoutSourceOrTarget(Diagram gmfDiagram) { Iterable<Connector> noteAttachmentsToRemoveIter = Iterables.filter(Iterables.filter(gmfDiagram.getEdges(), Connector.class), new Predicate<Connector>() { @Override public boolean apply(Connector connector) { if (ViewType.NOTEATTACHMENT.equals(connector.getType())) { if (connector.getSource() == null || connector.getTarget() == null) { return true; } } return false; } }); Connector[] noteAttachmentsToRemove = Iterables.toArray(noteAttachmentsToRemoveIter, Connector.class); for (Connector connector : noteAttachmentsToRemove) { gmfDiagram.removeEdge(connector); } }

Target:
private void deleteNoteAttachmentWithoutSourceOrTarget(Diagram gmfDiagram) { Iterable<Connector> noteAttachmentsToRemoveIter = Iterables.filter(Iterables.filter(gmfDiagram.getEdges(), Connector.class), new Predicate<Connector>() { @Override public boolean apply(Connector connector) { if (ViewType.NOTEATTACHMENT.equals(connector.getType())) { if (connector.getSource() == null || connector.getTarget() == null) { return true; } } return false; } }); Connector[] noteAttachmentsToRemove = Iterables.toArray(noteAttachmentsToRemoveIter, Connector.class); for (Connector connector : noteAttachmentsToRemove) { gmfDiagram.removeEdge(connector); } if (noteAttachmentsToRemove.length > 0) { StringBuilder sb = new StringBuilder(Messages.NoteAttachmentWithoutSourceOrTargetMigrationParticipant_title); sb.append(MessageFormat.format(Messages.NoteAttachmentWithoutSourceOrTargetMigrationParticipant_edgesRemoved, noteAttachmentsToRemove.length)); DiagramPlugin.getDefault().logInfo(sb.toString()); } }
Source:
public ResponseEntity<?> createExpenses(@RequestBody @Valid Expense[] expenses) { try { if (expenses == null || expenses.length == 0) { throw new BadRequestException("No expenses found in request!"); } else { List<ExpenseDTO> createdExpenseListDTO = new ArrayList<>(); int index = 0; for (Expense expense : expenses) { if (CurrencyUtil.getCurrency(expense.getCurrency()) == null) { throw new BadRequestException("Wrong currency code for index [" + index + "] and Currency code [" + expense.getCurrency() + "]!"); } AppUser user = userUtil.extractLoggedAppUserFromDatabase(); Category category = resolveCategory(user, expense.getCategory().getName()); if (!user.getDefaultCurrency().getCurrencyCode().equals(expense.getCurrency())) { setDefaultCurrencyAmount(expense, user.getDefaultCurrency()); } expense.setCategory(category); expense.setUser(user); ExpenseDTO createdExpenseDto = expenseConverter.convertTo(expenseDao.saveAndFlush(expense)); createdExpenseListDTO.add(createdExpenseDto); index++; } Notification notification = notificationService.registerThresholdNotification(expenses[0].getCategory()); if (notification != null) { return new ResponseEntity<>(notification, HttpStatus.OK); } return new ResponseEntity<>(createdExpenseListDTO, HttpStatus.OK); } } catch (ConstraintViolationException e) { throw new BadRequestException(e.getMessage()); } }

Target:
public ResponseEntity<?> createExpenses(@RequestBody @Valid Expense[] expenses) { try { if (expenses == null || expenses.length == 0) { throw new BadRequestException("No expenses found in request!"); } else { List<ExpenseDTO> createdExpenseListDTO = new ArrayList<>(); int index = 0; for (Expense expense : expenses) { if (CurrencyUtil.getCurrency(expense.getCurrency()) == null) { throw new BadRequestException("Wrong currency code for index [" + index + "] and Currency code [" + expense.getCurrency() + "]!"); } AppUser user = userUtil.extractLoggedAppUserFromDatabase(); Category category = resolveCategory(user, expense.getCategory().getName()); if (!user.getDefaultCurrency().getCurrencyCode().equals(expense.getCurrency())) { setDefaultCurrencyAmount(expense, user.getDefaultCurrency()); } expense.setCategory(category); expense.setUser(user); ExpenseDTO createdExpenseDto = expenseConverter.convertTo(expenseDao.saveAndFlush(expense)); createdExpenseListDTO.add(createdExpenseDto); index++; } Notification notification = notificationService.registerThresholdNotification(expenses[0].getCategory()); NotificationEntityWrapperDTO responseDTO = new NotificationEntityWrapperDTO<ExpenseDTO>(createdExpenseListDTO, notification); return new ResponseEntity<>(responseDTO, HttpStatus.OK); } } catch (ConstraintViolationException e) { throw new BadRequestException(e.getMessage()); } }
Source:
public static ConstantFieldOptions buildResourceAndLabelFieldOptions( RDFService rdfService, WebappDaoFactory webappDaoFactory, String headerValue, String headerLabel, String ... resourceURIs) throws Exception { if(resourceURIs == null || resourceURIs.length == 0 || rdfService == null) { return new ConstantFieldOptions(); } List<String> options = new ArrayList<String>(); if(headerValue != null && headerLabel != null) { options.add(headerValue); options.add(headerLabel); } IRIFactory iriFactory = IRIFactory.iriImplementation(); for(String resourceURI : resourceURIs) { IRI iri = iriFactory.create(resourceURI); if(iri.hasViolation(false)) { log.debug("Not adding invalid URI " + resourceURI + " to field options list"); } else { String label = getLabel(iri, rdfService, webappDaoFactory); if(!StringUtils.isEmpty(label)) { options.add(iri.toString()); options.add(label); } } } return new ConstantFieldOptions(options.toArray( new String[options.size()])); }

Target:
public static ConstantFieldOptions buildResourceAndLabelFieldOptions( RDFService rdfService, WebappDaoFactory webappDaoFactory, String headerValue, String headerLabel, String ... resourceURIs) throws Exception { if(resourceURIs == null || resourceURIs.length == 0 || rdfService == null) { return new ConstantFieldOptions(); } List<String> options = new ArrayList<String>(); if(headerValue != null && headerLabel != null) { options.add(headerValue); options.add(headerLabel); } IRIFactory iriFactory = IRIFactory.iriImplementation(); for(String resourceURI : resourceURIs) { IRI iri = iriFactory.create(resourceURI); if(iri.hasViolation(false)) { log.warn("Not adding invalid URI " + resourceURI + " to field options list"); } else { String label = getLabel(iri, rdfService, webappDaoFactory); if(!StringUtils.isEmpty(label)) { options.add(iri.toString()); options.add(label); } } } return new ConstantFieldOptions(options.toArray( new String[options.size()])); }
Source:
private static List<Attribute> parseAttributes(String attributesLine) { ArrayList<Attribute> result = new ArrayList<Attribute>(); for (String attribute : attributesLine.split(ATTRIBUTES_SPLIT_REGEX)) { attribute = attribute.trim(); if (attribute.length() == 0) continue; if (attribute.startsWith("-")) { result.add(new Attribute(attribute.substring(1), State.UNSET)); continue; } final int equalsIndex = attribute.indexOf("="); if (equalsIndex == -1) result.add(new Attribute(attribute, State.SET)); else result.add(new Attribute(attribute.substring(0, equalsIndex), attribute.substring(equalsIndex + 1))); } return result; }

Target:
private static List<Attribute> parseAttributes(String attributesLine) { ArrayList<Attribute> result = new ArrayList<Attribute>(); for (String attribute : attributesLine.split(ATTRIBUTES_SPLIT_REGEX)) { attribute = attribute.trim(); if (attribute.length() == 0) continue; if (attribute.startsWith("-")) { if (attribute.length() > 1) result.add(new Attribute(attribute.substring(1), State.UNSET)); continue; } final int equalsIndex = attribute.indexOf("="); if (equalsIndex == -1) result.add(new Attribute(attribute, State.SET)); else { String attributeKey = attribute.substring(0, equalsIndex); if (attributeKey.length() > 0) { String attributeValue = attribute .substring(equalsIndex + 1); result.add(new Attribute(attributeKey, attributeValue)); } } } return result; }
Source:
public void testPageSource() { final Page input = SequencePageBuilder.createSequencePage(ImmutableList.of(VARCHAR), 10_000, 0); DriverContext driverContext = newDriverContext(); List<RowExpression> projections = ImmutableList.of(field(0, VARCHAR)); Supplier<CursorProcessor> cursorProcessor = expressionCompiler.compileCursorProcessor(Optional.empty(), projections, "key"); Supplier<PageProcessor> pageProcessor = expressionCompiler.compilePageProcessor(Optional.empty(), projections); ScanFilterAndProjectOperator.ScanFilterAndProjectOperatorFactory factory = new ScanFilterAndProjectOperator.ScanFilterAndProjectOperatorFactory( 0, new PlanNodeId("test"), new PlanNodeId("0"), (session, split, table, columns) -> new FixedPageSource(ImmutableList.of(input)), cursorProcessor, pageProcessor, new TableHandle( new ConnectorId("test"), new ConnectorTableHandle() {}, new ConnectorTransactionHandle() {}, Optional.empty()), ImmutableList.of(), ImmutableList.of(VARCHAR), new DataSize(0, BYTE), 0); SourceOperator operator = factory.createOperator(driverContext); operator.addSplit(new Split(new ConnectorId("test"), TestingTransactionHandle.create(), TestingSplit.createLocalSplit())); operator.noMoreSplits(); MaterializedResult expected = toMaterializedResult(driverContext.getSession(), ImmutableList.of(VARCHAR), ImmutableList.of(input)); MaterializedResult actual = toMaterializedResult(driverContext.getSession(), ImmutableList.of(VARCHAR), toPages(operator)); assertEquals(actual.getRowCount(), expected.getRowCount()); assertEquals(actual, expected); }

Target:
public void testPageSource() { final Page input = SequencePageBuilder.createSequencePage(ImmutableList.of(VARCHAR), 10_000, 0); DriverContext driverContext = newDriverContext(); List<RowExpression> projections = ImmutableList.of(field(0, VARCHAR)); Supplier<CursorProcessor> cursorProcessor = expressionCompiler.compileCursorProcessor(Optional.empty(), projections, "key"); Supplier<PageProcessor> pageProcessor = expressionCompiler.compilePageProcessor(Optional.empty(), projections); ScanFilterAndProjectOperator.ScanFilterAndProjectOperatorFactory factory = new ScanFilterAndProjectOperator.ScanFilterAndProjectOperatorFactory( 0, new PlanNodeId("test"), new PlanNodeId("0"), (session, split, table, columns) -> new FixedPageSource(ImmutableList.of(input)), cursorProcessor, pageProcessor, TESTING_TABLE_HANDLE, ImmutableList.of(), ImmutableList.of(VARCHAR), new DataSize(0, BYTE), 0); SourceOperator operator = factory.createOperator(driverContext); operator.addSplit(new Split(new ConnectorId("test"), TestingTransactionHandle.create(), TestingSplit.createLocalSplit())); operator.noMoreSplits(); MaterializedResult expected = toMaterializedResult(driverContext.getSession(), ImmutableList.of(VARCHAR), ImmutableList.of(input)); MaterializedResult actual = toMaterializedResult(driverContext.getSession(), ImmutableList.of(VARCHAR), toPages(operator)); assertEquals(actual.getRowCount(), expected.getRowCount()); assertEquals(actual, expected); }
Source:
public GeneratorUtil(TypeOracle typeOracle, Logger logger, GeneratorContext generatorContext) { this.typeOracle = typeOracle; this.logger = logger; this.generatorContext = generatorContext; }

Target:
GeneratorUtil(TypeOracle typeOracle, Logger logger, GeneratorContext generatorContext) { this.typeOracle = typeOracle; this.logger = logger; this.generatorContext = generatorContext; }
Source:
public static void main(String[] args) throws Throwable { BenchmarkData data = new BenchmarkData(); data.setup(); new BenchmarkGeometryToBingTiles().geometryToBingTiles(data); Options options = new OptionsBuilder() .verbosity(VerboseMode.NORMAL) .include(".*" + BenchmarkGeometryToBingTiles.class.getSimpleName() + ".*") .build(); new Runner(options).run(); }

Target:
public static void main(String[] args) throws IOException, RunnerException { BenchmarkData data = new BenchmarkData(); data.setup(); new BenchmarkGeometryToBingTiles().geometryToBingTiles(data); Options options = new OptionsBuilder() .verbosity(VerboseMode.NORMAL) .include(".*" + BenchmarkGeometryToBingTiles.class.getSimpleName() + ".*") .build(); new Runner(options).run(); }
Source:
private void validateStripeNames() { cluster.getStripes() .stream() .filter(stripe -> stripe.getName() == null) .findAny() .ifPresent(stripeName -> { throw new MalformedClusterException("Found stripe without name"); }); cluster.getStripes() .stream() .map(Stripe::getName) .filter(Objects::nonNull) .collect(groupingBy(identity(), counting())) .entrySet() .stream() .filter(e -> e.getValue() > 1) .map(Map.Entry::getKey) .findAny() .ifPresent(nodeName -> { throw new MalformedClusterException("Found duplicate stripe name: " + nodeName); }); }

Target:
private void validateStripeNames() { cluster.getStripes() .stream() .filter(stripe -> stripe.getName() == null) .findAny() .ifPresent(stripeName -> { throw new MalformedClusterException("Found stripe without name"); }); cluster.getStripes() .stream() .map(Stripe::getName) .filter(Objects::nonNull) .collect(groupingBy(identity(), counting())) .entrySet() .stream() .filter(e -> e.getValue() > 1) .map(Map.Entry::getKey) .findAny() .ifPresent(stripeName -> { throw new MalformedClusterException("Found duplicate stripe name: " + stripeName); }); }
Source:
public static PartitionDesc buildPartitionDesc(String partitionName) { PartitionDesc partitionDesc = new PartitionDesc(); partitionDesc.setPartitionName(partitionName); String[] partitionNames = partitionName.split("/"); List<PartitionKeyProto> partitionKeyList = new ArrayList<>(); for(int i = 0; i < partitionNames.length; i++) { String splits = partitionNames[i].split("="); String columnName = "", partitionValue = ""; if (splits.length == 2) { columnName = splits[0]; partitionValue = splits[1]; } else if (splits.length == 1) { if (partitionNames[i].charAt(0) == '=') { partitionValue = splits[0]; } else { columnName = ""; } } PartitionKeyProto.Builder builder = PartitionKeyProto.newBuilder(); builder.setColumnName(partitionValue); builder.setPartitionValue(columnName); partitionKeyList.add(builder.build()); } partitionDesc.setPartitionKeys(partitionKeyList); partitionDesc.setPath("hdfs://xxx.com/warehouse/" + partitionName); return partitionDesc; }

Target:
public static PartitionDesc buildPartitionDesc(String partitionName) { PartitionDesc partitionDesc = new PartitionDesc(); partitionDesc.setPartitionName(partitionName); String[] partitionNames = partitionName.split("/"); List<PartitionKeyProto> partitionKeyList = new ArrayList<>(); for(int i = 0; i < partitionNames.length; i++) { String splits = partitionNames[i].split("="); String columnName = "", partitionValue = ""; if (splits.length == 2) { columnName = splits[0]; partitionValue = splits[1]; } else if (splits.length == 1) { if (partitionNames[i].charAt(0) == '=') { partitionValue = splits[0]; } else { columnName = ""; } } PartitionKeyProto.Builder builder = PartitionKeyProto.newBuilder(); builder.setColumnName(columnName); builder.setPartitionValue(partitionValue); partitionKeyList.add(builder.build()); } partitionDesc.setPartitionKeys(partitionKeyList); partitionDesc.setPath("hdfs://xxx.com/warehouse/" + partitionName); return partitionDesc; }
Source:
private void verifyRowsBeforeTTLExpiration( com.google.common.collect.Table<String, String, Object> upsertedData, com.google.common.collect.Table<String, String, Object> fetchedData) { Set<String> upsertedRowKeys = upsertedData.rowKeySet(); Set<String> fetchedRowKeys = fetchedData.rowKeySet(); assertTrue("Upserted row keys should not be null", upsertedRowKeys != null); assertTrue("Fetched row keys should not be null", fetchedRowKeys != null); assertTrue(String.format("Rows upserted and fetched do not match, upserted=%d, fetched=%d", upsertedRowKeys.size(), fetchedRowKeys.size()), upsertedRowKeys.equals(fetchedRowKeys)); Set<String> fetchedCols = fetchedData.columnKeySet(); for (String rowKey : fetchedRowKeys) { for (String columnKey : fetchedCols) { Object upsertedValue = upsertedData.get(rowKey, columnKey); Object fetchedValue = fetchedData.get(rowKey, columnKey); assertTrue("Upserted values should not be null", upsertedValue != null); assertTrue("Fetched values should not be null", fetchedValue != null); assertTrue("Values upserted and fetched do not match", upsertedValue.equals(fetchedValue)); } } }

Target:
private void verifyRowsBeforeTTLExpiration( com.google.common.collect.Table<String, String, Object> upsertedData, com.google.common.collect.Table<String, String, Object> fetchedData) { Set<String> upsertedRowKeys = upsertedData.rowKeySet(); Set<String> fetchedRowKeys = fetchedData.rowKeySet(); assertNotNull("Upserted row keys should not be null", upsertedRowKeys); assertNotNull("Fetched row keys should not be null", fetchedRowKeys); assertEquals(String.format("Rows upserted and fetched do not match, upserted=%d, fetched=%d", upsertedRowKeys.size(), fetchedRowKeys.size()), upsertedRowKeys, fetchedRowKeys); Set<String> fetchedCols = fetchedData.columnKeySet(); for (String rowKey : fetchedRowKeys) { for (String columnKey : fetchedCols) { Object upsertedValue = upsertedData.get(rowKey, columnKey); Object fetchedValue = fetchedData.get(rowKey, columnKey); assertNotNull("Upserted values should not be null", upsertedValue); assertNotNull("Fetched values should not be null", fetchedValue); assertEquals("Values upserted and fetched do not match", upsertedValue, fetchedValue); } } }
Source:
private List<Role> getRoles(String username) { if (idPClient == null) { throw new RuntimeException("IdP client is not initialized properly. Unable to get user roles."); } List<Role> roles = new ArrayList<>(); try { List<Group> groups = idPClient.getUsersGroups(username); groups.forEach(group -> roles.add(new Role(group.getId(), group.getDisplayName()))); } catch (IdPClientException e) { log.error("Unable to check permission. Failed getting roles of the user."); throw new PermissionException("Failed getting roles of the user."); } return roles; }

Target:
private List<Role> getRoles(String username) { if (idPClient == null) { throw new RuntimeException("IdP client is not initialized properly. Unable to get user roles."); } List<Role> roles = new ArrayList<>(); try { List<Group> groups = idPClient.getUsersGroups(username); groups.forEach(group -> roles.add(new Role(group.getId(), group.getDisplayName()))); } catch (IdPClientException e) { throw new PermissionException("Failed getting roles of the user. Unable to check permissions"); } return roles; }
Source:
private static List<File> getCoverageReports(String baseDir, Configuration config) { if (!config.hasKey(REPORT_PATH_KEY) && !config.hasKey(REPORT_PATHS_KEY)) { return getReports(config, baseDir, REPORT_PATHS_KEY, DEFAULT_REPORT_PATH); } List<File> reports = new ArrayList<>(); config.get(REPORT_PATH_KEY).ifPresent(path -> reports.addAll(getReports(config, baseDir, REPORT_PATH_KEY, path))); Arrays.stream(config.getStringArray(REPORT_PATHS_KEY)) .map(path -> getReports(config, baseDir, REPORT_PATHS_KEY, path)) .forEach(reports::addAll); return reports; }

Target:
private static List<File> getCoverageReports(String baseDir, Configuration config) { if (!config.hasKey(REPORT_PATH_KEY) && !config.hasKey(REPORT_PATHS_KEY)) { return getReports(config, baseDir, REPORT_PATHS_KEY, DEFAULT_REPORT_PATH); } List<File> reports = new ArrayList<>(); config.get(REPORT_PATH_KEY) .map(path -> getReports(config, baseDir, REPORT_PATH_KEY, path)) .ifPresent(reports::addAll); Arrays.stream(config.getStringArray(REPORT_PATHS_KEY)) .map(path -> getReports(config, baseDir, REPORT_PATHS_KEY, path)) .forEach(reports::addAll); return reports; }
Source:
private Set<Cell> getSingleBatch( List<CellWithTimestamps> batch) { Map<Cell, Long> timestampsByCell = batch.stream() .collect(Collectors.toMap( CellWithTimestamps::cell, ignored -> maxTimestampExclusive)); Map<Cell, Value> valuesByCell = keyValueService.get(table, timestampsByCell); return Maps.filterValues(valuesByCell, Value::isEmpty).keySet(); }

Target:
private Set<Cell> getSingleBatch(List<CellWithTimestamps> batch) { Set<Cell> cells = batch.stream() .map(CellWithTimestamps::cell) .collect(Collectors.toSet()); Map<Cell, Value> valuesByCell = valuesLoader.getValues(table, cells, maxTimestampExclusive); return Maps.filterValues(valuesByCell, Value::isEmpty).keySet(); }
Source:
private Content updateEventPublisher(Content content) { for(EventRef eventRef: content.events()) { Event event = eventResolver.fetch(eventRef.id()).orNull(); if(event != null && event.publisher() != null) { eventRef.setPublisher(event.publisher()); } } return content; }

Target:
private Content updateEventPublisher(Content content) { List<EventRef> eventRefs = content.events(); for(EventRef eventRef: eventRefs) { Event event = eventResolver.fetch(eventRef.id()).orNull(); checkNotNull(event); checkNotNull(event.publisher()); eventRef.setPublisher(event.publisher()); } content.setEventRefs(ImmutableList.copyOf(eventRefs)); return content; }
Source:
public boolean isEmptyOrNullAllowed() { return emptyOrNullAllowed; }

Target:
boolean isEmptyOrNullAllowed() { return emptyOrNullAllowed; }
Source:
private void listen(int port) { try { socket = new ServerSocket(port); logger.info("Started Language Server Protocol (LSP) service on port {}", port); while (!socket.isClosed()) { logger.debug("Going to wait for a client to connect"); try { Socket client = socket.accept(); new Thread(() -> { handleConnection(client); }, "Client " + client.getRemoteSocketAddress()).start(); } catch (SocketException e) { logger.trace("Error accepting the client connection", e); } catch (IOException e) { logger.debug("Error accepting the client connection", e); } } } catch (IOException e) { logger.error("Error starting the Language Server", e); } }

Target:
private void listen(int port) { try { socket = new ServerSocket(port); logger.info("Started Language Server Protocol (LSP) service on port {}", port); while (!socket.isClosed()) { logger.debug("Going to wait for a client to connect"); try { Socket client = socket.accept(); new Thread(() -> { handleConnection(client); }, "Client " + client.getRemoteSocketAddress()).start(); } catch (IOException e) { if (!socket.isClosed()) { logger.error("Error accepting client connection: {}", e.getMessage()); } } } } catch (IOException e) { logger.error("Error starting the Language Server", e); } }
Source:
public void revertSamRecord(final SAMRecord rec) { if (RESTORE_ORIGINAL_QUALITIES) { final byte[] oq = rec.getOriginalBaseQualities(); if (oq != null) { rec.setBaseQualities(oq); rec.setOriginalBaseQualities(null); } } if (REMOVE_DUPLICATE_INFORMATION) { rec.setDuplicateReadFlag(false); } if (REMOVE_ALIGNMENT_INFORMATION) { if (rec.getReadNegativeStrandFlag()) { SAMRecordUtil.reverseComplement(rec); rec.setReadNegativeStrandFlag(false); } rec.setReferenceIndex(SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX); rec.setAlignmentStart(SAMRecord.NO_ALIGNMENT_START); rec.setCigarString(SAMRecord.NO_ALIGNMENT_CIGAR); rec.setMappingQuality(SAMRecord.NO_MAPPING_QUALITY); rec.setAttribute(SAMTag.AS.name(), null); if (!rec.getReadUnmappedFlag()) { rec.setInferredInsertSize(0); rec.setNotPrimaryAlignmentFlag(false); rec.setProperPairFlag(false); rec.setReadUnmappedFlag(true); } if (rec.getReadPairedFlag()) { rec.setMateAlignmentStart(SAMRecord.NO_ALIGNMENT_START); rec.setMateNegativeStrandFlag(false); rec.setMateReferenceIndex(SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX); rec.setMateUnmappedFlag(true); } for (final String tag : ATTRIBUTE_TO_CLEAR) { rec.setAttribute(tag, null); } } }

Target:
public void revertSamRecord(final SAMRecord rec) { if (RESTORE_ORIGINAL_QUALITIES) { final byte[] oq = rec.getOriginalBaseQualities(); if (oq != null) { rec.setBaseQualities(oq); rec.setOriginalBaseQualities(null); } } if (REMOVE_DUPLICATE_INFORMATION) { rec.setDuplicateReadFlag(false); } if (REMOVE_ALIGNMENT_INFORMATION) { if (rec.getReadNegativeStrandFlag()) { SAMRecordUtil.reverseComplement(rec); rec.setReadNegativeStrandFlag(false); } rec.setReferenceIndex(SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX); rec.setAlignmentStart(SAMRecord.NO_ALIGNMENT_START); rec.setCigarString(SAMRecord.NO_ALIGNMENT_CIGAR); rec.setMappingQuality(SAMRecord.NO_MAPPING_QUALITY); if (!rec.getReadUnmappedFlag()) { rec.setInferredInsertSize(0); rec.setNotPrimaryAlignmentFlag(false); rec.setProperPairFlag(false); rec.setReadUnmappedFlag(true); } if (rec.getReadPairedFlag()) { rec.setMateAlignmentStart(SAMRecord.NO_ALIGNMENT_START); rec.setMateNegativeStrandFlag(false); rec.setMateReferenceIndex(SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX); rec.setMateUnmappedFlag(true); } for (final String tag : ATTRIBUTE_TO_CLEAR) { rec.setAttribute(tag, null); } } }
Source:
public static char complementBase(char base, boolean RNA) { if (base == 'A' && RNA) return 'U'; if (base == 'A') return 'T'; if (base == 'T' && !RNA) return 'A'; if (base == 'U' && RNA) return 'A'; if (base == 'C') return 'G'; if (base == 'G') return 'C'; return ' '; }

Target:
protected static char complementBase(char base, boolean RNA) { if (base == 'A' && RNA) return 'U'; if (base == 'A') return 'T'; if (base == 'T' && !RNA) return 'A'; if (base == 'U' && RNA) return 'A'; if (base == 'C') return 'G'; if (base == 'G') return 'C'; return ' '; }
Source:
public void placeBlock(GlowPlayer player, GlowBlockState state, BlockFace face, ItemStack holding, Vector clickedLoc) { state.setType(getMaterial()); state.setRawData((byte) 0); state.getBlock().getWorld().requestSinglePulse(state.getBlock(), isWater(state.getBlock().getType()) || state.getBlock().getBiome() == Biome.HELL ? TICK_RATE_WATER : TICK_RATE_LAVA); }

Target:
public void placeBlock(GlowPlayer player, GlowBlockState state, BlockFace face, ItemStack holding, Vector clickedLoc) { state.setType(getMaterial()); state.setRawData((byte) 0); state.getBlock().getWorld().requestSinglePulse(state.getBlock(), isWater(state.getType()) || state.getBlock().getBiome() == Biome.HELL ? TICK_RATE_WATER : TICK_RATE_LAVA); }