auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static String getIdentifiableComponentName(Component component) { if (component.getAlias() != null) { return component.getAlias(); } switch (component.getType()) { case EDITOR_COMPONENT_TYPE: case PLUGIN_COMPONENT_TYPE: return component.getId(); case DOCKERIMAGE_COMPONENT_TYPE: return component.getImage(); case KUBERNETES_COMPONENT_TYPE: case OPENSHIFT_COMPONENT_TYPE: return component.getReference(); default: return null; } }

Target:
public static String getIdentifiableComponentName(Component component) throws IllegalStateException { if (component.getAlias() != null) { return component.getAlias(); } switch (component.getType()) { case EDITOR_COMPONENT_TYPE: case PLUGIN_COMPONENT_TYPE: return component.getId(); case DOCKERIMAGE_COMPONENT_TYPE: return component.getImage(); case KUBERNETES_COMPONENT_TYPE: case OPENSHIFT_COMPONENT_TYPE: return component.getReference(); default: throw new IllegalStateException( format("Unhandled component type: %s", component.getType())); } }
Source:
private static boolean shouldServiceVersionBeTested(KeyServiceVersion serviceVersion) { if (Configuration.getGlobalConfiguration().get(AZURE_TEST_SERVICE_VERSIONS) == null) { return KeyServiceVersion.getLatest().equals(serviceVersion); } return true; }

Target:
private static boolean shouldServiceVersionBeTested(KeyServiceVersion serviceVersion) { if (CoreUtils.isNullOrEmpty(SERVICE_VERSION_FROM_ENV)) { return KeyServiceVersion.getLatest().equals(serviceVersion); } if (AZURE_TEST_SERVICE_VERSIONS_VALUE_ALL.equalsIgnoreCase(SERVICE_VERSION_FROM_ENV)) { return true; } String[] configuredServiceVersionList = SERVICE_VERSION_FROM_ENV.split(","); return Arrays.stream(configuredServiceVersionList).anyMatch(configuredServiceVersion -> serviceVersion.toString().equals(configuredServiceVersion.trim())); }
Source:
public boolean hasUserData() { return userData != null; }

Target:
public boolean hasUserData() { return userData != null && !userData.isEmpty(); }
Source:
public void preListeners(boolean render) { ArrayList<TickListener> list; if (render) { list = renderListeners; } else { list = gameListeners; } for (TickListener tl : list) { try { tl.preTick(); } catch (Exception ex) { log.log(LogLevel.ERROR, "Error in preTick!"); ex.printStackTrace(); } } }

Target:
public void preListeners(boolean render) { ArrayList<TickListener> list; if (render) { list = renderListeners; } else { list = gameListeners; } for (TickListener tl : list) { try { tl.preTick(); } catch (Exception ex) { log.log(LogLevel.ERROR, "Error in preTick:\t" + ex.getMessage()); ex.printStackTrace(); } } }
Source:
private Map<SystemStreamPartition, List<IncomingMessageEnvelope>> processResults(ConsumerRecords<K, V> records) { if (records == null) { return Collections.emptyMap(); } int capacity = (int) (records.count() / 0.75 + 1); Map<SystemStreamPartition, List<IncomingMessageEnvelope>> results = new HashMap<>(capacity); for (ConsumerRecord<K, V> r : records) { int partition = r.partition(); String topic = r.topic(); TopicPartition tp = new TopicPartition(topic, partition); updateMetrics(r, tp); SystemStreamPartition ssp = topicPartitions2SSP.get(tp); List<IncomingMessageEnvelope> listMsgs = results.get(ssp); if (listMsgs == null) { listMsgs = new ArrayList<>(); results.put(ssp, listMsgs); } final K key = r.key(); final Object value = r.value(); IncomingMessageEnvelope imEnvelope = new IncomingMessageEnvelope(ssp, String.valueOf(r.offset()), key, value, getRecordSize(r)); listMsgs.add(imEnvelope); } if (LOG.isDebugEnabled()) { LOG.debug("# records per SSP:"); for (Map.Entry<SystemStreamPartition, List<IncomingMessageEnvelope>> e : results.entrySet()) { List<IncomingMessageEnvelope> list = e.getValue(); LOG.debug(e.getKey() + " = " + ((list == null) ? 0 : list.size())); } } return results; }

Target:
private Map<SystemStreamPartition, List<IncomingMessageEnvelope>> processResults(ConsumerRecords<K, V> records) { if (records == null) { throw new SamzaException("Received null 'records' after polling consumer in KafkaConsumerProxy " + this); } Map<SystemStreamPartition, List<IncomingMessageEnvelope>> results = new HashMap<>(records.count()); for (ConsumerRecord<K, V> record : records) { int partition = record.partition(); String topic = record.topic(); TopicPartition tp = new TopicPartition(topic, partition); updateMetrics(record, tp); SystemStreamPartition ssp = topicPartitionToSSP.get(tp); List<IncomingMessageEnvelope> messages = results.get(ssp); if (messages == null) { messages = new ArrayList<>(); results.put(ssp, messages); } K key = record.key(); Object value = record.value(); IncomingMessageEnvelope imEnvelope = new IncomingMessageEnvelope(ssp, String.valueOf(record.offset()), key, value, getRecordSize(record)); messages.add(imEnvelope); } if (LOG.isDebugEnabled()) { LOG.debug("# records per SSP:"); for (Map.Entry<SystemStreamPartition, List<IncomingMessageEnvelope>> e : results.entrySet()) { List<IncomingMessageEnvelope> list = e.getValue(); LOG.debug(e.getKey() + " = " + ((list == null) ? 0 : list.size())); } } return results; }
Source:
public void open(ExecutionContext ctx) throws Exception { super.open(ctx); ValueStateDescriptor<Boolean> stateDesc = new ValueStateDescriptor<>("existsState", Types.BOOLEAN); if (!stateTtlConfig.equals(StateTtlConfig.DISABLED)){ stateDesc.enableTimeToLive(stateTtlConfig); } state = ctx.getRuntimeContext().getState(stateDesc); }

Target:
public void open(ExecutionContext ctx) throws Exception { super.open(ctx); ValueStateDescriptor<Boolean> stateDesc = new ValueStateDescriptor<>("existsState", Types.BOOLEAN); StateTtlConfig ttlConfig = createTtlConfig(minRetentionTime); if (ttlConfig.isEnabled()) { stateDesc.enableTimeToLive(ttlConfig); } state = ctx.getRuntimeContext().getState(stateDesc); }
Source:
private String getHumanReadableSize(long bytes) { int unit = 1000; if (bytes < unit) return bytes + " B"; int exp = (int) (Math.log(bytes) / Math.log(unit)); String pre = "" + "KMGTPE".charAt(exp - 1); return String.format("%.1f %sB", bytes / Math.pow(unit, exp), pre); }

Target:
private String getHumanReadableSize(long bytes) { int unit = 1000; if (bytes < unit) { return bytes + " B"; } int exp = (int) (Math.log(bytes) / Math.log(unit)); String pre = "" + "KMGTPE".charAt(exp - 1); return String.format("%.1f %sB", bytes / Math.pow(unit, exp), pre); }
Source:
public void buildStarted(Run build, TaskListener taskListener, GerritTriggeredEvent event, BuildsStartedStats stats) { try { if (event instanceof ChangeBasedEvent) { String command = parameterExpander.getBuildStartedCommand(build, taskListener, (ChangeBasedEvent)event, stats); if (command != null) { if (!command.isEmpty()) { logger.info("Notifying BuildStarted to gerrit: {}", truncateCommandForLog(command)); cmdRunner.sendCommand(command); GerritTriggeredBuildListener.fireOnStarted(event, command); } else { logger.info("BuildStarted command is empty. Gerrit will not be notified of BuildStarted"); } } else { logger.error("Something wrong during parameter extraction. " + "Gerrit will not be notified of BuildStarted"); } } } catch (Exception ex) { logger.error("Could not complete BuildStarted notification!", ex); } }

Target:
public void buildStarted(Run build, TaskListener taskListener, GerritTriggeredEvent event, BuildsStartedStats stats) { try { if (event instanceof ChangeBasedEvent) { String command = parameterExpander.getBuildStartedCommand(build, taskListener, (ChangeBasedEvent)event, stats); if (command != null) { if (!command.isEmpty()) { logger.debug("Notifying BuildStarted to gerrit: {}", command); cmdRunner.sendCommand(command); GerritTriggeredBuildListener.fireOnStarted(event, command); } else { logger.debug("BuildStarted command is empty. Gerrit will not be notified of BuildStarted"); } } else { logger.error("Something wrong during parameter extraction. " + "Gerrit will not be notified of BuildStarted"); } } } catch (Exception ex) { logger.error("Could not complete BuildStarted notification!", ex); } }
Source:
private DigitalTwinsAsyncClient getAsyncClient(HttpClient httpClient, DigitalTwinsServiceVersion serviceVersion) { return getDigitalTwinsClientBuilder().serviceVersion(serviceVersion).httpClient(httpClient).buildAsyncClient(); }

Target:
private DigitalTwinsAsyncClient getAsyncClient(HttpClient httpClient, DigitalTwinsServiceVersion serviceVersion) { return getDigitalTwinsClientBuilder(httpClient, serviceVersion) .buildAsyncClient(); }
Source:
public FormatInfo process(String templatePath, ImageFormat format, String templateName, long processTimeout) { return process(templatePath, format, templateName); }

Target:
public FormatInfo process(String templatePath, ImageFormat format, String templateName, long processTimeout) { if (format != null) { s_logger.debug("We don't handle conversion from " + format + " to ISO."); return null; } String isoPath = templatePath + File.separator + templateName + "." + ImageFormat.ISO.getFileExtension(); if (!_storage.exists(isoPath)) { s_logger.debug("Unable to find the iso file: " + isoPath); return null; } FormatInfo info = new FormatInfo(); info.format = ImageFormat.ISO; info.filename = templateName + "." + ImageFormat.ISO.getFileExtension(); info.size = _storage.getSize(isoPath); info.virtualSize = info.size; return info; }
Source:
public Void visitJoin(JoinNode node, Integer indent) { JoinNode.DistributionType distributionType = node.getDistributionType() .orElseThrow(() -> new IllegalStateException("Expected distribution type to be present")); if (node.isCrossJoin()) { checkState(node.getType() == INNER && distributionType == REPLICATED, "Expected CROSS join to be INNER REPLICATED"); lines.add(indentString(indent) + "cross join:"); } else { lines.add(format("%sjoin (%s, %s):", indentString(indent), node.getType(), distributionType)); } return visitPlan(node, indent + 1); }

Target:
public Void visitJoin(JoinNode node, Integer indent) { JoinNode.DistributionType distributionType = node.getDistributionType() .orElseThrow(() -> new IllegalStateException("Expected distribution type to be present")); if (node.isCrossJoin()) { checkState(node.getType() == INNER && distributionType == REPLICATED, "Expected CROSS JOIN to be INNER REPLICATED"); lines.add(indentString(indent) + "cross join:"); } else { lines.add(format("%sjoin (%s, %s):", indentString(indent), node.getType(), distributionType)); } return visitPlan(node, indent + 1); }
Source:
private void onDisconnect(JdbcThinTcpIo cliIo) { assert connCnt.get() > 0; if (partitionAwareness) { cliIo.close(); ios.remove(cliIo.nodeId()); } else { if (singleIo != null) singleIo.close(); } connCnt.decrementAndGet(); if (streamState != null) { streamState.close0(); streamState = null; } synchronized (stmtsMux) { for (JdbcThinStatement s : stmts) s.closeOnDisconnect(); stmts.clear(); } metaHnd = new JdbcBinaryMetadataHandler(); }

Target:
private void onDisconnect(JdbcThinTcpIo cliIo) { assert connCnt.get() > 0; if (partitionAwareness) { cliIo.close(); ios.remove(cliIo.nodeId()); } else { if (singleIo != null) singleIo.close(); } connCnt.decrementAndGet(); if (streamState != null) { streamState.close0(); streamState = null; } synchronized (stmtsMux) { for (JdbcThinStatement s : stmts) s.closeOnDisconnect(); stmts.clear(); } metaHnd = new JdbcBinaryMetadataHandler(); ctx = createBinaryCtx(metaHnd, marshCtx); }
Source:
public CandlepinQuery<Content> getContentByProductUuids(Collection<String> productUuids) { if (productUuids != null && !productUuids.isEmpty()) { Session session = this.currentSession(); Collection<String> uuids = new HashSet<String>(); Iterable<List<String>> uuidBlocks = Iterables.partition(productUuids, AbstractHibernateCurator.QUERY_PARAMETER_LIMIT); for (List<String> uuidBlock : uuidBlocks) { StringBuilder builder = new StringBuilder("SELECT DISTINCT content_uuid FROM ") .append(ProductContent.DB_TABLE) .append(" WHERE ("); int blockCount = (int) Math.ceil(uuidBlock.size() / (float) AbstractHibernateCurator.IN_OPERATOR_BLOCK_SIZE); for (int i = 0; i < blockCount;) { if (i != 0) { builder.append(" OR "); } builder.append("product_uuid IN (?").append(++i).append(')'); } builder.append(')'); SQLQuery query = session.createSQLQuery(builder.toString()); int param = 0; Iterable<List<String>> blocks = Iterables.partition(uuidBlock, AbstractHibernateCurator.IN_OPERATOR_BLOCK_SIZE); for (List<String> block : blocks) { query.setParameterList(String.valueOf(++param), block); } uuids.addAll(query.list()); } if (uuids != null && !uuids.isEmpty()) { DetachedCriteria criteria = this.createSecureDetachedCriteria() .add(CPRestrictions.in("uuid", uuids)); return this.cpQueryFactory.<Content>buildQuery(session, criteria); } } return this.cpQueryFactory.<Content>buildQuery(); }

Target:
public CandlepinQuery<Content> getContentByProductUuids(Collection<String> productUuids) { if (productUuids != null && !productUuids.isEmpty()) { Session session = this.currentSession(); Collection<String> uuids = new HashSet<String>(); Iterable<List<String>> uuidBlocks = Iterables.partition(productUuids, AbstractHibernateCurator.QUERY_PARAMETER_LIMIT); for (List<String> uuidBlock : uuidBlocks) { StringBuilder builder = new StringBuilder("SELECT DISTINCT content_uuid FROM ") .append(ProductContent.DB_TABLE) .append(" WHERE ("); int blockCount = (int) Math.ceil(uuidBlock.size() / (float) AbstractHibernateCurator.IN_OPERATOR_BLOCK_SIZE); for (int i = 0; i < blockCount;) { if (i != 0) { builder.append(" OR "); } builder.append("product_uuid IN (?").append(++i).append(')'); } builder.append(')'); log.debug("getContentByProductUuids query: {}", builder); SQLQuery query = session.createSQLQuery(builder.toString()); int param = 0; Iterable<List<String>> blocks = Iterables.partition(uuidBlock, AbstractHibernateCurator.IN_OPERATOR_BLOCK_SIZE); for (List<String> block : blocks) { query.setParameterList(String.valueOf(++param), block); } uuids.addAll(query.list()); } if (uuids != null && !uuids.isEmpty()) { DetachedCriteria criteria = this.createSecureDetachedCriteria() .add(CPRestrictions.in("uuid", uuids)); return this.cpQueryFactory.<Content>buildQuery(session, criteria); } } return this.cpQueryFactory.<Content>buildQuery(); }
Source:
public DateTime getEndDate() { return mEndDateInMillis; }

Target:
public DateTime getEndDate() { return mEndDateIn; }
Source:
public void startServer() { _server = new Server(); HttpConnectionFactory http = new HttpConnectionFactory(); http.getHttpConfiguration().setSecurePort(9999); http.getHttpConfiguration().setSecureScheme("BWTP"); _connector = new LocalConnector(_server, http); _connector.setIdleTimeout(300000); HttpConnectionFactory https = new HttpConnectionFactory(); https.getHttpConfiguration().addCustomizer(new HttpConfiguration.Customizer() { @Override public void customize(Connector connector, HttpConfiguration channelConfig, Request request) { request.setHttpURI(HttpURI.build(request.getHttpURI()).scheme(HttpScheme.HTTPS).asImmutable()); request.setSecure(true); } }); _connectorS = new LocalConnector(_server, https); _server.setConnectors(new Connector[]{_connector, _connectorS}); ContextHandler contextHandler = new ContextHandler(); _session = new SessionHandler(); contextHandler.setContextPath("/ctx"); _server.setHandler(contextHandler); contextHandler.setHandler(_session); _security = new ConstraintSecurityHandler(); _session.setHandler(_security); _security.setHandler(new AbstractHandler() { @Override public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { baseRequest.setHandled(true); response.sendError(404); } }); }

Target:
public void startServer() { _server = new Server(); HttpConnectionFactory http = new HttpConnectionFactory(); http.getHttpConfiguration().setSecurePort(9999); http.getHttpConfiguration().setSecureScheme("BWTP"); _connector = new LocalConnector(_server, http); _connector.setIdleTimeout(300000); HttpConnectionFactory https = new HttpConnectionFactory(); https.getHttpConfiguration().addCustomizer(new HttpConfiguration.Customizer() { @Override public void customize(Connector connector, HttpConfiguration channelConfig, Request request) { request.setHttpURI(HttpURI.build(request.getHttpURI()).scheme(HttpScheme.HTTPS)); request.setSecure(true); } }); _connectorS = new LocalConnector(_server, https); _server.setConnectors(new Connector[]{_connector, _connectorS}); ContextHandler contextHandler = new ContextHandler(); _session = new SessionHandler(); contextHandler.setContextPath("/ctx"); _server.setHandler(contextHandler); contextHandler.setHandler(_session); _security = new ConstraintSecurityHandler(); _session.setHandler(_security); _security.setHandler(new AbstractHandler() { @Override public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { baseRequest.setHandled(true); response.sendError(404); } }); }
Source:
public ValueNode replaceIndexExpression(ResultColumnList childRCL) throws StandardException { if (childRCL != null) { for (ResultColumn childRC : childRCL) { if (this.equals(childRC.getIndexExpression())) { return childRC.getColumnReference(this); } } } return this; }

Target:
public ValueNode replaceIndexExpression(ResultColumnList childRCL) throws StandardException { if (childRCL != null) { for (ResultColumn childRC : childRCL) { if (this.semanticallyEquals(childRC.getIndexExpression())) { return childRC.getColumnReference(this); } } } return this; }
Source:
public MatchClause append(Filter filter) { if (filter.getRelationshipDirection().equals(Direction.INCOMING)) { clause.append("<"); } clause.append( String.format("-[%s:`%s`]-", filter.isNestedRelationshipEntity() ? "r" : "", filter.getRelationshipType()) ); if (filter.getRelationshipDirection().equals(Direction.OUTGOING)) { clause.append(">"); } clause.append(String.format("(%s) ", "m" + index)); return this; }

Target:
public MatchClause append(Filter filter) { if (filter.getRelationshipDirection() == Direction.INCOMING) { clause.append("<"); } clause.append( String.format("-[%s:`%s`]-", filter.isNestedRelationshipEntity() ? "r" : "", filter.getRelationshipType()) ); if (filter.getRelationshipDirection() == Direction.OUTGOING) { clause.append(">"); } clause.append(String.format("(%s) ", "m" + index)); return this; }
Source:
public void testMapMetrics() { HazelcastInstance hz = createHazelcastInstance(); Node node = getNode(hz); PhoneHome phoneHome = new PhoneHome(node, "http://localhost:8080/ping"); Map<String, String> map1 = hz.getMap("hazelcast"); Map<String, String> map2 = hz.getMap("phonehome"); map2.put("1", "hazelcast"); node.getConfig().getMapConfig("hazelcast").setReadBackupData(true); node.getConfig().getMapConfig("phonehome").getMapStoreConfig().setEnabled(true); node.getConfig().getMapConfig("hazelcast").addQueryCacheConfig(new QueryCacheConfig("queryconfig")); node.getConfig().getMapConfig("hazelcast").getHotRestartConfig().setEnabled(true); stubFor(get(urlPathEqualTo("/ping")) .willReturn(aResponse() .withStatus(200))); phoneHome.phoneHome(false); verify(1, getRequestedFor(urlPathEqualTo("/ping")).withQueryParam("mpct", equalTo("2")) .withQueryParam("mpbrct", equalTo("1")) .withQueryParam("mpmsct", equalTo("1")) .withQueryParam("mpaoqcct", equalTo("1")) .withQueryParam("mpaoict", equalTo("1")) .withQueryParam("mphect", equalTo("1"))); }

Target:
public void testMapMetrics() { HazelcastInstance hz = createHazelcastInstance(); Node node = getNode(hz); PhoneHome phoneHome = new PhoneHome(node, "http://localhost:8080/ping"); Map<String, String> map1 = hz.getMap("hazelcast"); Map<String, String> map2 = hz.getMap("phonehome"); node.getConfig().getMapConfig("hazelcast").setReadBackupData(true); node.getConfig().getMapConfig("phonehome").getMapStoreConfig().setEnabled(true); node.getConfig().getMapConfig("hazelcast").addQueryCacheConfig(new QueryCacheConfig("queryconfig")); node.getConfig().getMapConfig("hazelcast").getHotRestartConfig().setEnabled(true); node.getConfig().getMapConfig("hazelcast").getIndexConfigs().add(new IndexConfig()); stubFor(get(urlPathEqualTo("/ping")) .willReturn(aResponse() .withStatus(200))); phoneHome.phoneHome(false); verify(1, getRequestedFor(urlPathEqualTo("/ping")).withQueryParam("mpct", equalTo("2")) .withQueryParam("mpbrct", equalTo("1")) .withQueryParam("mpmsct", equalTo("1")) .withQueryParam("mpaoqcct", equalTo("1")) .withQueryParam("mpaoict", equalTo("1")) .withQueryParam("mphect", equalTo("1"))); }
Source:
public static void rsyncFileToRemote(final String localPath, final String address, final String remotePath, final boolean useDel) { StringBuilder builder = new StringBuilder(); builder.append("rsync"); builder.append(" -rtLDvz"); if (useDel) { builder.append(" --del"); } builder.append(" " + localPath); builder.append(" " + address + ":" + remotePath); startAProcess(builder.toString().split(" ")); }

Target:
public static void rsyncFileToRemote(final String localPath, final String address, final String remotePath, final boolean useDel) { ArrayList<String> command = new ArrayList<String>(); command.add("rsync"); command.add("-rtLDvz"); if (useDel) { command.add("--del"); } command.add(localPath); command.add(address + ":" + remotePath); startAProcess(command.toArray(new String[] {})); }
Source:
public List findElementsByName(String using) throws WebDriverException{ return super.findElementsByName(using); }

Target:
public List findElementsByName(String using) { return super.findElementsByName(using); }
Source:
public static Long convertObjectToLong(Object valObj) { if (valObj instanceof Long) { return (Long) valObj; } else if (valObj instanceof Number) { return ((Number) valObj).longValue(); } else if (valObj instanceof String) { try { String s = ((String) valObj).replace(",", ""); return LONG_PAT.matcher(s).matches() ? Long.valueOf(s) : Double.valueOf(s).longValue(); } catch (Exception e) { throw new ParseException(e, "Unable to parse value[%s] as long", valObj); } } else { throw new ParseException("Unknown type[%s]", valObj.getClass()); } }

Target:
public static Long convertObjectToLong(Object valObj) { if (valObj == null) { return 0L; } if (valObj instanceof Long) { return (Long) valObj; } else if (valObj instanceof Number) { return ((Number) valObj).longValue(); } else if (valObj instanceof String) { try { return GuavaUtils.tryParseLong((String) valObj); } catch (Exception e) { throw new ParseException(e, "Unable to parse value[%s] as long", valObj); } } else { throw new ParseException("Unknown type[%s]", valObj.getClass()); } }
Source:
protected static List<Integer> grep(File fileName, String regexp, List<String> resultLines) { List<Integer> resultLineNumbers = new ArrayList<>(); Reader reader = null; try { reader = new FileReader(fileName); resultLineNumbers = grep(reader, regexp, resultLines); }catch (IOException e) { e.printStackTrace(); } finally { closeQuietly(reader); } return resultLineNumbers; }

Target:
protected static List<Integer> grep(File fileName, String regexp, List<String> resultLines) { List<Integer> resultLineNumbers = new ArrayList<>(); try(Reader reader = new FileReader(fileName)) { resultLineNumbers = grep(reader, regexp, resultLines); } catch (IOException e) { e.printStackTrace(); } return resultLineNumbers; }
Source:
private DrugOrder checkDrugOrdersForDiscontinuing(DrugOrder drugOrder1, DrugOrder drugOrder2){ if (OpenmrsUtil.nullSafeEquals(drugOrder1.getDrug(), drugOrder2.getDrug())) { return drugOrder2; }else{ return null; } }

Target:
private DrugOrder checkDrugOrdersForDiscontinuing(DrugOrder drugOrder1, DrugOrder drugOrder2){ if (OpenmrsUtil.nullSafeEquals(drugOrder1.getDrug(), drugOrder2.getDrug())) { return drugOrder2; } return null; }
Source:
public Map<SystemResource, Number> getSystemResourceUsage() { systemResourceUsage.clear(); for (SystemResource sr : systemResources) { Method getterMethod = getGetterMethod(sr); getterMethod.setAccessible(true); try { systemResourceUsage.put(sr, (Number)getterMethod.invoke(operatingSystemMXBean)); } catch (Exception e) { Throwables.propagate(e); } } return systemResourceUsage; }

Target:
public Map<SystemResource, Number> getSystemResourceUsage() { systemResourceUsage.clear(); for (SystemResource sr : systemResources) { Method getterMethod = getGetterMethod(sr); getterMethod.setAccessible(true); try { systemResourceUsage.put(sr, (Number)getterMethod.invoke(operatingSystemMXBean)); } catch (Exception e) { throw Throwables.propagate(e); } } return systemResourceUsage; }
Source:
private void getSubscriptionUrl() { registrationService.getRegistrationUrl(new MethodCallback<RegistrationUrl>() { @Override public void onFailure(Method method, Throwable exception) { } @Override public void onSuccess(Method method, RegistrationUrl registrationUrl) { LocaleInfo currentLocale = LocaleInfo.getCurrentLocale(); if (currentLocale.getLocaleName().equals("fr")) { getView().setRegistrationUrl(registrationUrl.getFr()); } else { getView().setRegistrationUrl(registrationUrl.getEn()); } } }); }

Target:
private void getSubscriptionUrl() { registrationService.getRegistrationUrl(new MethodCallback<RegistrationUrl>() { @Override public void onFailure(Method method, Throwable exception) { getView().logError("Failure to load registration url"); } @Override public void onSuccess(Method method, RegistrationUrl registrationUrl) { LocaleInfo currentLocale = LocaleInfo.getCurrentLocale(); if (currentLocale.getLocaleName().equals("fr")) { getView().setRegistrationUrl(registrationUrl.getFr()); } else { getView().setRegistrationUrl(registrationUrl.getEn()); } } }); }
Source:
public String getString(String name, String defaultValue) { String value = cfg.getString(PLUGIN, pluginName, name); if (value != null) { return value; } else { return defaultValue; } }

Target:
public String getString(String name, String defaultValue) { return Objects.firstNonNull(cfg.getString(PLUGIN, pluginName, name), defaultValue); }
Source:
public Map<String, String> getMetadataMap() { Map<String, String> metadataMap = new LinkedHashMap<String, String>(); Configuration config = (Configuration) INSTANCE .getBackingConfigurationSource(); String subsetPrefix = propMetadataNamespace.substring(0, propMetadataNamespace.length() - 1); for (Iterator<String> iter = config.subset(subsetPrefix) .getKeys(); iter.hasNext();) { String key = iter.next(); String value = config.getString(propMetadataNamespace + key); metadataMap.put(key, value); } return metadataMap; }

Target:
public Map<String, String> getMetadataMap() { Map<String, String> metadataMap = new LinkedHashMap<String, String>(); Configuration config = (Configuration) INSTANCE .getBackingConfigurationSource(); String subsetPrefix = propMetadataNamespace.charAt(propMetadataNamespace.length() - 1) == '.' ? propMetadataNamespace.substring(0, propMetadataNamespace.length() - 1) : propMetadataNamespace; for (Iterator<String> iter = config.subset(subsetPrefix) .getKeys(); iter.hasNext();) { String key = iter.next(); String value = config.getString(subsetPrefix + "." + key); metadataMap.put(key, value); } return metadataMap; }
Source:
public void shouldAlertGivenFunctionInJavaScriptResponse() throws HttpMalformedHeaderException, URIException { String body = "Some text <script>$eval()</script>\nLine 2\n"; HttpMessage msg = createHttpMessageWithRespBody(body, "text/javascript;charset=ISO-8859-1"); Source source = createSource(msg); rule.scanHttpResponseReceive(msg, -1, source); assertThat(alertsRaised, hasSize(1)); }

Target:
public void shouldAlertGivenFunctionInJavaScriptResponse() throws HttpMalformedHeaderException, URIException { String body = "Some text <script>$eval()</script>\nLine 2\n"; HttpMessage msg = createHttpMessageWithRespBody(body, "text/javascript;charset=ISO-8859-1"); Source source = createSource(msg); rule.scanHttpResponseReceive(msg, -1, source); assertThat(alertsRaised, hasSize(1)); assertEquals("eval", alertsRaised.get(0).getEvidence()); }
Source:
protected ContentValues mergeValues(@NonNull ContentValues v1, @NonNull ContentValues v2) { Gson gson = new Gson(); GitHubRepository b1 = gson.fromJson(v1.getAsString(GitHubRepositoryColumns.JSON), GitHubRepository.class); GitHubRepository b2 = gson.fromJson(v2.getAsString(GitHubRepositoryColumns.JSON), GitHubRepository.class); return getContentValuesForItem(b1.overwrite(b2)); }

Target:
protected ContentValues mergeValues(@NonNull ContentValues v1, @NonNull ContentValues v2) { GitHubRepository b1 = getGson().fromJson(v1.getAsString(GitHubRepositoryColumns.JSON), GitHubRepository.class); GitHubRepository b2 = getGson().fromJson(v2.getAsString(GitHubRepositoryColumns.JSON), GitHubRepository.class); return getContentValuesForItem(b1.overwrite(b2)); }
Source:
protected boolean validateMemoryAlignment(VmStatic vmStaticData) { if (getCluster().getArchitecture().getFamily() == ArchitectureType.ppc && vmStaticData.getMemSizeMb() % 256 != 0) { addValidationMessageVariable("clusterArch", getCluster().getArchitecture()); return failValidation(EngineMessage.MEMORY_SIZE_NOT_MULTIPLE_OF_256_ON_PPC); } return true; }

Target:
protected boolean validateMemoryAlignment(VmStatic vmStaticData) { if (getCluster().getArchitecture().getFamily() == ArchitectureType.ppc && vmStaticData.getMemSizeMb() % 256 != 0) { return failValidation(EngineMessage.MEMORY_SIZE_NOT_MULTIPLE_OF_256_ON_PPC, String.format("$%s %s", "clusterArch", getCluster().getArchitecture())); } return true; }
Source:
public void deleteAuthorizationFailureTest() throws Exception { if (store.getStoreConfig().storeValidateAuthorization == true) { MockId mockId = put(1, PUT_RECORD_SIZE, Utils.Infinite_Time).get(0); assertNotSame("accountId should not be -1 for added Blob.", -1, mockId.getAccountId()); assertNotSame("containerId should not be -1 for added Blob.", -1, mockId.getContainerId()); short[] accountIds = {-1, Utils.getRandomShort(TestUtils.RANDOM), -1, mockId.getAccountId(), Utils.getRandomShort( TestUtils.RANDOM)}; short[] containerIds = {-1, -1, Utils.getRandomShort(TestUtils.RANDOM), Utils.getRandomShort( TestUtils.RANDOM), mockId.getContainerId()}; for (int i = 0; i < accountIds.length; i++) { verifyDeleteFailure(new MockId(mockId.getID(), accountIds[i], containerIds[i]), StoreErrorCodes.Authorization_Failure); } } }

Target:
public void deleteAuthorizationFailureTest() throws Exception { MockId mockId = put(1, PUT_RECORD_SIZE, Utils.Infinite_Time).get(0); assertNotSame("accountId should not be -1 for added Blob.", -1, mockId.getAccountId()); assertNotSame("containerId should not be -1 for added Blob.", -1, mockId.getContainerId()); short[] accountIds = {-1, Utils.getRandomShort(TestUtils.RANDOM), -1, mockId.getAccountId(), Utils.getRandomShort(TestUtils.RANDOM)}; short[] containerIds = {-1, -1, Utils.getRandomShort(TestUtils.RANDOM), Utils.getRandomShort( TestUtils.RANDOM), mockId.getContainerId()}; for (int i = 0; i < accountIds.length; i++) { verifyDeleteFailure(new MockId(mockId.getID(), accountIds[i], containerIds[i]), StoreErrorCodes.Authorization_Failure); } }
Source:
private void enterThenDisablePasscodeIfNeeded() { if (isViewDisplayed(getViewById(R.id.button1)) == false) { return; } typeFullPasscode(); loadSettingsFromNotesList(); loadPasscodeUnsetterFromSettings(); typeFullPasscode(); dismissSettings(); }

Target:
private void enterThenDisablePasscodeIfNeeded() { if (!isViewDisplayed(getViewById(R.id.button1))) { return; } typeFullPasscode(); loadSettingsFromNotesList(); loadPasscodeUnsetterFromSettings(); typeFullPasscode(); dismissSettings(); }
Source:
private File createTempFile(String contents) { try { File tmpFile = File.createTempFile("config", ".tmp"); FileWriter writer = new FileWriter(tmpFile); writer.write(contents); writer.close(); return tmpFile; } catch (IOException e) { } return null; }

Target:
private File createTempFile(String contents) throws IOException { File tmpFile = File.createTempFile("config", ".tmp"); try (FileWriter writer = new FileWriter(tmpFile)) { writer.write(contents); return tmpFile; } }
Source:
public ProcessingStatus onOK() { for (int i = 0; i < results.length; i++) { if (results[i] == null) { messageIsInvalid = true; break; } } if (messageIsInvalid) { return ProcessingStatus.INLALID; } List<Integer> toRetry = new ArrayList<>(); ProcessingStatus processingStatus = ProcessingStatus.SUCCESS; for (int i = 0; i < results.length; i++) { Status status = results[i]; if (status.getCode() == io.grpc.Status.Code.OK.value()) { continue; } if (retryOptions.isRetryable(getGrpcCode(status))) { toRetry.add(i); } else { processingStatus = ProcessingStatus.NOT_RETRYABLE; } } if (!toRetry.isEmpty()) { currentRequest = createRetryRequest(toRetry); if (processingStatus == ProcessingStatus.SUCCESS) { processingStatus = ProcessingStatus.RETYABLE; } } return processingStatus; }

Target:
public ProcessingStatus onOK() { if (!messageIsInvalid) { for (int i = 0; i < results.length; i++) { if (results[i] == null) { messageIsInvalid = true; break; } } } if (messageIsInvalid) { return ProcessingStatus.INVALID; } List<Integer> toRetry = new ArrayList<>(); ProcessingStatus processingStatus = ProcessingStatus.SUCCESS; for (int i = 0; i < results.length; i++) { Status status = results[i]; if (status.getCode() == io.grpc.Status.Code.OK.value()) { continue; } else if (retryOptions.isRetryable(getGrpcCode(status))) { toRetry.add(i); if (processingStatus == ProcessingStatus.SUCCESS) { processingStatus = ProcessingStatus.RETRYABLE; } } else { processingStatus = ProcessingStatus.NOT_RETRYABLE; break; } } if (!toRetry.isEmpty()) { currentRequest = createRetryRequest(toRetry); } return processingStatus; }
Source:
public MethodDefinition declareMethod( EnumSet<Access> access, String name, ParameterizedType returnType, Iterable<Parameter> parameters) { if (Iterables.size(parameters) > MAX_ALLOWED_VARARG_ARGUMENTS) { throw new PrestoException(TOO_MANY_VARARG_ARGUMENTS, String.format("Number of arguments (%d) for vararg functions exceeds limit (%d)", Iterables.size(parameters), MAX_ALLOWED_VARARG_ARGUMENTS)); } MethodDefinition methodDefinition = new MethodDefinition(this, access, name, returnType, parameters); for (MethodDefinition method : methods) { if (name.equals(method.getName()) && method.getParameterTypes().equals(methodDefinition.getParameterTypes())) { throw new IllegalArgumentException("Method with same name and signature already exists: " + name); } } methods.add(methodDefinition); return methodDefinition; }

Target:
public MethodDefinition declareMethod( EnumSet<Access> access, String name, ParameterizedType returnType, Iterable<Parameter> parameters) { MethodDefinition methodDefinition = new MethodDefinition(this, access, name, returnType, parameters); for (MethodDefinition method : methods) { if (name.equals(method.getName()) && method.getParameterTypes().equals(methodDefinition.getParameterTypes())) { throw new IllegalArgumentException("Method with same name and signature already exists: " + name); } } methods.add(methodDefinition); return methodDefinition; }
Source:
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View root = super.onCreateView(inflater, container, savedInstanceState); bus = EventBus.getDefault(); if (savedInstanceState != null) { savedSearchFilter = savedInstanceState.getString(BUNDLE_KEY_SEARCH_QUERY); } searchFilter = savedSearchFilter; return root; }

Target:
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View root = super.onCreateView(inflater, container, savedInstanceState); if (savedInstanceState != null) { savedSearchFilter = savedInstanceState.getString(BUNDLE_KEY_SEARCH_QUERY); } searchFilter = savedSearchFilter; return root; }
Source:
public void testRobotIsCreatedWithCorrectInitialPosition() { final GridPosition initialGridPosition = new GridPosition(0, 0); final Robot robot = new Robot(initialGridPosition, Orientation.NORTH); final GridPosition actualGridPosition = robot.getGridPosition(); assertTrue(actualGridPosition.equals(initialGridPosition)); }

Target:
public void testRobotIsCreatedWithCorrectInitialPosition() { final GridPosition initialGridPosition = new GridPosition(0, 0); final Robot robot = new Robot(initialGridPosition, Orientation.NORTH); assertTrue(robot.getGridPosition().equals(initialGridPosition)); }
Source:
protected boolean canDoAction() { final ClusterValidator validator = new ClusterValidator(getDbFacade(), getVdsGroup()); boolean validationResult = validate(validator.nameNotUsed()) && validate(validator.cpuTypeSupportsVirtService()) && validate(validator.versionSupported()) && validate(validator.dataCenterVersionMismatch()) && validate(validator.dataCenterExists()) && validate(validator.localStoragePoolAttachedToSingleCluster()) && validate(validator.qosBaloonSupported()) && validate(validator.glusterServiceSupported()) && validate(validator.clusterServiceDefined()) && validate(validator.mixedClusterServicesSupported()) && validate(validator.attestationServerConfigured()) && validate(validator.migrationSupported(getArchitecture())) && validate(validator.virtIoRngSupported()); if (!validateClusterPolicy()) { return false; } return validationResult; }

Target:
protected boolean canDoAction() { final ClusterValidator validator = new ClusterValidator(getDbFacade(), getVdsGroup()); return validate(validator.nameNotUsed()) && validate(validator.cpuTypeSupportsVirtService()) && validate(validator.versionSupported()) && validate(validator.dataCenterVersionMismatch()) && validate(validator.dataCenterExists()) && validate(validator.localStoragePoolAttachedToSingleCluster()) && validate(validator.qosBaloonSupported()) && validate(validator.glusterServiceSupported()) && validate(validator.clusterServiceDefined()) && validate(validator.mixedClusterServicesSupported()) && validate(validator.attestationServerConfigured()) && validate(validator.migrationSupported(getArchitecture())) && validateClusterPolicy() && validate(validator.virtIoRngSupported()); }
Source:
for (Map.Entry<Integer, Schema<ChangeData>> e : ChangeSchemas.ALL.entrySet()) { if (e.getKey() <= 3) { versions.put(e.getValue(), lucene43); } else if (e.getKey() <= 5) { versions.put(e.getValue(), lucene44); } else if (e.getKey() <= 8) { versions.put(e.getValue(), lucene46); } else if (e.getKey() <= 10) { versions.put(e.getValue(), lucene47); } else if (e.getKey() <= 11) { versions.put(e.getValue(), lucene48); } else if (e.getKey() <= 13) { versions.put(e.getValue(), lucene410); } else { versions.put(e.getValue(), Version.LUCENE_4_10_2); } }

Target:
for (Map.Entry<Integer, Schema<ChangeData>> e : ChangeSchemas.ALL.entrySet()) { if (e.getKey() <= 3) { versions.put(e.getValue(), lucene43); } else if (e.getKey() <= 5) { versions.put(e.getValue(), lucene44); } else if (e.getKey() <= 8) { versions.put(e.getValue(), lucene46); } else if (e.getKey() <= 10) { versions.put(e.getValue(), lucene47); } else if (e.getKey() <= 11) { versions.put(e.getValue(), lucene48); } else if (e.getKey() <= 13) { versions.put(e.getValue(), lucene410); } else if (e.getKey() <= 14) { versions.put(e.getValue(), lucene4101); } else { versions.put(e.getValue(), Version.LUCENE_4_10_2); } }
Source:
private void onClose() { if (DEBUG) Log.d(TAG, "onClose() called"); if (lockManager != null) { lockManager.releaseWifiAndCpu(); } if (playerImpl != null) { removeViewFromParent(); playerImpl.setRecovery(); playerImpl.savePlaybackState(); playerImpl.stopActivityBinding(); playerImpl.removePopupFromView(); playerImpl.destroy(); } if (notificationManager != null) notificationManager.cancel(NOTIFICATION_ID); playerImpl = null; lockManager = null; stopForeground(true); stopSelf(); }

Target:
private void onClose() { if (DEBUG) { Log.d(TAG, "onClose() called"); } if (playerImpl != null) { removeViewFromParent(); playerImpl.setRecovery(); playerImpl.savePlaybackState(); playerImpl.stopActivityBinding(); playerImpl.removePopupFromView(); playerImpl.destroy(); } if (notificationManager != null) { notificationManager.cancel(NOTIFICATION_ID); } stopForeground(true); stopSelf(); }
Source:
protected static final SPromise registerOnError(final SPromise rcvr, final SBlock block, final RootCallTarget blockCallTarget, final RegisterOnError registerNode) { assert block.getMethod().getNumberOfArguments() == 2; Actor current = EventualMessage.getActorCurrentMessageIsExecutionOn(); SPromise promise = SPromise.createPromise(current, false, false, false); SResolver resolver = SPromise.createResolver(promise, "onE:block"); PromiseCallbackMessage msg = new PromiseCallbackMessage(EventualMessage.getCurrentExecutingMessageId(), rcvr.getOwner(), block, resolver, blockCallTarget, false, false, promise); registerNode.register(rcvr, msg, current); return promise; }

Target:
protected final SPromise registerOnError(final SPromise rcvr, final SBlock block, final RootCallTarget blockCallTarget, final RegisterOnError registerNode) { assert block.getMethod().getNumberOfArguments() == 2; Actor current = EventualMessage.getActorCurrentMessageIsExecutionOn(); SPromise promise = SPromise.createPromise(current, promiseResolutionBreakpoint.executeCheckIsSetAndEnabled(), false, false); SResolver resolver = SPromise.createResolver(promise); PromiseCallbackMessage msg = new PromiseCallbackMessage(EventualMessage.getCurrentExecutingMessageId(), rcvr.getOwner(), block, resolver, blockCallTarget, false, promiseResolverBreakpoint.executeCheckIsSetAndEnabled(), promise); registerNode.register(rcvr, msg, current); return promise; }
Source:
public final TmfModelResponse<List<M>> fetchTree(TimeQueryFilter filter, @Nullable IProgressMonitor monitor) { if (fCached != null) { return fCached; } fAnalysisModule.waitForInitialization(); ITmfStateSystem ss = fAnalysisModule.getStateSystem(); if (ss == null) { return new TmfModelResponse<>(null, ITmfResponse.Status.FAILED, CommonStatusMessage.STATE_SYSTEM_FAILED); } boolean complete = ss.waitUntilBuilt(0); try (FlowScopeLog scope = new FlowScopeLogBuilder(LOGGER, Level.FINE, getClass().getSimpleName() + "#fetchTree").build()) { List<M> tree = getTree(ss, filter, monitor); if (complete) { TmfModelResponse<List<M>> response = new TmfModelResponse<>(tree, ITmfResponse.Status.COMPLETED, CommonStatusMessage.COMPLETED); if (isCacheable()) { fCached = response; } return response; } return new TmfModelResponse<>(tree, ITmfResponse.Status.RUNNING, CommonStatusMessage.RUNNING); } catch (StateSystemDisposedException e) { return new TmfModelResponse<>(null, ITmfResponse.Status.FAILED, CommonStatusMessage.STATE_SYSTEM_FAILED); } }

Target:
public final TmfModelResponse<List<M>> fetchTree(TimeQueryFilter filter, @Nullable IProgressMonitor monitor) { if (fCached != null) { return fCached; } fAnalysisModule.waitForInitialization(); ITmfStateSystem ss = fAnalysisModule.getStateSystem(); if (ss == null) { return new TmfModelResponse<>(null, ITmfResponse.Status.FAILED, CommonStatusMessage.STATE_SYSTEM_FAILED); } boolean complete = ss.waitUntilBuilt(0); try (FlowScopeLog scope = new FlowScopeLogBuilder(LOGGER, Level.FINE, "AbstractTreeDataProvider#fetchTree") .setCategory(getClass().getSimpleName()).build()) { List<M> tree = getTree(ss, filter, monitor); if (complete) { TmfModelResponse<List<M>> response = new TmfModelResponse<>(tree, ITmfResponse.Status.COMPLETED, CommonStatusMessage.COMPLETED); if (isCacheable()) { fCached = response; } return response; } return new TmfModelResponse<>(tree, ITmfResponse.Status.RUNNING, CommonStatusMessage.RUNNING); } catch (StateSystemDisposedException e) { return new TmfModelResponse<>(null, ITmfResponse.Status.FAILED, CommonStatusMessage.STATE_SYSTEM_FAILED); } }
Source:
private void testMovingMoving(Operation operation) throws Exception { test(2, operation.f, new MagicKey("moving1", cache(0), cache(1)), new MagicKey("moving2", cache(0), cache(1))); }

Target:
public void testMovingMoving(Operation operation) throws Exception { test(2, operation.f, new MagicKey("moving1", cache(0), cache(1)), new MagicKey("moving2", cache(0), cache(1))); }
Source:
private static void warmUpCHSubNetwork(GraphHopper graphHopper, int iterations) { GraphHopperStorage ghStorage = graphHopper.getGraphHopperStorage(); for (int i = 0; i < iterations; i++) { int startNode = ThreadLocalRandom.current().nextInt(0, graphHopper.getMaxVisitedNodes() + 1); int endNode = ThreadLocalRandom.current().nextInt(0, graphHopper.getMaxVisitedNodes() + 1); double fromLatitude = ghStorage.getNodeAccess().getLatitude(startNode); double fromLongitude = ghStorage.getNodeAccess().getLongitude(startNode); double toLatitude = ghStorage.getNodeAccess().getLatitude(endNode); double toLongitude = ghStorage.getNodeAccess().getLongitude(endNode); GHRequest request = new GHRequest(fromLatitude, fromLongitude, toLatitude, toLongitude); graphHopper.route(request); } }

Target:
private static void warmUpCHSubNetwork(GraphHopper graphHopper, int iterations) { int retryCount = 0; int maxRetries = 10; while (true) { try { GraphHopperStorage ghStorage = graphHopper.getGraphHopperStorage(); Random rand = new Random(); for (int i = 0; i < iterations; i++) { int startNode = rand.nextInt(graphHopper.getMaxVisitedNodes() + 1); int endNode = rand.nextInt(graphHopper.getMaxVisitedNodes() + 1); double fromLatitude = ghStorage.getNodeAccess().getLatitude(startNode); double fromLongitude = ghStorage.getNodeAccess().getLongitude(startNode); double toLatitude = ghStorage.getNodeAccess().getLatitude(endNode); double toLongitude = ghStorage.getNodeAccess().getLongitude(endNode); GHRequest request = new GHRequest(fromLatitude, fromLongitude, toLatitude, toLongitude); graphHopper.route(request); } break; } catch (Exception ex) { if (++retryCount == maxRetries) throw ex; } } }
Source:
public String isThereATraceBetween(EObject firstElement, EObject secondElement, EObject traceModel) { GenericTraceModel root = (GenericTraceModel) traceModel; List<RelatedTo> relevantLinks = new ArrayList<RelatedTo>(); List<RelatedTo> allTraces = root.getTraces(); String traceString = ""; for (RelatedTo trace : allTraces) { if (firstElement != secondElement) { if (trace.getItem().contains(firstElement) && trace.getItem().contains(secondElement)) { relevantLinks.add(trace); } } } if (relevantLinks.size() > 0) { traceString = "X"; } String spacer = ""; String internalTraceString = this.isThereAnInternalTraceBetween(firstElement, secondElement, traceModel); if(internalTraceString!=null) { spacer = (!traceString.equals("") && !internalTraceString.equals("")) ? ", " : ""; return traceString + spacer + internalTraceString;}else return traceString; }

Target:
public boolean isThereATraceBetween(EObject firstElement, EObject secondElement, EObject traceModel) { GenericTraceModel root = (GenericTraceModel) traceModel; List<RelatedTo> relevantLinks = new ArrayList<RelatedTo>(); List<RelatedTo> allTraces = root.getTraces(); for (RelatedTo trace : allTraces) { if (firstElement != secondElement) { if (trace.getItem().contains(firstElement) && trace.getItem().contains(secondElement)) { relevantLinks.add(trace); } } } if (relevantLinks.size() > 0) { return true; } return this.isThereAnInternalTraceBetween(firstElement, secondElement, traceModel); }
Source:
private Collection<DDiagramElement> getNodes(final EObject semanticElement, final DSemanticDiagram dSemanticDiagram, final Collection<DiagramElementMapping> mappings) { Set<DDiagramElement> result = new HashSet<DDiagramElement>(); if (semanticElement != null) { for (DDiagramElement dDiagramElement : new DDiagramInternalQuery(dSemanticDiagram).getDiagramElements()) { if (mappings.contains(dDiagramElement.getMapping()) && semanticElement.equals(dDiagramElement.getTarget())) { result.add(dDiagramElement); } } } return result; }

Target:
private Collection<DDiagramElement> getNodes(final EObject semanticElement, final DSemanticDiagram dSemanticDiagram, final Collection<DiagramElementMapping> mappings) { Set<DDiagramElement> result = new HashSet<DDiagramElement>(); if (semanticElement != null) { for (DDiagramElement dDiagramElement : new DDiagramQuery(dSemanticDiagram).getAllDiagramElements()) { if (mappings.contains(dDiagramElement.getMapping()) && semanticElement.equals(dDiagramElement.getTarget())) { result.add(dDiagramElement); } } } return result; }
Source:
public void setOrdinal(int ordinal) { this.ordinal = ordinal; }

Target:
void setOrdinal(int ordinal) { this.ordinal = ordinal; }