auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public LinkedHashMap<String, String> getAPIPacketParameters() { LinkedHashMap<String, String> parameters = new LinkedHashMap<String, String>(); parameters.put("Source address", sourceAddress.toString()); parameters.put("RSSI", String.valueOf(rssi)); parameters.put("Receive options", String.valueOf(receiveOptions)); if (ioSample != null) parameters.put("IO sample", ioSample.toString()); return parameters; }

Target:
public LinkedHashMap<String, String> getAPIPacketParameters() { LinkedHashMap<String, String> parameters = new LinkedHashMap<String, String>(); parameters.put("Source address", "00 00 00 00 " + HexUtils.prettyHexString(HexUtils.byteArrayToHexString(sourceAddress.getValue())) + " (" + sourceAddress.toString() + ")"); parameters.put("RSSI", HexUtils.prettyHexString(HexUtils.integerToHexString(rssi, 1))); parameters.put("Receive options", HexUtils.prettyHexString(HexUtils.integerToHexString(receiveOptions, 1))); if (ioSample != null) { parameters.put("Number of samples", HexUtils.prettyHexString(HexUtils.integerToHexString(1, 1))); parameters.put("Digital channel mask", HexUtils.prettyHexString(HexUtils.integerToHexString(ioSample.getDigitalMask(), 2))); parameters.put("Analog channel mask", HexUtils.prettyHexString(HexUtils.integerToHexString(ioSample.getAnalogMask(), 2))); for (int i = 0; i < 16; i++) { if (ioSample.hasDigitalValue(IOLine.getDIO(i))) parameters.put(IOLine.getDIO(i).getName() + " digital value", ioSample.getDigitalValue(IOLine.getDIO(i)).getName()); } for (int i = 0; i < 6; i++) { if (ioSample.hasAnalogValue(IOLine.getDIO(i))) parameters.put(IOLine.getDIO(i).getName() + " analog value", HexUtils.prettyHexString(HexUtils.integerToHexString(ioSample.getAnalogValue(IOLine.getDIO(i)), 2))); } } return parameters; }
Source:
public BigtableInstanceAdminSettings getInstanceAdminSettings() throws IOException { Preconditions.checkState( isNullOrEmpty(configuration.get(BIGTABLE_EMULATOR_HOST_KEY)), "Instance admin does not support emulator"); if (instanceAdminSettings == null) { BigtableInstanceAdminSettings.Builder builder = BigtableInstanceAdminSettings.newBuilder().setProjectId(projectId); String adminHostOverride = configuration.get(BIGTABLE_ADMIN_HOST_KEY); String endpoint = adminHostOverride + ":" + getPort(); LOG.debug("Instance Admin endpoint host:port is %s.", endpoint); builder.stubSettings().setHeaderProvider(buildHeaderProvider()); if (configuration instanceof BigtableExtendedConfiguration || Boolean.parseBoolean(configuration.get(BIGTABLE_USE_SERVICE_ACCOUNTS_KEY))) { builder.stubSettings().setCredentialsProvider(buildCredentialProvider()); } else if (Boolean.parseBoolean(configuration.get(BIGTABLE_NULL_CREDENTIAL_ENABLE_KEY))) { builder.stubSettings().setCredentialsProvider(NoCredentialsProvider.create()); } instanceAdminSettings = builder.build(); } return instanceAdminSettings; }

Target:
public BigtableInstanceAdminSettings getInstanceAdminSettings() { return instanceAdminSettings; }
Source:
public SensorRecord[] getRecentSensorRecords(int numOfRecentPages) { if (numOfRecentPages < 1) { throw new IllegalArgumentException("Number of pages must be greater than 1."); } log.debug("Reading Sensor page range..."); int endPage = readDataBasePageRange(RecordType.SENSOR_DATA); log.debug("Reading " + numOfRecentPages + " Sensor page(s)..."); numOfRecentPages = numOfRecentPages - 1; SensorRecord[] allPages = new SensorRecord[0]; for (int i = Math.min(numOfRecentPages,endPage); i >= 0; i--) { int nextPage = endPage - i; log.debug("Reading #" + i + " Sensor pages (page number " + nextPage + ")"); SensorRecord[] ithSensorRecordPage = readDataBasePage(RecordType.SENSOR_DATA, nextPage); SensorRecord[] result = Arrays.copyOf(allPages, allPages.length + ithSensorRecordPage.length); System.arraycopy(ithSensorRecordPage, 0, result, allPages.length, ithSensorRecordPage.length); allPages = result; } log.debug("Read complete of Sensor pages."); return allPages; }

Target:
public SensorRecord[] getRecentSensorRecords(int numOfRecentPages) { if (numOfRecentPages < 1) { throw new IllegalArgumentException("Number of pages must be greater than 1."); } log.debug("Reading Sensor page range..."); int endPage = readDataBasePageRange(RecordType.SENSOR_DATA); log.debug("Reading Sensor page(s)...", numOfRecentPages); numOfRecentPages = numOfRecentPages - 1; SensorRecord[] allPages = new SensorRecord[0]; for (int i = Math.min(numOfRecentPages,endPage); i >= 0; i--) { int nextPage = endPage - i; log.debug("Reading #{} Sensor pages (page number {})", i, nextPage); SensorRecord[] ithSensorRecordPage = readDataBasePage(RecordType.SENSOR_DATA, nextPage); SensorRecord[] result = Arrays.copyOf(allPages, allPages.length + ithSensorRecordPage.length); System.arraycopy(ithSensorRecordPage, 0, result, allPages.length, ithSensorRecordPage.length); allPages = result; } log.debug("Read complete of Sensor pages."); return allPages; }
Source:
public static synchronized boolean reload() { LOGGER.info("Configuration is being reloaded"); InputStream stream; String defaultMaxAge; String defaultURL; String actionPath = ResourceBundle.getBundle("perseo-core").getString("action.path"); try { PROPERTIES.clear(); stream = new FileInputStream(PATH); PROPERTIES.load(stream); stream.close(); defaultURL = PROPERTIES.getProperty(ACTION_URL_PROP); defaultMaxAge = PROPERTIES.getProperty(MAX_AGE_PROP); } catch (IOException e) { defaultURL = DEFAULT_PERSEO_FE_URL; defaultMaxAge = String.valueOf(DEFAULT_MAX_AGE); } String perseoFeURLEnv = System.getenv(PERSEO_FE_URL_ENV); if (perseoFeURLEnv != null && !perseoFeURLEnv.toLowerCase().matches("^(http|https)://.*$")) { perseoFeURLEnv = "http://" + perseoFeURLEnv; } perseoFeURLEnv = perseoFeURLEnv != null ? perseoFeURLEnv : defaultURL; if (Utils.isValidURL(perseoFeURLEnv)) { actionRule = perseoFeURLEnv.contains(actionPath) ? perseoFeURLEnv : perseoFeURLEnv + actionPath; } else { LOGGER.error(String.format("Invalid value for %s: %s",PERSEO_FE_URL_ENV, perseoFeURLEnv)); return false; } LOGGER.info(String.format("actionRule configuration is: %s",actionRule)); String maxAgeEnv = System.getenv(PERSEO_MAX_AGE_ENV); try { maxAge = maxAgeEnv != null ? Long.parseLong(maxAgeEnv) : Long.parseLong(defaultMaxAge); } catch (NumberFormatException nfe) { LOGGER.error(String.format("Invalid value for %s: %s",PERSEO_MAX_AGE_ENV,nfe)); return false; } LOGGER.info(String.format("maxAge configuration is: %s",maxAge)); return true; }

Target:
public static synchronized boolean reload() { LOGGER.info("Configuration is being reloaded"); InputStream stream; String defaultMaxAge; String defaultURL; String actionPath = "/actions/do"; try { PROPERTIES.clear(); stream = new FileInputStream(PATH); PROPERTIES.load(stream); stream.close(); defaultURL = PROPERTIES.getProperty(ACTION_URL_PROP); defaultMaxAge = PROPERTIES.getProperty(MAX_AGE_PROP); } catch (IOException e) { defaultURL = DEFAULT_PERSEO_FE_URL; defaultMaxAge = String.valueOf(DEFAULT_MAX_AGE); } String perseoFeURLEnv = System.getenv(PERSEO_FE_URL_ENV); if (perseoFeURLEnv != null && !perseoFeURLEnv.toLowerCase().matches("^(http|https)://.*$")) { perseoFeURLEnv = "http://" + perseoFeURLEnv; } perseoFeURLEnv = perseoFeURLEnv != null ? perseoFeURLEnv : defaultURL; if (Utils.isValidURL(perseoFeURLEnv)) { actionRule = perseoFeURLEnv.contains(actionPath) ? perseoFeURLEnv : perseoFeURLEnv + actionPath; } else { LOGGER.error(String.format("Invalid value for %s: %s",PERSEO_FE_URL_ENV, perseoFeURLEnv)); return false; } LOGGER.info(String.format("actionRule configuration is: %s",actionRule)); String maxAgeEnv = System.getenv(PERSEO_MAX_AGE_ENV); try { maxAge = maxAgeEnv != null ? Long.parseLong(maxAgeEnv) : Long.parseLong(defaultMaxAge); } catch (NumberFormatException nfe) { LOGGER.error(String.format("Invalid value for %s: %s",PERSEO_MAX_AGE_ENV,nfe)); return false; } LOGGER.info(String.format("maxAge configuration is: %s",maxAge)); return true; }
Source:
private ParseResultCallable(String testResults, long buildTime, long nowMaster, boolean keepLongStdio) { this.buildTime = buildTime; this.testResults = testResults; this.nowMaster = nowMaster; this.keepLongStdio = keepLongStdio; this.listener = null; }

Target:
private ParseResultCallable(String testResults, long buildTime, long nowMaster, boolean keepLongStdio) { this.buildTime = buildTime; this.testResults = testResults; this.nowMaster = nowMaster; this.keepLongStdio = keepLongStdio; }
Source:
public static void reconfigure(DfsBlockCacheConfig cfg) { DfsBlockCache nc = new DfsBlockCache(cfg); DfsBlockCache oc = cache; cache = nc; if (oc != null) { if (oc.readAheadService != null) oc.readAheadService.shutdown(); for (DfsPackFile pack : oc.getPackFiles()) { pack.key.cachedSize.set(0); } } }

Target:
public static void reconfigure(DfsBlockCacheConfig cfg) { DfsBlockCache nc = new DfsBlockCache(cfg); DfsBlockCache oc = cache; cache = nc; if (oc != null) { if (oc.readAheadService != null) oc.readAheadService.shutdown(); for (DfsPackFile pack : oc.getPackFiles()) pack.key.cachedSize.set(0); } }
Source:
private RefactoringStatus check15() throws CoreException { RefactoringStatus result= new RefactoringStatus(); HashSet<IJavaProject> checkedProjects= new HashSet<>(); for (IJavaElement fElement : fElements) { IJavaProject javaProject = fElement.getJavaProject(); if (! checkedProjects.contains(javaProject)) { if (! JavaModelUtil.is50OrHigher(javaProject)) { String message= Messages.format(RefactoringCoreMessages.InferTypeArgumentsRefactoring_not50, BasicElementLabels.getJavaElementName(javaProject.getElementName())); result.addFatalError(message); } else if (! JavaModelUtil.is50OrHigherJRE(javaProject)) { String message= Messages.format(RefactoringCoreMessages.InferTypeArgumentsRefactoring_not50Library, BasicElementLabels.getJavaElementName(javaProject.getElementName())); result.addFatalError(message); } checkedProjects.add(javaProject); } } return result; }

Target:
private RefactoringStatus check15() throws CoreException { RefactoringStatus result= new RefactoringStatus(); HashSet<IJavaProject> checkedProjects= new HashSet<>(); for (IJavaElement element : fElements) { IJavaProject javaProject= element.getJavaProject(); if (! checkedProjects.contains(javaProject)) { if (! JavaModelUtil.is50OrHigher(javaProject)) { String message= Messages.format(RefactoringCoreMessages.InferTypeArgumentsRefactoring_not50, BasicElementLabels.getJavaElementName(javaProject.getElementName())); result.addFatalError(message); } else if (! JavaModelUtil.is50OrHigherJRE(javaProject)) { String message= Messages.format(RefactoringCoreMessages.InferTypeArgumentsRefactoring_not50Library, BasicElementLabels.getJavaElementName(javaProject.getElementName())); result.addFatalError(message); } checkedProjects.add(javaProject); } } return result; }
Source:
public boolean provides(IOperation operation) { if (!(operation instanceof CreateDecoratorsOperation)) { return false; } IDecoratorTarget decoratorTarget = ((CreateDecoratorsOperation) operation).getDecoratorTarget(); View view = decoratorTarget.getAdapter(View.class); return view != null && DDiagramEditPart.MODEL_ID.equals(SiriusVisualIDRegistry.getModelID(view)); }

Target:
public boolean provides(IOperation operation) { if (!(operation instanceof CreateDecoratorsOperation)) { return false; } IDecoratorTarget decoratorTarget = ((CreateDecoratorsOperation) operation).getDecoratorTarget(); View view = (View) decoratorTarget.getAdapter(View.class); return view != null && DDiagramEditPart.MODEL_ID.equals(SiriusVisualIDRegistry.getModelID(view)); }
Source:
public void addFailure(Throwable targetException) { if (targetException instanceof MultipleFailureException) { addMultipleFailureException((MultipleFailureException) targetException); } else if (targetException instanceof AssumptionViolatedException) { addFailedAssumption((AssumptionViolatedException) targetException); } else { notifier.fireTestFailure(new Failure(description, targetException)); } }

Target:
public void addFailure(Throwable targetException) { if (targetException instanceof MultipleFailureException) { addMultipleFailureException((MultipleFailureException) targetException); } else if (isAssumptionViolated(targetException)) { addFailedAssumption(targetException); } else { notifier.fireTestFailure(new Failure(description, targetException)); } }
Source:
protected final AuditRepositoryRecord createDBAuditObj(LogEventSecureRequestType mess, AssertionType assertion) { AuditRepositoryRecord auditRec = new AuditRepositoryRecord(); EventIdentificationType eventIdentification = mess.getAuditMessage().getEventIdentification(); String eventCommunityId = mess.getRemoteHCID(); LOG.info("auditSourceID : " + eventCommunityId); if (NullChecker.isNotNullish(eventCommunityId)) { auditRec.setRemoteHcid(eventCommunityId); } else { auditRec.setRemoteHcid(""); } auditRec.setDirection(mess.getDirection()); auditRec.setMessage(getBlobFromAuditMessage(mess.getAuditMessage())); XMLGregorianCalendar xMLCalDate = eventIdentification.getEventDateTime(); if (xMLCalDate != null) { auditRec.setEventTimeStamp(convertXMLGregorianCalendarToDate(xMLCalDate)); } auditRec.setOutcome(eventIdentification.getEventOutcomeIndicator().intValue()); auditRec.setEventType(mess.getEventType()); auditRec.setEventId(eventIdentification.getEventID().getDisplayName()); auditRec.setMessageId(MessageGeneratorUtils.getInstance().generateMessageId(assertion)); auditRec.setRelatesTo(getRelatesTo(assertion)); auditRec.setUserId(getUserId(mess.getAuditMessage().getActiveParticipant())); return auditRec; }

Target:
protected final AuditRepositoryRecord createDBAuditObj(LogEventSecureRequestType mess, AssertionType assertion) { AuditRepositoryRecord auditRec = new AuditRepositoryRecord(); String eventCommunityId = mess.getRemoteHCID(); LOG.info("auditSourceID : " + eventCommunityId); if (NullChecker.isNotNullish(eventCommunityId)) { auditRec.setRemoteHcid(eventCommunityId); } else { auditRec.setRemoteHcid(""); } auditRec.setDirection(mess.getDirection()); auditRec.setMessage(getBlobFromAuditMessage(mess.getAuditMessage())); XMLGregorianCalendar xMLCalDate = mess.getEventTimestamp(); if (xMLCalDate != null) { auditRec.setEventTimeStamp(convertXMLGregorianCalendarToDate(xMLCalDate)); } auditRec.setOutcome(mess.getEventOutcomeIndicator().intValue()); auditRec.setEventType(mess.getEventType()); auditRec.setEventId(mess.getEventID()); auditRec.setMessageId(MessageGeneratorUtils.getInstance().generateMessageId(assertion)); auditRec.setRelatesTo(mess.getRelatesTo()); auditRec.setUserId(mess.getUserId()); return auditRec; }
Source:
public IMerchant getMerchant(){ return merchant; }

Target:
public IMerchant getMerchant() { return this.merchant; }
Source:
public String lookupEntityName(Entity entity) { if (entity != null) { EntityEnum entityEnum = EntityEnum.getEntityEnum(entity.getEntityType()); return lookupEntityName(entityEnum, entity.getId()); } return null; }

Target:
public String lookupEntityName(Entity entity) { if (entity == null) { return null; } EntityEnum entityEnum = EntityEnum.getEntityEnum(entity.getEntityType()); return lookupEntityName(entityEnum, entity.getId()); }
Source:
public CDNContainer(String name, boolean enabled, boolean logRetention, int ttl, URI uri, URI sslUri, URI streamingUri, URI iosUri) { this.name = name; this.enabled = enabled; this.logRetention = logRetention; this.ttl = ttl; this.uri = uri; this.sslUri = sslUri; this.streamingUri = streamingUri; this.iosUri = iosUri; }

Target:
public CDNContainer(String name, boolean enabled, boolean logRetention, int ttl, URI uri, URI sslUri, URI streamingUri, URI iosUri) { this.name = checkNotNull(name, "name required"); this.enabled = enabled; this.logRetention = logRetention; this.ttl = ttl; this.uri = checkNotNull(uri, "uri required"); this.sslUri = checkNotNull(sslUri, "sslUri required"); this.streamingUri = checkNotNull(streamingUri, "streamingUri required"); this.iosUri = checkNotNull(iosUri, "iosUri required"); }
Source:
public Map<String, String> getEventHoverToolTipInfo(ITimeEvent event) { String label = event.getLabel(); if (label == null) { return null; } ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<>(); String channelType = event.getEntry().getParent().getParent().getName(); String connectionName = event.getEntry().getParent().getName(); String nodeName = event.getEntry().getParent().getParent().getParent().getName(); Pair<String, String> localRemoteHost = getLocalAndRemoteHosts(label); builder.put(Messages.AbstractRosPresentationProvider_ConnectionChannelType, channelType); builder.put(Messages.AbstractRosPresentationProvider_ConnectionName, connectionName); builder.put(Messages.AbstractRosPresentationProvider_NodeName, nodeName); builder.put(Messages.AbstractRosPresentationProvider_ConnectionHosts, StringUtils.EMPTY); builder.put(TAB + Messages.AbstractRosPresentationProvider_ConnectionHostLocal, localRemoteHost.getFirst()); builder.put(TAB + Messages.AbstractRosPresentationProvider_ConnectionHostRemote, localRemoteHost.getSecond()); return builder.build(); }

Target:
public Map<String, String> getEventHoverToolTipInfo(ITimeEvent event) { String label = event.getLabel(); if (label == null) { return Collections.emptyMap(); } ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<>(); String channelType = event.getEntry().getParent().getParent().getName(); String connectionName = event.getEntry().getParent().getName(); String nodeName = event.getEntry().getParent().getParent().getParent().getName(); Pair<String, String> localRemoteHost = getLocalAndRemoteHosts(label); builder.put(Messages.AbstractRosPresentationProvider_ConnectionChannelType, channelType); builder.put(Messages.AbstractRosPresentationProvider_ConnectionName, connectionName); builder.put(Messages.AbstractRosPresentationProvider_NodeName, nodeName); builder.put(Messages.AbstractRosPresentationProvider_ConnectionHosts, StringUtils.EMPTY); builder.put(TAB + Messages.AbstractRosPresentationProvider_ConnectionHostLocal, localRemoteHost.getFirst()); builder.put(TAB + Messages.AbstractRosPresentationProvider_ConnectionHostRemote, localRemoteHost.getSecond()); return builder.build(); }
Source:
private String constructQueryArgs(String primaryKeySelection, String[] primaryKeySelectionArgs) { String queryArgsString = primaryKeySelection; for (int i = 0; i < primaryKeySelectionArgs.length; i++) { if (primaryKeySelectionArgs[i] == null) { queryArgsString = queryArgsString.replaceFirst("= \\?", "IS NULL"); } else { queryArgsString = queryArgsString.replaceFirst("\\?", "\"" + primaryKeySelectionArgs[i] + "\""); } } return queryArgsString; }

Target:
private String constructQueryArgs(String primaryKeySelection, String[] primaryKeySelectionArgs) { String queryArgsString = primaryKeySelection; for (String argument : primaryKeySelectionArgs) { if (argument == null) { queryArgsString = queryArgsString.replaceFirst("= \\?", "IS NULL"); } else { queryArgsString = queryArgsString.replaceFirst("\\?", "\"" + argument + "\""); } } return queryArgsString; }
Source:
public AdaptiveFeatureGenerator create(Element generatorElement, FeatureGeneratorResourceProvider resourceManager) throws InvalidFormatException { Collection<AdaptiveFeatureGenerator> aggregatedGenerators = new LinkedList<>(); NodeList childNodes = generatorElement.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node childNode = childNodes.item(i); if (childNode instanceof Element) { Element aggregatedGeneratorElement = (Element) childNode; aggregatedGenerators.add( GeneratorFactory.createGenerator(aggregatedGeneratorElement, resourceManager)); } } return new TokenNormalizerFeatureGenerator(new AggregatedFeatureGenerator(aggregatedGenerators.toArray( new AdaptiveFeatureGenerator[aggregatedGenerators.size()]))); }

Target:
public AdaptiveFeatureGenerator create(Element generatorElement, FeatureGeneratorResourceProvider resourceManager) throws InvalidFormatException { Collection<AdaptiveFeatureGenerator> aggregatedGenerators = new LinkedList<>(); NodeList childNodes = generatorElement.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node childNode = childNodes.item(i); if (childNode instanceof Element) { Element aggregatedGeneratorElement = (Element) childNode; aggregatedGenerators.add( GeneratorFactory.createGenerator(aggregatedGeneratorElement, resourceManager)); } } TokenNormalizerFeatureGenerator featureGenerator = null; String normalizerClassName = generatorElement.getAttribute("class"); if (normalizerClassName != null && !normalizerClassName.isEmpty()) { TokenNormalizer tokenNormalizer = ExtensionLoader.instantiateExtension(TokenNormalizer.class, normalizerClassName); featureGenerator = new TokenNormalizerFeatureGenerator(tokenNormalizer, new AggregatedFeatureGenerator(aggregatedGenerators.toArray( new AdaptiveFeatureGenerator[aggregatedGenerators.size()]))); } if (featureGenerator == null) { featureGenerator = new TokenNormalizerFeatureGenerator( new AggregatedFeatureGenerator(aggregatedGenerators.toArray( new AdaptiveFeatureGenerator[aggregatedGenerators.size()]))); } return featureGenerator; }
Source:
public void onPageRequest(final PageRequest request) { final Map<Integer, Integer> calendars = new HashMap<Integer, Integer>(); Integer CalendarId = 1; calendars.put(CalendarId++, getProject().getId()); calendars.put(CalendarId++, getProject().getCalendarId()); calendars.put(CalendarId++, getProject().getPointsList().getId()); calendars.put(CalendarId++, getProject().getRemindersList().getId()); if (!getProject().getFunded().isEmpty()) { for (int i = 0; i < getProject().getFunded().size(); i++) { calendars.put(CalendarId++, getProject().getFunded().get(i).getFunded().getId()); calendars.put(CalendarId++, getProject().getFunded().get(i).getFunded().getCalendarId()); calendars.put(CalendarId++, getProject().getFunded().get(i).getFunded().getPointsList().getId()); calendars.put(CalendarId++, getProject().getFunded().get(i).getFunded().getRemindersList().getId()); } } if (!getProject().getFunding().isEmpty()) { for (int i = 0; i < getProject().getFunding().size(); i++) { calendars.put(CalendarId++, getProject().getFunding().get(i).getFunding().getId()); calendars.put(CalendarId++, getProject().getFunding().get(i).getFunding().getCalendarId()); calendars.put(CalendarId++, getProject().getFunding().get(i).getFunding().getPointsList().getId()); calendars.put(CalendarId++, getProject().getFunding().get(i).getFunding().getRemindersList().getId()); } } calendarPresenter.reload(calendars); }

Target:
public void onPageRequest(final PageRequest request) { final Map<Integer, Integer> calendars = new HashMap<Integer, Integer>(); Integer calendarId = 1; calendars.put(calendarId++, getProject().getId()); calendars.put(calendarId++, getProject().getCalendarId()); calendars.put(calendarId++, getProject().getPointsList().getId()); calendars.put(calendarId++, getProject().getRemindersList().getId()); if (!getProject().getFunded().isEmpty()) { for (int i = 0; i < getProject().getFunded().size(); i++) { calendars.put(calendarId++, getProject().getFunded().get(i).getFunded().getId()); calendars.put(calendarId++, getProject().getFunded().get(i).getFunded().getCalendarId()); calendars.put(calendarId++, getProject().getFunded().get(i).getFunded().getPointsList().getId()); calendars.put(calendarId++, getProject().getFunded().get(i).getFunded().getRemindersList().getId()); } } if (!getProject().getFunding().isEmpty()) { for (int i = 0; i < getProject().getFunding().size(); i++) { calendars.put(calendarId++, getProject().getFunding().get(i).getFunding().getId()); calendars.put(calendarId++, getProject().getFunding().get(i).getFunding().getCalendarId()); calendars.put(calendarId++, getProject().getFunding().get(i).getFunding().getPointsList().getId()); calendars.put(calendarId++, getProject().getFunding().get(i).getFunding().getRemindersList().getId()); } } calendarPresenter.reload(calendars); }
Source:
private Map<String, Layout> getLayouts(List<String> layoutServers, Boolean discoverLayoutServers) { Map<String, CompletableFuture<Layout>> layoutFuturesMap = getLayoutFutures(layoutServers); Map<String, Layout> layoutMap = new HashMap<>(); for (Entry<String, CompletableFuture<Layout>> entry : layoutFuturesMap.entrySet()) { try { Layout nodeLayout = entry.getValue().get(); log.debug("Server:{} responded with layout: {}", entry.getKey(), nodeLayout); layoutMap.put(entry.getKey(), nodeLayout); } catch (Exception e) { log.error("getClusterStatus: Error while fetching layout from {}. Exception: {}", entry.getKey(), e); } } if (discoverLayoutServers) { List<String> discoveredLayoutServers = layoutMap.values().stream() .map(l -> l.getLayoutServers()) .flatMap(s -> s.stream()) .distinct() .filter(s -> !layoutServers.contains(s)) .collect(Collectors.toList()); if (!discoveredLayoutServers.isEmpty()) { Map <String, Layout> recursiveLayouts = getLayouts(new ArrayList<>(discoveredLayoutServers), false); layoutMap.putAll(recursiveLayouts); } } return layoutMap; }

Target:
private Map<String, Layout> getLayouts(List<String> layoutServers, Boolean discoverLayoutServers) { Map<String, CompletableFuture<Layout>> layoutFuturesMap = getLayoutFutures(layoutServers); Map<String, Layout> layoutMap = new HashMap<>(); for (Entry<String, CompletableFuture<Layout>> entry : layoutFuturesMap.entrySet()) { try { Layout nodeLayout = entry.getValue().get(); log.debug("Server:{} responded with layout: {}", entry.getKey(), nodeLayout); layoutMap.put(entry.getKey(), nodeLayout); } catch (Exception e) { log.error("getClusterStatus: Error while fetching layout from {}. Exception: ", entry.getKey(), e); } } if (discoverLayoutServers) { List<String> discoveredLayoutServers = layoutMap.values().stream() .map(layout -> layout.getLayoutServers()) .flatMap(servers -> servers.stream()) .distinct() .filter(servers -> !layoutServers.contains(servers)) .collect(Collectors.toList()); if (!discoveredLayoutServers.isEmpty()) { Map <String, Layout> recursiveLayouts = getLayouts(new ArrayList<>(discoveredLayoutServers), false); layoutMap.putAll(recursiveLayouts); } } return layoutMap; }
Source:
private static String writeSuppressWarnings() { return "@SuppressWarnings({ \"deprecation\", \"rawtypes\", \"serial\" })"; }

Target:
private static String writeSuppressWarnings() { return "@SuppressWarnings({ \"deprecation\", \"rawtypes\" })"; }
Source:
public void deleteAssignments(List<Assignment> assignments) { EKBCommit commit = getEKBCommit(); preparePersistenceAccess(); for (Assignment assignment : assignments) { List<Role> result = queryService.queryByString(Role.class, "uuid:\"" + assignment.getUuid() + "\""); if (result.size() == 0) { LOGGER.warn("User {1} does not exist.", assignment.getUuid()); } else { commit.addDelete(assignment); } } persistService.commit(commit); revokePersistenceAccess(); }

Target:
public void deleteAssignments(List<Assignment> assignments) { EKBCommit commit = getEKBCommit(); preparePersistenceAccess(); for (Assignment assignment : assignments) { List<Role> result = queryService.query(Role.class, QueryRequest.query("uuid", assignment.getUuid())); if (result.size() == 0) { LOGGER.warn("User {1} does not exist.", assignment.getUuid()); } else { commit.addDelete(assignment); } } persistService.commit(commit); revokePersistenceAccess(); }
Source:
private GraphQLInputType inputTypeOf(String type) { type = type.trim(); if (type.startsWith("[")) { return new GraphQLList(inputTypeOf(type.substring(1, type.length() - 1))); } switch (type) { case "Int": return Scalars.GraphQLInt; case "String": return Scalars.GraphQLString; case "Boolean": return Scalars.GraphQLBoolean; case "Float": return Scalars.GraphQLBoolean; default: throw new IllegalStateException(String.format("Invalid GraphQLType: %s", type)); } }

Target:
private GraphQLInputType inputTypeOf(String type) { type = type.trim(); if (type.startsWith("[")) { return new GraphQLList(inputTypeOf(type.substring(1, type.length() - 1))); } switch (type) { case "Int": return Scalars.GraphQLInt; case "String": return Scalars.GraphQLString; case "Boolean": return Scalars.GraphQLBoolean; case "Float": return Scalars.GraphQLFloat; default: throw new IllegalStateException(String.format("Invalid GraphQLType: %s", type)); } }
Source:
private void updateEid() { List<UiccCardInfo> infos = mTelephonyManager.getUiccCardsInfo(); if (infos != null) { for (UiccCardInfo info : infos) { if (info.getSlotIndex() == mSlotId) { if (info.isEuicc()) { String eid = info.getEid(); if (eid != null) { mDialog.setText(EID_INFO_VALUE_ID, eid); } } else { mDialog.removeSettingFromScreen(EID_INFO_LABEL_ID); mDialog.removeSettingFromScreen(EID_INFO_VALUE_ID); } break; } } } }

Target:
private void updateEid() { List<UiccCardInfo> infos = mTelephonyManager.getUiccCardsInfo(); if (!infos.isEmpty()) { for (UiccCardInfo info : infos) { if (info != null && info.getSlotIndex() == mSlotId) { if (info.isEuicc()) { String eid = info.getEid(); if (!TextUtils.isEmpty(eid)) { mDialog.setText(EID_INFO_VALUE_ID, eid); } } else { mDialog.removeSettingFromScreen(EID_INFO_LABEL_ID); mDialog.removeSettingFromScreen(EID_INFO_VALUE_ID); } break; } } } }
Source:
public static void add(Tech tech) { Assert.isNonEmpty(tech); if (tech.getParent() == null) { topLevelTech.add(tech); } allTech.add(tech); }

Target:
public static void add(Tech tech) { Assert.isNonEmpty(tech); if (tech.getParent() != null) { topLevelTech.add(tech); } allTech.add(tech); }
Source:
private Requirement getRequirementType(ThriftStructFieldInfo f) { if (f.isOptional() && !f.isRequired()) { return OPTIONAL; } else if (f.isRequired() && !f.isOptional()) { return REQUIRED; } else if (!f.isOptional() && !f.isRequired()) { return DEFAULT; } else { throw new RuntimeException("can not determine requirement type for : " + f.toString() + ", isOptional=" + f.isOptional() + ", isRequired=" + f.isRequired()); } }

Target:
private Requirement getRequirementType(ThriftStructFieldInfo f) { if (f.isOptional() && !f.isRequired()) { return OPTIONAL; } else if (f.isRequired() && !f.isOptional()) { return REQUIRED; } else if (!f.isOptional() && !f.isRequired()) { return DEFAULT; } else { throw new ScroogeSchemaConversionException("can not determine requirement type for : " + f.toString() + ", isOptional=" + f.isOptional() + ", isRequired=" + f.isRequired()); } }
Source:
public void testTaskWithEnableAutoClaimTaskWithActorAndGroup() throws Exception { TestWorkItemManager manager = new TestWorkItemManager(); env.set("Autoclaim", new String("true")); ksession.setEnvironment(env); ksession.setWorkItemManager(manager); WorkItemImpl workItem = new WorkItemImpl(); workItem.setName("Human Task"); workItem.setParameter("NodeName", "TaskName"); workItem.setParameter("Comment", "Comment"); workItem.setParameter("Priority", "10"); workItem.setParameter("GroupId", "Crusaders"); workItem.setParameter("ActorId", "Darth Vader"); workItem.setParameter("SwimlaneActorId", "Darth Vader"); workItem.setProcessInstanceId(10); handler.executeWorkItem(workItem, manager); List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("Darth Vader", "en-UK"); assertEquals(1, tasks.size()); TaskSummary task = tasks.get(0); assertEquals("TaskName", task.getName()); assertEquals(10, task.getPriority().intValue()); assertEquals("Comment", task.getDescription()); assertEquals(Status.Reserved, task.getStatus()); assertEquals("Darth Vader", task.getActualOwner().getId()); assertEquals(10, task.getProcessInstanceId().intValue()); taskService.start(task.getId(), "Darth Vader"); taskService.complete(task.getId(), "Darth Vader", null); assertTrue(manager.waitTillCompleted(MANAGER_COMPLETION_WAIT_TIME)); }

Target:
public void testTaskWithEnableAutoClaimTaskWithActorAndGroup() throws Exception { TestWorkItemManager manager = new TestWorkItemManager(); env.set("Autoclaim", "true"); ksession.setEnvironment(env); ksession.setWorkItemManager(manager); WorkItemImpl workItem = new WorkItemImpl(); workItem.setName("Human Task"); workItem.setParameter("NodeName", "TaskName"); workItem.setParameter("Comment", "Comment"); workItem.setParameter("Priority", "10"); workItem.setParameter("GroupId", "Crusaders"); workItem.setParameter("ActorId", "Darth Vader"); workItem.setParameter("SwimlaneActorId", "Darth Vader"); workItem.setProcessInstanceId(10); handler.executeWorkItem(workItem, manager); List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("Darth Vader", "en-UK"); assertEquals(1, tasks.size()); TaskSummary task = tasks.get(0); assertEquals("TaskName", task.getName()); assertEquals(10, task.getPriority().intValue()); assertEquals("Comment", task.getDescription()); assertEquals(Status.Reserved, task.getStatus()); assertEquals("Darth Vader", task.getActualOwner().getId()); assertEquals(10, task.getProcessInstanceId().intValue()); taskService.start(task.getId(), "Darth Vader"); taskService.complete(task.getId(), "Darth Vader", null); assertTrue(manager.waitTillCompleted(MANAGER_COMPLETION_WAIT_TIME)); }
Source:
public RegexFormatter(String input) { Objects.requireNonNull(input); input = input.trim(); Matcher constructorArgument = CONSTRUCTOR_ARGUMENT.matcher(input); if (constructorArgument.matches()) { regex = constructorArgument.group(REGEX_CAPTURING_GROUP); replacement = constructorArgument.group(REPLACEMENT_CAPTURING_GROUP); } else { regex = null; replacement = null; LOGGER.warn("RegexFormatter could not parse the input: " + input); } }

Target:
public RegexFormatter(String input) { Objects.requireNonNull(input); input = input.trim(); Matcher constructorArgument = CONSTRUCTOR_ARGUMENT.matcher(input); if (constructorArgument.matches()) { regex = constructorArgument.group(REGEX_CAPTURING_GROUP); replacement = constructorArgument.group(REPLACEMENT_CAPTURING_GROUP); } else { regex = null; replacement = null; LOGGER.warn("RegexFormatter could not parse the input: {}", input); } }
Source:
public StreamPerformanceTest() { metricRegistry = CorfuRuntime.getDefaultMetrics(); producerTimer = metricRegistry.timer(METRIC_PREFIX + "stream-producer"); consumerTimer = metricRegistry.timer(METRIC_PREFIX + "stream-consumer"); }

Target:
public StreamPerformanceTest() { producerTimer = metricRegistry.timer(METRIC_PREFIX + "stream-producer"); consumerTimer = metricRegistry.timer(METRIC_PREFIX + "stream-consumer"); }
Source:
public void testIsDrawable_Stage() throws Exception { testIsDrawable(CaseManagementDiagram.class, AdHocSubprocess.class, true); }

Target:
public void testIsDrawable_Stage() { testIsDrawable(CaseManagementDiagram.class, AdHocSubprocess.class, true); }
Source:
private List<IndexEntry> getIndexEntries(IndexSegment indexSegment) throws StoreException { diskIOScheduler.getSlice(BlobStoreStats.IO_SCHEDULER_JOB_TYPE, BlobStoreStats.IO_SCHEDULER_JOB_ID, 1); List<IndexEntry> indexEntries = new ArrayList<>(); try { indexSegment.getIndexEntriesSince(null, new FindEntriesCondition(Integer.MAX_VALUE), indexEntries, new AtomicLong(0)); } catch (IOException e) { throw new StoreException("I/O exception while getting entries from index segment", e, StoreErrorCodes.IOError); } return indexEntries; }

Target:
private List<IndexEntry> getIndexEntries(IndexSegment indexSegment) throws StoreException { List<IndexEntry> indexEntries = new ArrayList<>(); try { indexSegment.getIndexEntriesSince(null, new FindEntriesCondition(Integer.MAX_VALUE), indexEntries, new AtomicLong(0)); diskIOScheduler.getSlice(BlobStoreStats.IO_SCHEDULER_JOB_TYPE, BlobStoreStats.IO_SCHEDULER_JOB_ID, indexEntries.size()); } catch (IOException e) { throw new StoreException( String.format("I/O exception while getting entries from index segment for store %s", storeId), e, StoreErrorCodes.IOError); } return indexEntries; }
Source:
public boolean isQualifiedNameDisplay(View labelView) { boolean QNDisplayed; String depth = NotationUtils.getStringValue(labelView, StereotypeDisplayUtils.STEREOTYPE_LABEL_DEPTH, StereotypeDisplayUtils.DEFAULT_DEPTH_VALUE); QNDisplayed = StereotypeDisplayUtils.DEPTH_MAX.equals(depth); return QNDisplayed; }

Target:
public boolean isQualifiedNameDisplay(View labelView) { String depth = NotationUtils.getStringValue(labelView, StereotypeDisplayUtils.STEREOTYPE_LABEL_DEPTH, StereotypeDisplayUtils.DEFAULT_DEPTH_VALUE); return StereotypeDisplayUtils.DEPTH_MAX.equals(depth); }
Source:
public void invalidateUpTo(long trimMark) { log.debug("Invalidate sequencer cache. Trim mark: {}", trimMark); long entries = 0; for (ConflictTxStream key : conflictCache.asMap().keySet()) { Long currTrimMark = getIfPresent(key); if (currTrimMark == null || currTrimMark >= trimMark) { continue; } conflictCache.invalidate(key); entries++; } log.info("Evicted entries: {}", entries); }

Target:
public void invalidateUpTo(long trimMark) { log.debug("Invalidate sequencer cache. Trim mark: {}", trimMark); AtomicLong entries = new AtomicLong(); conflictCache.asMap().forEach((key, txVersion) -> { if (txVersion == null || txVersion >= trimMark) { return; } conflictCache.invalidate(key); entries.incrementAndGet(); }); log.info("Invalidated entries: {}", entries.get()); }
Source:
private PhysicalPlans.PhysicalPlan constructPhysicalPlan() { PhysicalPlans.PhysicalPlan.Builder physicalPlanBuilder = PhysicalPlans.PhysicalPlan.newBuilder(); TopologyBuilder topologyBuilder = new TopologyBuilder(); initSpout(topologyBuilder, Component.SPOUT.getName()); initBoltA(topologyBuilder, Component.BOLT_A.getName(), Component.SPOUT.getName()); initBoltB(topologyBuilder, Component.BOLT_B.getName(), Component.BOLT_A.getName()); Config conf = new Config(); conf.setTeamEmail("streaming-compute@twitter.com"); conf.setTeamName("stream-computing"); conf.setTopologyProjectName("heron-integration-test"); conf.setNumStmgrs(1); conf.setMaxSpoutPending(100); conf.setEnableAcking(false); TopologyAPI.Topology topology = topologyBuilder.createTopology() .setName("topology-name") .setConfig(conf) .setState(TopologyAPI.TopologyState.RUNNING) .getTopology(); physicalPlanBuilder.setTopology(topology); int taskId = 0; for (Component component : Component.values()) { addComponent(physicalPlanBuilder, component, taskId++); } PhysicalPlans.StMgr.Builder stmgr = PhysicalPlans.StMgr.newBuilder(); stmgr.setId("stream-manager-id"); stmgr.setHostName("127.0.0.1"); stmgr.setDataPort(8888); stmgr.setLocalEndpoint("endpoint"); physicalPlanBuilder.addStmgrs(stmgr); return physicalPlanBuilder.build(); }

Target:
private PhysicalPlans.PhysicalPlan constructPhysicalPlan() { PhysicalPlans.PhysicalPlan.Builder physicalPlanBuilder = PhysicalPlans.PhysicalPlan.newBuilder(); TopologyBuilder topologyBuilder = new TopologyBuilder(); initSpout(topologyBuilder, Component.SPOUT.getName()); initBoltA(topologyBuilder, Component.BOLT_A.getName(), Component.SPOUT.getName()); initBoltB(topologyBuilder, Component.BOLT_B.getName(), Component.BOLT_A.getName()); Config conf = new Config(); conf.setTeamEmail("some-team@company.com"); conf.setTeamName("some-team"); conf.setTopologyProjectName("heron-integration-test"); conf.setNumStmgrs(1); conf.setMaxSpoutPending(100); conf.setEnableAcking(false); TopologyAPI.Topology topology = topologyBuilder.createTopology() .setName("topology-name") .setConfig(conf) .setState(TopologyAPI.TopologyState.RUNNING) .getTopology(); physicalPlanBuilder.setTopology(topology); int taskId = 0; for (Component component : Component.values()) { addComponent(physicalPlanBuilder, component, taskId++); } PhysicalPlans.StMgr.Builder stmgr = PhysicalPlans.StMgr.newBuilder(); stmgr.setId("stream-manager-id"); stmgr.setHostName("127.0.0.1"); stmgr.setDataPort(8888); stmgr.setLocalEndpoint("endpoint"); physicalPlanBuilder.addStmgrs(stmgr); return physicalPlanBuilder.build(); }
Source:
public void deadlockDetectionEnabled() throws Exception { deadlockDetectionEnabled = true; Ignite ign = startGrid(); IgniteCache<Object, Object> cache = ign.createCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME) .setAtomicityMode(TRANSACTIONAL_SNAPSHOT)); CyclicBarrier b = new CyclicBarrier(2); IgniteInternalFuture<?> futA = GridTestUtils.runAsync(() -> { try (Transaction tx = ign.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { cache.put(1, 'a'); b.await(); cache.put(2, 'a'); } return null; }); IgniteInternalFuture<?> futB = GridTestUtils.runAsync(() -> { try (Transaction tx = ign.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { cache.put(2, 'b'); b.await(); cache.put(1, 'b'); } return null; }); IgniteCheckedException e = awaitCompletion(futA, futB); assertTrue(e.toString(), e.hasCause(IgniteTxRollbackCheckedException.class)); }

Target:
public void deadlockDetectionEnabled() throws Exception { deadlockDetectionEnabled = true; Ignite ign = startGrid(); IgniteCache<Object, Object> cache = ign.createCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME) .setAtomicityMode(TRANSACTIONAL_SNAPSHOT)); CyclicBarrier b = new CyclicBarrier(2); IgniteInternalFuture<?> futA = GridTestUtils.runAsync(() -> { try (Transaction tx = ign.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { cache.put(1, 'a'); b.await(); cache.put(2, 'a'); } return null; }); IgniteInternalFuture<?> futB = GridTestUtils.runAsync(() -> { try (Transaction tx = ign.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { cache.put(2, 'b'); b.await(); cache.put(1, 'b'); } return null; }); IgniteCheckedException e = awaitCompletion(futA, futB); assertTrue(e.toString(), X.hasCause(e, "Deadlock", IgniteTxRollbackCheckedException.class)); }
Source:
public void testCompaction() throws Exception { FileReftableStack stack = new FileReftableStack(new File(tmp, "refs"), tmp, null, () -> new Config()); int N = 1024; for (int i = 1; i < N; i++) { final int j = i; String name = String.format("refs/heads/branch%d", Integer.valueOf(i)); Ref r = newRef(name, ObjectId.zeroId()); boolean ok = stack.addReftable(rw -> { rw.setMinUpdateIndex(j).setMaxUpdateIndex(j).begin() .writeRef(r); }); assertTrue(ok); } MergedReftable table = stack.getMergedReftable(); for (int i = 1; i < N; i++) { String name = String.format("refs/heads/branch%d", Integer.valueOf(i)); RefCursor c = table.seekRef(name); assertTrue(c.next()); assertEquals(ObjectId.zeroId(), c.getRef().getObjectId()); } List<String> files = Arrays.asList(tmp.listFiles()).stream() .map(x -> x.getName()).collect(Collectors.toList()); Collections.sort(files); assertTrue(files.size() < 20); FileReftableStack.CompactionStats stats = stack.getStats(); assertTrue(stats.count < N); }

Target:
public void testCompaction() throws Exception { FileReftableStack stack = new FileReftableStack(new File(reftableDir, "refs"), reftableDir, null, () -> new Config()); int N = 1024; for (int i = 1; i < N; i++) { final int j = i; String name = String.format("refs/heads/branch%d", Integer.valueOf(i)); Ref r = newRef(name, ObjectId.zeroId()); boolean ok = stack.addReftable(rw -> { rw.setMinUpdateIndex(j).setMaxUpdateIndex(j).begin() .writeRef(r); }); assertTrue(ok); } MergedReftable table = stack.getMergedReftable(); for (int i = 1; i < N; i++) { String name = String.format("refs/heads/branch%d", Integer.valueOf(i)); RefCursor c = table.seekRef(name); assertTrue(c.next()); assertEquals(ObjectId.zeroId(), c.getRef().getObjectId()); } List<String> files = Arrays.asList(reftableDir.listFiles()).stream() .map(File::getName).collect(Collectors.toList()); Collections.sort(files); assertTrue(files.size() < 20); FileReftableStack.CompactionStats stats = stack.getStats(); assertTrue(stats.count < N); }
Source:
public static void openFile(String pathName, String fromLine, String toLine, String editorID) { String fileName = CheatSheetUtil.replaceProjectName(pathName); IPath path = new Path(fileName); IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); IFile file = workspaceRoot.getFile(path); if (!file.exists()) { setStatusMessage(page,NLS.bind(Messages.OpenFileInEditor_Cannot_open, path)); return; } IEditorPart editor = null; try { if (editorID != null && editorID.trim().length() > 0) { try { editor = IDE.openEditor(page, file, editorID, true); } catch (Exception e) { } } if (editor == null) { editor = IDE.openEditor(page, file, true); } } catch (PartInitException e) { setStatusMessage(page,NLS.bind(Messages.OpenFileInEditor_Cannot_open, path)); return; } ITextEditor textEditor = CheatSheetUtil.getTextEditor(editor); if (fromLine != null && textEditor != null) { try { int lineStart = Integer.parseInt(fromLine); int lineEnd = lineStart; if (toLine != null) { lineEnd = Integer.parseInt(toLine); } IDocument document = textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput()); IRegion lineInfoStart = document.getLineInformation(lineStart-1); IRegion lineInfoEnd = document.getLineInformation(lineEnd-1); textEditor.selectAndReveal(lineInfoStart.getOffset(), lineInfoEnd.getOffset() - lineInfoStart.getOffset() + lineInfoEnd.getLength()); } catch (Exception e) { setStatusMessage(page, e.getLocalizedMessage()); } } }

Target:
public static void openFile(String pathName, String fromLine, String toLine, String editorID) { String fileName = pathName; IPath path = new Path(fileName); IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); IFile file = workspaceRoot.getFile(path); if (!file.exists()) { setStatusMessage(page,NLS.bind(Messages.OpenFileInEditor_Cannot_open, path)); return; } IEditorPart editor = null; try { if (editorID != null && editorID.trim().length() > 0) { try { editor = IDE.openEditor(page, file, editorID, true); } catch (Exception e) { } } if (editor == null) { editor = IDE.openEditor(page, file, true); } } catch (PartInitException e) { setStatusMessage(page,NLS.bind(Messages.OpenFileInEditor_Cannot_open, path)); return; } ITextEditor textEditor = CheatSheetUtil.getTextEditor(editor); if (fromLine != null && textEditor != null) { try { int lineStart = Integer.parseInt(fromLine); int lineEnd = lineStart; if (toLine != null) { lineEnd = Integer.parseInt(toLine); } IDocument document = textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput()); IRegion lineInfoStart = document.getLineInformation(lineStart-1); IRegion lineInfoEnd = document.getLineInformation(lineEnd-1); textEditor.selectAndReveal(lineInfoStart.getOffset(), lineInfoEnd.getOffset() - lineInfoStart.getOffset() + lineInfoEnd.getLength()); } catch (Exception e) { setStatusMessage(page, e.getLocalizedMessage()); } } }
Source:
public boolean verifyAddVm(List<String> reasons, int nicsCount, int vmPriority, MacPool macPool) { if (!verifyMacPool(reasons, nicsCount, macPool)) { return false; } else if (!isVmPriorityValueLegal(vmPriority, reasons)) { return false; } return true; }

Target:
public boolean verifyAddVm(List<String> reasons, int nicsCount, int vmPriority, MacPool macPool) { return !verifyMacPool(reasons, nicsCount, macPool) && isVmPriorityValueLegal(vmPriority, reasons); }
Source:
protected void apply(final TruthVersusEval truthVersusEval, final ReadsContext readsContext, final ReferenceContext refContext) { final ConcordanceState concordanceState = truthVersusEval.getConcordance(); if (truthVersusEval.getTruthIfPresentElseEval().isSNP()) { snpCounts.get(concordanceState).increment(); } else { indelCounts.get(concordanceState).increment(); } if (concordanceState == ConcordanceState.TRUE_POSITIVE) { writeTruePositive(truthVersusEval); } else if (concordanceState == ConcordanceState.FALSE_POSITIVE) { writeFalsePositive(truthVersusEval); } else if (concordanceState == ConcordanceState.FALSE_NEGATIVE) { writeFalseNegative(truthVersusEval); } else if (concordanceState == ConcordanceState.FILTERED_TRUE_NEGATIVE) { return; } else if (concordanceState == ConcordanceState.FILTERED_FALSE_NEGATIVE) { writeFilteredFalseNegative(truthVersusEval); } else { throw new IllegalStateException("Unexpected ConcordanceState: " + concordanceState.toString()); } }

Target:
protected void apply(final TruthVersusEval truthVersusEval, final ReadsContext readsContext, final ReferenceContext refContext) { final ConcordanceState concordanceState = truthVersusEval.getConcordance(); if (truthVersusEval.getTruthIfPresentElseEval().isSNP()) { snpCounts.get(concordanceState).increment(); } else { indelCounts.get(concordanceState).increment(); } switch (concordanceState) { case TRUE_POSITIVE: writeTruePositive(truthVersusEval); break; case FALSE_POSITIVE: writeFalsePositive(truthVersusEval); break; case FALSE_NEGATIVE: writeFalseNegative(truthVersusEval); break; case FILTERED_TRUE_NEGATIVE: writeFilteredTrueNegative(truthVersusEval); break; case FILTERED_FALSE_NEGATIVE: writeFilteredFalseNegative(truthVersusEval); break; default: throw new IllegalStateException("Unexpected ConcordanceState: " + concordanceState.toString()); } }