auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public ImageStrip[] get(final Annotation... qualifiers) { final List<ImageStrip> result = new LinkedList<>(); for (Annotation qualifier : qualifiers) { final ManagedInstance<ImageStrip> i = stripInstances.select(qualifier); if (!i.isUnsatisfied() && !i.isAmbiguous()) { result.add(i.get()); } } return result.stream().toArray(ImageStrip[]::new); }

Target:
public ImageStrip[] get(final Annotation... qualifiers) { final List<ImageStrip> result = new LinkedList<>(); for (Annotation qualifier : qualifiers) { final ManagedInstance<ImageStrip> i = stripInstances.select(qualifier); if (!i.isUnsatisfied() && !i.isAmbiguous()) { result.add(i.get()); } } return result.toArray(new ImageStrip[result.size()]); }
Source:
private static int checkForeignIdLimit(int id, AdvancedExternalizer<?> ext) { if (id < 0) throw log.foreignExternalizerUsingNegativeId(ext, id); return id; }

Target:
private static void checkForeignIdLimit(int id, AdvancedExternalizer<?> ext) { if (id < 0) throw log.foreignExternalizerUsingNegativeId(ext, id); }
Source:
public ConfigurationSetting setSetting(String key, String value) { return setSetting(new ConfigurationSetting().key(key).value(value), Context.NONE).getValue(); }

Target:
public ConfigurationSetting setSetting(String key, String value) { return setSettingWithResponse(new ConfigurationSetting().setKey(key).setValue(value), Context.NONE).getValue(); }
Source:
public void testReallocationWorkspace(){ WorkspaceConfiguration initialConfig = WorkspaceConfiguration.builder() .initialSize(10 * 1024L * 1024L) .policyAllocation(AllocationPolicy.STRICT) .policyLearning(LearningPolicy.NONE) .build(); MemoryWorkspace workspace = Nd4j.getWorkspaceManager().getAndActivateWorkspace(initialConfig, "SOME_ID"); DataBuffer buffer = new DoubleBuffer(new double[]{1, 2, 3, 4}, workspace); assert(buffer.isAttached()); assertEquals(4, buffer.capacity()); buffer.reallocate(6); assertEquals(6, buffer.capacity()); workspace.close(); }

Target:
public void testReallocationWorkspace(){ WorkspaceConfiguration initialConfig = WorkspaceConfiguration.builder() .initialSize(10 * 1024L * 1024L) .policyAllocation(AllocationPolicy.STRICT) .policyLearning(LearningPolicy.NONE) .build(); MemoryWorkspace workspace = Nd4j.getWorkspaceManager().getAndActivateWorkspace(initialConfig, "SOME_ID"); DataBuffer buffer = Nd4j.createBuffer(new double[]{1, 2, 3, 4}); assertTrue(buffer.isAttached()); assertEquals(4, buffer.capacity()); buffer.reallocate(6); assertEquals(6, buffer.capacity()); workspace.close(); }
Source:
private SearchScratchSearchProjectsListFragment getSearchFragment() { return (SearchScratchSearchProjectsListFragment) getFragmentManager() .findFragmentById( R.id.fragment_scratch_search_projects_list); }

Target:
private ScratchProgramsListFragment getSearchFragment() { return (ScratchProgramsListFragment) getFragmentManager() .findFragmentById(R.id.fragment_search_scratch_programs); }
Source:
private static String simpleRelDigest(RelNode rel) { StringBuilder digest = new StringBuilder(rel.getRelTypeName()); digest.append('#'); if (rel instanceof RelSubset) { RelSubset subset = (RelSubset) rel; digest.append(subset.getSetId()); for (RelTrait trait : subset.getTraitSet()) { digest.append('.').append(trait); } } else if (rel instanceof HepRelVertex) { digest.append(((HepRelVertex) rel).getCurrentRel().getId()); } else { digest.append(rel.getId()); } return digest.toString(); }

Target:
private static String simpleRelDigest(RelNode rel) { return rel.getRelTypeName() + '#' + rel.getId(); }
Source:
public void setValues(SolrDocument document) { super.setValues(document); this.firstName = Objects.toString(document.getFieldValue("first_name")); this.lastName = Objects.toString(document.getFieldValue("last_name")); nameVariants = new ArrayList<String>(); Collection<Object> document_name_variant = document.getFieldValues("name_variant"); if (document_name_variant != null) { for (Object name_variants : document_name_variant) { addNameVariant(String.valueOf(name_variants)); } } if (document.getFieldValue("institution") != null) { this.institution = String.valueOf(document.getFieldValue("institution")); } Collection<Object> emails = document.getFieldValues("email"); if (emails != null) { for (Object email : emails) { addEmail(String.valueOf(email)); } } }

Target:
public void setValues(SolrDocument document) { super.setValues(document); this.firstName = Objects.toString(document.getFieldValue("first_name"), ""); this.lastName = Objects.toString(document.getFieldValue("last_name"), ""); nameVariants = new ArrayList<String>(); Collection<Object> document_name_variant = document.getFieldValues("name_variant"); if (document_name_variant != null) { for (Object name_variants : document_name_variant) { addNameVariant(String.valueOf(name_variants)); } } if (document.getFieldValue("institution") != null) { this.institution = String.valueOf(document.getFieldValue("institution")); } Collection<Object> emails = document.getFieldValues("email"); if (emails != null) { for (Object email : emails) { addEmail(String.valueOf(email)); } } }
Source:
public static ValueIndexItem property(@NonNull String property) { if(property == null) { throw new IllegalArgumentException("property is null"); } return new ValueIndexItem(Expression.property(property)); }

Target:
public static ValueIndexItem property(@NonNull String property) { if (property == null) { throw new IllegalArgumentException("property is null."); } return new ValueIndexItem(Expression.property(property)); }
Source:
public static ZombieType toNative(org.spongepowered.api.data.type.ZombieType type, @Nullable Profession profession) { if(type == ZombieTypes.NORMAL) { return ZombieType.NORMAL; } else if(type == ZombieTypes.HUSK) { return ZombieType.HUSK; } else { return ZOMBIE_TYPE_MAP.get(profession); } }

Target:
public static ZombieType toNative(org.spongepowered.api.data.type.ZombieType type, @Nullable Profession profession) { if (type == ZombieTypes.NORMAL) { return ZombieType.NORMAL; } else if (type == ZombieTypes.HUSK) { return ZombieType.HUSK; } else { return ZOMBIE_TYPE_MAP.getOrDefault(profession, ZombieType.NORMAL); } }
Source:
public static void main(String[] args) { if (args.length < 1 || !"encryption".equals(args[0]) || !"decryption".equals(args[0] )){ LOG.error("Expect encryption/decryption action parameter"); return; } boolean encrypt = "encryption".equals(args[0]); SensitiveDataEncryption sensitiveDataEncryption = null; try { Injector injector = Guice.createInjector(new EncryptionHelperControllerModule(), new EncryptionHelperAuditModule(), new LdapModule()); sensitiveDataEncryption = injector.getInstance(SensitiveDataEncryption.class); sensitiveDataEncryption.startPersistenceService(); AmbariManagementController ambariManagementController = injector.getInstance(AmbariManagementController.class); Encryptor<Config> configEncryptor = injector.getInstance(ConfigPropertiesEncryptor.class); Clusters clusters = ambariManagementController.getClusters(); if (clusters != null) { Map<String, Cluster> clusterMap = clusters.getClusters(); if (clusterMap != null && !clusterMap.isEmpty()) { for (final Cluster cluster : clusterMap.values()) { Collection<Config> configs = cluster.getAllConfigs(); for (Config config : configs) { if (encrypt) { config.encryptSensitiveDataAndSave(configEncryptor); } else { config.decryptSensitiveDataAndSave(configEncryptor); } } } } } } catch (Throwable e) { LOG.error("Exception occurred during config encryption/decryption:", e); } finally { if (sensitiveDataEncryption != null) { sensitiveDataEncryption.stopPersistenceService(); } } }

Target:
public static void main(String[] args) { if (args.length < 1 || (!"encryption".equals(args[0]) && !"decryption".equals(args[0] ))){ LOG.error("The action parameter (\"encryption\" or \"decryption\") is required"); System.exit(-1); } boolean encrypt = "encryption".equals(args[0]); SensitiveDataEncryption sensitiveDataEncryption = null; try { Injector injector = Guice.createInjector(new EncryptionHelperControllerModule(), new EncryptionHelperAuditModule(), new LdapModule()); sensitiveDataEncryption = injector.getInstance(SensitiveDataEncryption.class); sensitiveDataEncryption.startPersistenceService(); sensitiveDataEncryption.doEncryption(encrypt); } catch (Throwable e) { LOG.error("Exception occurred during config encryption/decryption:", e); } finally { if (sensitiveDataEncryption != null) { sensitiveDataEncryption.stopPersistenceService(); } } }
Source:
public Response doImport(Action action) { validateParameters(action, "cluster.id|name"); Guid destStorageDomainId = getDestStorageDomainId(action); ImportVmTemplateParameters params = new ImportVmTemplateParameters(parent.getDataCenterId(destStorageDomainId), parent.getStorageDomainId(), destStorageDomainId, getClusterId(action), getEntity()); params.setImageToDestinationDomainMap(getDiskToDestinationMap(action)); params.setForceOverride(action.isSetForce() ? action.isForce() : false); if (action.isSetClone()){ params.setImportAsNewEntity(action.isClone()); if(action.isSetTemplate() && action.getTemplate().isSetName()) { params.getVmTemplate().setname(action.getTemplate().getName()); } } return doAction(VdcActionType.ImportVmTemplate, params, action); }

Target:
public Response doImport(Action action) { validateParameters(action, "cluster.id|name"); Guid destStorageDomainId = getDestStorageDomainId(action); ImportVmTemplateParameters params = new ImportVmTemplateParameters(parent.getDataCenterId(destStorageDomainId), parent.getStorageDomainId(), destStorageDomainId, getClusterId(action), getEntity()); params.setImageToDestinationDomainMap(getDiskToDestinationMap(action)); params.setForceOverride(action.isSetExclusive() ? action.isExclusive() : false); if (action.isSetClone()){ params.setImportAsNewEntity(action.isClone()); if(action.isSetTemplate() && action.getTemplate().isSetName()) { params.getVmTemplate().setname(action.getTemplate().getName()); } } return doAction(VdcActionType.ImportVmTemplate, params, action); }
Source:
private void resetTabsValidity() { setIsGeneralTabValid(true); setIsSystemTabValid(true); setIsFirstRunTabValid(true); setIsDisplayTabValid(true); setIsHostTabValid(true); setIsAllocationTabValid(true); setIsBootSequenceTabValid(true); setRngTabValid(true); setIsCustomPropertiesTabValid(true); }

Target:
private void resetTabsValidity() { setIsGeneralTabValid(true); setIsSystemTabValid(true); setIsFirstRunTabValid(true); setIsDisplayTabValid(true); setIsHostTabValid(true); setIsAllocationTabValid(true); setIsBootSequenceTabValid(true); setRngTabValid(true); setIsCustomPropertiesTabValid(true); getValid().setEntity(true); }
Source:
private void initSwagger() { final Info info = new Info() .version(OpenmrsConstants.OPENMRS_VERSION_SHORT) .title("OpenMRS API Docs") .description("OpenMRS RESTful API documentation generated by Swagger") .contact(new Contact().name("OpenMRS Talk").url("<LINK_2>")) .license(new License().name("MPL-2.0 w/ HD").url("<LINK_0>")); this.swagger .info(info) .scheme(Scheme.HTTP) .securityDefinition("basic_auth", new BasicAuthDefinition()) .security(new SecurityRequirement().requirement("basic_auth")) .consumes("application/json") .produces("application/json"); String host = baseUrl.split("/")[0]; String basePath = baseUrl.substring(baseUrl.indexOf("/")) + "/v1"; this.swagger .host(host) .basePath(basePath); }

Target:
private void initSwagger() { final Info info = new Info() .version(OpenmrsConstants.OPENMRS_VERSION_SHORT) .title("OpenMRS API Docs") .description("OpenMRS RESTful API specification") .contact(new Contact().url("<LINK_1>")) .license(new License().name("MPL-2.0 w/ HD").url("<LINK_0>")); this.swagger .info(info) .scheme(Scheme.HTTP) .securityDefinition("basic_auth", new BasicAuthDefinition()) .security(new SecurityRequirement().requirement("basic_auth")) .consumes("application/json") .produces("application/json"); String host = baseUrl.split("/")[0]; String basePath = baseUrl.substring(baseUrl.indexOf("/")) + "/v1"; this.swagger .host(host) .basePath(basePath); }
Source:
public void testGetSelectedNodeWhenNotSelected() { selectedItems.clear(); assertEquals(null, ClientUtils.getSelectedNode(diagram, viewerSession)); assertEquals(null, ClientUtils.getSelectedNode(diagram, editorSession)); }

Target:
public void testGetSelectedNodeWhenNotSelected() { selectedItems.clear(); assertNull(ClientUtils.getSelectedNode(diagram, viewerSession)); assertNull(ClientUtils.getSelectedNode(diagram, editorSession)); }
Source:
private static ExpressionTree mostLeft(ExpressionTree arg) { ExpressionTree res = arg; while (res.is(Tree.Kind.PLUS)) { res = ((BinaryExpressionTree) res).leftOperand(); } return res; }

Target:
private static ExpressionTree mostLeft(ExpressionTree arg) { ExpressionTree res = ExpressionUtils.skipParentheses(arg); while (res.is(Tree.Kind.PLUS)) { res = ExpressionUtils.skipParentheses(((BinaryExpressionTree) res).leftOperand()); } return res; }
Source:
public void refresh() { ChannelBindingAdapter adapter = binderAdapter(); adapter.setOutputChannels(getOutputChannels()); adapter.setInputChannels(getInputChannels()); }

Target:
public void refresh() { ChannelBindingAdapter adapter = bindingAdapter(); adapter.setOutputChannels(getOutputChannels()); adapter.setInputChannels(getInputChannels()); }
Source:
public QuestionsBlock getQuestionsBlockByUserId(String userID, String appointmentId) throws QuestionsBlockNotFound, InterviewNotFoundException, HttpRequestException, WrongCriteriaException { questionsBlocks = interviewService.getInterviewByAppointmentID(appointmentId).getQuestionsBlocks(); for (QuestionsBlock questionsBlock1 : questionsBlocks){ try{ if (questionsBlock1.getUser().getId().equals(userID)) return questionsBlock1; } catch(NullPointerException e){} } throw new QuestionsBlockNotFound("Wrong userID or appointmentId"); }

Target:
public QuestionsBlock getQuestionsBlockByUserId(String userID, String appointmentId) throws QuestionsBlockNotFound, InterviewNotFoundException, HttpRequestException, WrongCriteriaException { questionsBlocks = interviewService.getInterviewByAppointmentID(appointmentId).getQuestionsBlocks(); for (QuestionsBlock questionsBlock1 : questionsBlocks){ if (questionsBlock1.getUser() != null && questionsBlock1.getUser().getId().equals(userID)) return questionsBlock1; } throw new QuestionsBlockNotFound("Wrong userID or appointmentId"); }
Source:
private Map<Integer, List<CommitItem>> getSeverityItems() { Map<Integer, List<CommitItem>> result = new HashMap<>(); for (final CommitItem item : items) { if (item.getProblemSeverity() >= IMarker.SEVERITY_WARNING) { if (result.get(item.getProblemSeverity()) == null) { result.put(item.getProblemSeverity(), new ArrayList<CommitItem>() { { add(item); } }); } else { result.get(item.getProblemSeverity()).add(item); } } } return result; }

Target:
private Map<Integer, List<CommitItem>> getSeverityItems() { Map<Integer, List<CommitItem>> result = new HashMap<>(); for (final CommitItem item : items) { if (item.getProblemSeverity() >= IMarker.SEVERITY_WARNING) { if (result.get(item.getProblemSeverity()) == null) { List<CommitItem> itemsList = new ArrayList<>(); itemsList.add(item); result.put(item.getProblemSeverity(), itemsList); } else { result.get(item.getProblemSeverity()).add(item); } } } return result; }
Source:
public String getProcessForm(String containerId, String processId, String language) { if( config.isRest() ) { Map<String, Object> valuesMap = new HashMap<String, Object>(); valuesMap.put(RestURI.CONTAINER_ID, containerId); valuesMap.put(RestURI.PROCESS_ID, processId); return makeHttpGetRequestAndCreateRawResponse( build(loadBalancer.getUrl(), FORM_URI + "/" + PROCESS_FORM_GET_URI, valuesMap) + "?lang=" + language); } else { CommandScript script = new CommandScript( Collections.singletonList( (KieServerCommand) new DescriptorCommand( "FormService", "getFormDisplayProcess", new Object[]{containerId, processId, language, true} )) ); ServiceResponse<String> response = (ServiceResponse<String>) executeJmsCommand( script, DescriptorCommand.class.getName(), "BPM-UI", containerId ).getResponses().get(0); throwExceptionOnFailure(response); return response.getResult(); } }

Target:
public String getProcessForm(String containerId, String processId, String language) { if( config.isRest() ) { Map<String, Object> valuesMap = new HashMap<String, Object>(); valuesMap.put(RestURI.CONTAINER_ID, containerId); valuesMap.put(RestURI.PROCESS_ID, processId); return makeHttpGetRequestAndCreateRawResponse( build(loadBalancer.getUrl(), FORM_URI + "/" + PROCESS_FORM_GET_URI, valuesMap) + "?lang=" + language + "&filter=true"); } else { CommandScript script = new CommandScript( Collections.singletonList( (KieServerCommand) new DescriptorCommand( "FormService", "getFormDisplayProcess", new Object[]{containerId, processId, language, true} )) ); ServiceResponse<String> response = (ServiceResponse<String>) executeJmsCommand( script, DescriptorCommand.class.getName(), "BPM-UI", containerId ).getResponses().get(0); throwExceptionOnFailure(response); return response.getResult(); } }
Source:
public String addCustomer(final String name) { if (LOG.isTraceEnabled()) { LOG.trace("CustomerManager.addCustomer(name=" + name + ")"); } beginTransaction(); try { final Customer customer = new Customer(customerDAO.getNextId(), name); customerDAO.insert(customer); commitTransaction(); return "customerAdded"; } catch (Exception e) { LOG.warn(e.getMessage(), e); rollbackTransaction(); return "customerDuplicate"; } }

Target:
public String addCustomer(final String name) throws SystemException, NotSupportedException, RollbackException { if (LOG.isTraceEnabled()) { LOG.trace("CustomerManager.addCustomer(name=" + name + ")"); } final TransactionManager transactionManager = com.arjuna.ats.jta.TransactionManager.transactionManager(); transactionManager.begin(); transactionManager.getTransaction().enlistResource(new DummyXAResource()); try { final Customer customer = new Customer(customerDAO.getNextId(), name); customerDAO.insert(customer); transactionManager.commit(); return "customerAdded"; } catch (Exception e) { LOG.warn(e.getMessage(), e); transactionManager.rollback(); return "customerDuplicate"; } }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.display_points); mapButton = (Button) findViewById(R.id.mapButton); nextScenarioButton = (Button) findViewById(R.id.nextScenarioButton); Integer currentPointsValue = getIntent().getExtras().getInt(getString(R.string.current_points_key)); currentPointsTextView = (TextView) findViewById(R.id.current_points_text); totalPointsTextView = (TextView) findViewById(R.id.total_points_text); currentPointsTextView.setText(currentPointsValue.toString()); Integer totalPointsValue = SessionHistory.totalPoints; totalPointsTextView.setText(totalPointsValue.toString()); mapButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setResult(Activity.RESULT_CANCELED, new Intent()); finish(); } }); nextScenarioButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setResult(Activity.RESULT_OK, new Intent()); finish(); } }); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.display_points); mapButton = (Button) findViewById(R.id.mapButton); nextScenarioButton = (Button) findViewById(R.id.nextScenarioButton); Integer currentPointsValue = getIntent().getExtras().getInt(Keys.currentPointsKey); currentPointsTextView = (TextView) findViewById(R.id.current_points_text); totalPointsTextView = (TextView) findViewById(R.id.total_points_text); currentPointsTextView.setText(currentPointsValue.toString()); totalPointsTextView.setText(new Integer(SessionHistory.totalPoints).toString()); mapButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setResult(Activity.RESULT_CANCELED, new Intent()); finish(); } }); nextScenarioButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setResult(Activity.RESULT_OK, new Intent()); finish(); } }); }
Source:
private String convertFipsPoCountryOptionToFipsCountryCode(String poCountryOption) { if (StringUtils.isNotBlank(poCountryOption) && StringUtils.equalsIgnoreCase(poCountryOption, PaymentWorksConstants.PaymentWorksPurchaseOrderCountryFipsOption.UNITED_STATES.getPmwCountryOptionAsString())) { return PaymentWorksConstants.PaymentWorksPurchaseOrderCountryFipsOption.UNITED_STATES.getFipsCountryCode(); } else if (StringUtils.isNotBlank(poCountryOption) && StringUtils.equalsIgnoreCase(poCountryOption, PaymentWorksConstants.PaymentWorksPurchaseOrderCountryFipsOption.CANADA.getPmwCountryOptionAsString())) { return PaymentWorksConstants.PaymentWorksPurchaseOrderCountryFipsOption.CANADA.getFipsCountryCode(); } else if (StringUtils.isNotBlank(poCountryOption) && StringUtils.equalsIgnoreCase(poCountryOption, PaymentWorksConstants.PaymentWorksPurchaseOrderCountryFipsOption.AUSTRALIA.getPmwCountryOptionAsString())) { return PaymentWorksConstants.PaymentWorksPurchaseOrderCountryFipsOption.AUSTRALIA.getFipsCountryCode(); } else if (StringUtils.isNotBlank(poCountryOption) && StringUtils.equalsIgnoreCase(poCountryOption, PaymentWorksConstants.PaymentWorksPurchaseOrderCountryFipsOption.OTHER.getPmwCountryOptionAsString())) { return PaymentWorksConstants.PaymentWorksPurchaseOrderCountryFipsOption.OTHER.getFipsCountryCode(); } return KFSConstants.EMPTY_STRING; }

Target:
private String convertFipsPoCountryOptionToFipsCountryCode(String poCountryOption) { if (StringUtils.isBlank(poCountryOption)) { return KFSConstants.EMPTY_STRING; } else if (StringUtils.equalsIgnoreCase(poCountryOption, PaymentWorksConstants.PaymentWorksPurchaseOrderCountryFipsOption.UNITED_STATES.getPmwCountryOptionAsString())) { return PaymentWorksConstants.PaymentWorksPurchaseOrderCountryFipsOption.UNITED_STATES.getFipsCountryCode(); } else if (StringUtils.equalsIgnoreCase(poCountryOption, PaymentWorksConstants.PaymentWorksPurchaseOrderCountryFipsOption.CANADA.getPmwCountryOptionAsString())) { return PaymentWorksConstants.PaymentWorksPurchaseOrderCountryFipsOption.CANADA.getFipsCountryCode(); } else if (StringUtils.equalsIgnoreCase(poCountryOption, PaymentWorksConstants.PaymentWorksPurchaseOrderCountryFipsOption.AUSTRALIA.getPmwCountryOptionAsString())) { return PaymentWorksConstants.PaymentWorksPurchaseOrderCountryFipsOption.AUSTRALIA.getFipsCountryCode(); } else if (StringUtils.equalsIgnoreCase(poCountryOption, PaymentWorksConstants.PaymentWorksPurchaseOrderCountryFipsOption.OTHER.getPmwCountryOptionAsString())) { return PaymentWorksConstants.PaymentWorksPurchaseOrderCountryFipsOption.OTHER.getFipsCountryCode(); } return KFSConstants.EMPTY_STRING; }
Source:
public void testChildPredicate() throws Exception { final Predicate<Edge> predicate = CaseManagementCommandUtil.childPredicate(); final Edge edge = mock(Edge.class); when(edge.getContent()).thenReturn(mock(Child.class)); assertTrue(predicate.test(edge)); }

Target:
public void testChildPredicate() { final Predicate<Edge> predicate = CaseManagementCommandUtil.childPredicate(); final Edge edge = mock(Edge.class); when(edge.getContent()).thenReturn(mock(Child.class)); assertTrue(predicate.test(edge)); }
Source:
public static void main(String[] args) throws Exception { final ParameterTool params = ParameterTool.fromArgs(args); System.out.println("Usage: MatrixVectorMul [--output <path>] [--dimension <dimension> --data-size <data_size>] [--resource-name <resource_name>]"); final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); env.getConfig().setGlobalJobParameters(params); int dimension; if (params.has("dimension")) { dimension = params.getInt("dimension"); } else { System.out.println(String.format("Executing MatrixVectorMul example with default vector dimension %d.\nUse --dimension to specify dimension of input vector.", DEFAULT_DIM)); dimension = DEFAULT_DIM; } int dataSize; if (params.has("data-size")) { dataSize = params.getInt("data-size"); } else { System.out.println(String.format("Executing MatrixVectorMul example with default data size %d.\nUse --data-size to specify size of the vector stream.", DEFAULT_DATA_SIZE)); dataSize = DEFAULT_DATA_SIZE; } String resourceName; if (params.has("resource-name")) { resourceName = params.get("resource-name"); } else { System.out.println(String.format("Executing MatrixVectorMul example with default resource name %s.\nUse --resource-name to specify resource name of GPU.", DEFAULT_RESOURCE_NAME)); resourceName = DEFAULT_RESOURCE_NAME; } DataStream<List<Float>> result = env.addSource(new RandomVectorSource(dimension, dataSize)) .map(new Multiplier(dimension, resourceName)); if (params.has("output")) { result.addSink(StreamingFileSink.forRowFormat(new Path(params.get("output")), new SimpleStringEncoder<List<Float>>()).build()); } else { System.out.println("Printing result to stdout. Use --output to specify output path."); result.print(); } env.execute("Matrix-Vector Multiplication"); }

Target:
public static void main(String[] args) throws Exception { final ParameterTool params = ParameterTool.fromArgs(args); System.out.println("Usage: MatrixVectorMul [--output <path>] [--dimension <dimension> --data-size <data_size>] [--resource-name <resource_name>]"); final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); env.getConfig().setGlobalJobParameters(params); final int dimension = params.getInt("dimension", DEFAULT_DIM); final int dataSize = params.getInt("data-size", DEFAULT_DATA_SIZE); final String resourceName = params.get("resource-name", DEFAULT_RESOURCE_NAME); DataStream<List<Float>> result = env.addSource(new RandomVectorSource(dimension, dataSize)) .map(new Multiplier(dimension, resourceName)); if (params.has("output")) { result.addSink(StreamingFileSink.forRowFormat(new Path(params.get("output")), new SimpleStringEncoder<List<Float>>()).build()); } else { System.out.println("Printing result to stdout. Use --output to specify output path."); result.print(); } env.execute("Matrix-Vector Multiplication"); }
Source:
void shutdown() throws InterruptedException, StoreException, IOException { long startTimeInMs = time.milliseconds(); try { if (enabled.get()) { logger.info("Hard delete shutdown initiated for store ", dataDir); enabled.set(false); hardDeleteLock.lock(); if (awaitingAfterCaughtUp) { logger.info("HardDelete is awaiting after caught up for store ", dataDir); } else { logger.info("HardDelete in progress for store ", dataDir); } try { pauseCondition.signal(); } finally { hardDeleteLock.unlock(); } shutdownLatch.await(); logger.info("Hard delete shutdown complete for store ", dataDir); } } finally { metrics.hardDeleteShutdownTimeInMs.update(time.milliseconds() - startTimeInMs); } }

Target:
void shutdown() throws InterruptedException { long startTimeInMs = time.milliseconds(); try { if (enabled.get()) { logger.info("Hard delete shutdown initiated for store ", dataDir); enabled.set(false); hardDeleteLock.lock(); if (awaitingAfterCaughtUp) { logger.info("HardDelete is awaiting after caught up for store ", dataDir); } else { logger.info("HardDelete in progress for store ", dataDir); } try { pauseCondition.signal(); } finally { hardDeleteLock.unlock(); } shutdownLatch.await(); logger.info("Hard delete shutdown complete for store ", dataDir); } } finally { metrics.hardDeleteShutdownTimeInMs.update(time.milliseconds() - startTimeInMs); } }
Source:
public static Supplier<Connection> buildEphemeralSqlite() { HikariConfig config = new HikariConfig(); config.setDriverClassName("org.sqlite.JDBC"); config.setJdbcUrl("jdbc:sqlite::memory:"); config.setConnectionTestQuery("SELECT 1"); config.setMaxLifetime(60000); config.setIdleTimeout(45000); config.setMaximumPoolSize(50); HikariDataSource ds = new HikariDataSource(config); return () -> { try { return ds.getConnection(); } catch (SQLException e) { throw new RuntimeException(e); } }; }

Target:
public static Supplier<Connection> buildEphemeralSqlite() { try { Connection memory = Sqlite.build(":memory:"); Connection instance = new Sqlite.UncloseableConnection(memory); return () -> instance; } catch (SQLException e) { throw new RuntimeException(e); } }
Source:
public void init(PinotConfiguration config) { Preconditions.checkArgument(!isNullOrEmpty(config.getProperty(REGION))); String region = config.getProperty(REGION); disableAcl = config.getProperty(DISABLE_ACL, true); AwsCredentialsProvider awsCredentialsProvider; try { if (!isNullOrEmpty(config.getProperty(ACCESS_KEY)) && !isNullOrEmpty(config.getProperty(SECRET_KEY))) { String accessKey = config.getProperty(ACCESS_KEY); String secretKey = config.getProperty(SECRET_KEY); AwsBasicCredentials awsBasicCredentials = AwsBasicCredentials.create(accessKey, secretKey); awsCredentialsProvider = StaticCredentialsProvider.create(awsBasicCredentials); } else { awsCredentialsProvider = DefaultCredentialsProvider.create(); } S3ClientBuilder s3ClientBuilder = S3Client.builder().region(Region.of(region)).credentialsProvider(awsCredentialsProvider); if (!isNullOrEmpty(config.getProperty(ENDPOINT))) { String endpoint = config.getProperty(ENDPOINT); try { s3ClientBuilder.endpointOverride(new URI(endpoint)); } catch (URISyntaxException e) { throw new RuntimeException(e); } } _s3Client = s3ClientBuilder.build(); } catch (S3Exception e) { throw new RuntimeException("Could not initialize S3PinotFS", e); } }

Target:
public void init(PinotConfiguration config) { Preconditions.checkArgument(!isNullOrEmpty(config.getProperty(REGION))); String region = config.getProperty(REGION); disableAcl = config.getProperty(DISABLE_ACL_CONFIG_KEY, DEFAULT_DISABLE_ACL); AwsCredentialsProvider awsCredentialsProvider; try { if (!isNullOrEmpty(config.getProperty(ACCESS_KEY)) && !isNullOrEmpty(config.getProperty(SECRET_KEY))) { String accessKey = config.getProperty(ACCESS_KEY); String secretKey = config.getProperty(SECRET_KEY); AwsBasicCredentials awsBasicCredentials = AwsBasicCredentials.create(accessKey, secretKey); awsCredentialsProvider = StaticCredentialsProvider.create(awsBasicCredentials); } else { awsCredentialsProvider = DefaultCredentialsProvider.create(); } S3ClientBuilder s3ClientBuilder = S3Client.builder().region(Region.of(region)).credentialsProvider(awsCredentialsProvider); if (!isNullOrEmpty(config.getProperty(ENDPOINT))) { String endpoint = config.getProperty(ENDPOINT); try { s3ClientBuilder.endpointOverride(new URI(endpoint)); } catch (URISyntaxException e) { throw new RuntimeException(e); } } _s3Client = s3ClientBuilder.build(); } catch (S3Exception e) { throw new RuntimeException("Could not initialize S3PinotFS", e); } }
Source:
DiskIOScheduler(Map<String, Throttler> throttlers) { if (throttlers != null) { this.throttlers.putAll(throttlers); } }

Target:
DiskIOScheduler(Map<String, Throttler> throttlers) { this.throttlers = throttlers != null ? throttlers : new HashMap<String, Throttler>(); }
Source:
public void run() { try { scheduler.freeze(); while (!noOtherTaskIsRunning()) { Thread.sleep(10000); } removeOldBackups(); performBackup(); } catch (IOException | InterruptedException e) { LOGGER.error(e); } finally { scheduler.resume(); } }

Target:
public void run() { try { scheduler.freeze(); while (!noOtherTaskIsRunning()) { Thread.sleep(10000); } removeOldBackups(); performBackup(); } catch (IOException | InterruptedException e) { LOGGER.error("", e); } finally { scheduler.resume(); } }
Source:
public void updateWith(Talk item, Room row, Date start, Date end, boolean isPlaceholder) { super.updateWith(item, row, start, end, isPlaceholder); ((TalkView) itemView).updateWith(item); }

Target:
public void updateWith(Talk item, Room row, Date start, Date end, boolean isPlaceholder) { super.updateWith(item, row, start, end, isPlaceholder); talkView.updateWith(item); }
Source:
public Session toSession(SessionPropertyManager sessionPropertyManager) { return new Session( new QueryId(queryId), transactionId, clientTransactionSupport, new Identity(user, InternalPrincipal.createPrincipal(getPrincipal())), source, catalog, schema, timeZoneKey, locale, remoteUserAddress, userAgent, clientInfo, clientTags, startTime, systemProperties, catalogProperties, ImmutableMap.of(), sessionPropertyManager, preparedStatements); }

Target:
public Session toSession(SessionPropertyManager sessionPropertyManager) { return new Session( new QueryId(queryId), transactionId, clientTransactionSupport, new Identity(user, InternalPrincipal.createPrincipal(principal)), source, catalog, schema, timeZoneKey, locale, remoteUserAddress, userAgent, clientInfo, clientTags, startTime, systemProperties, catalogProperties, ImmutableMap.of(), sessionPropertyManager, preparedStatements); }
Source:
public static void main(String[] args) { IllinoisLemmatizer lem = new IllinoisLemmatizer(); logger.info("Getting lemma for 'media': "); String lemma = lem.getLemma("media", "NNS"); logger.info(lemma); logger.info("Getting lemma for 'men': "); lemma = lem.getLemma("men", "NNS"); logger.info(lemma); logger.info("Getting lemmas for 'retakes': "); lemma = lem.getLemma("retakes", "VBZ"); logger.info(lemma); logger.info("Getting lemmas for 'putting': "); lemma = lem.getLemma("putting", "VBG"); logger.info(lemma); }

Target:
public static void main(String[] args) { IllinoisLemmatizer lem = new IllinoisLemmatizer(); System.out.println("Getting lemma for 'media': "); String lemma = lem.getLemma("media", "NNS"); System.out.println(lemma); System.out.println("Getting lemma for 'men': "); lemma = lem.getLemma("men", "NNS"); System.out.println(lemma); System.out.println("Getting lemmas for 'retakes': "); lemma = lem.getLemma("retakes", "VBZ"); System.out.println(lemma); System.out.println("Getting lemmas for 'putting': "); lemma = lem.getLemma("putting", "VBG"); System.out.println(lemma); }
Source:
public double computeWithResultOption(MetricKey<O> key, T node, MetricVersion version, ResultOption option) { checkKeyNotNull(key); if (option == null) { throw new IllegalArgumentException("The result option may not be null"); } MetricVersion safeVersion = (version == null) ? Version.STANDARD : version; return getLanguageSpecificComputer().computeWithResultOption(key, node, false, safeVersion, option, getLanguageSpecificProjectMirror()); }

Target:
public double computeWithResultOption(MetricKey<O> key, T node, MetricVersion version, ResultOption option) { Objects.requireNonNull(key, "The metric key must not be null"); Objects.requireNonNull(option, "The result option must not be null"); MetricVersion safeVersion = (version == null) ? Version.STANDARD : version; return getLanguageSpecificComputer().computeWithResultOption(key, node, false, safeVersion, option, getLanguageSpecificProjectMirror()); }
Source:
protected List<OvfEntityData> getEntitiesFromStorageOvfDisk() { List<OvfEntityData> ovfEntitiesFromTar = Collections.emptyList(); boolean isUnregisteredDisksRetrieved = false; List<Disk> unregisteredDisks = getBackend().runInternalQuery(VdcQueryType.GetUnregisteredDisks, new GetUnregisteredDisksQueryParameters(getParameters().getStorageDomainId(), getVds().getStoragePoolId())).getReturnValue(); if (!unregisteredDisks.isEmpty()) { Pair<DiskImage, Long> ovfDiskAndSize = getLatestOVFDisk(unregisteredDisks); DiskImage ovfDisk = ovfDiskAndSize.getFirst(); if (ovfDisk != null) { try { VDSReturnValue retrievedByteData = runVdsCommand(VDSCommandType.RetrieveImageData, new ImageHttpAccessVDSCommandParameters(getVdsId(), getParameters().getStoragePoolId(), getParameters().getStorageDomainId(), ovfDisk.getId(), ovfDisk.getImage().getId(), ovfDiskAndSize.getSecond())); if (retrievedByteData.getSucceeded()) { ovfEntitiesFromTar = OvfUtils.getOvfEntities((byte[]) retrievedByteData.getReturnValue(), getParameters().getStorageDomainId()); isUnregisteredDisksRetrieved = true; } } catch (VdcBLLException e) { log.errorFormat("Image data could not be retrieved for disk id {0} in storage domain id {1}", ovfDisk.getId(), getParameters().getStorageDomainId()); } } } if (!isUnregisteredDisksRetrieved) { AuditLogDirector.log(this, AuditLogType.RETRIEVE_OVF_STORE_FAILED); } return ovfEntitiesFromTar; }

Target:
protected List<OvfEntityData> getEntitiesFromStorageOvfDisk() { List<OvfEntityData> ovfEntitiesFromTar = Collections.emptyList(); boolean isOvfDataRetirieved = false; List<Disk> unregisteredDisks = getBackend().runInternalQuery(VdcQueryType.GetUnregisteredDisks, new GetUnregisteredDisksQueryParameters(getParameters().getStorageDomainId(), getVds().getStoragePoolId())).getReturnValue(); if (!unregisteredDisks.isEmpty()) { Pair<DiskImage, Long> ovfDiskAndSize = getLatestOVFDisk(unregisteredDisks); DiskImage ovfDisk = ovfDiskAndSize.getFirst(); if (ovfDisk != null) { try { VDSReturnValue retrievedByteData = runVdsCommand(VDSCommandType.RetrieveImageData, new ImageHttpAccessVDSCommandParameters(getVdsId(), getParameters().getStoragePoolId(), getParameters().getStorageDomainId(), ovfDisk.getId(), ovfDisk.getImage().getId(), ovfDiskAndSize.getSecond())); if (retrievedByteData.getSucceeded()) { ovfEntitiesFromTar = OvfUtils.getOvfEntities((byte[]) retrievedByteData.getReturnValue(), getParameters().getStorageDomainId()); isOvfDataRetirieved = true; } } catch (RuntimeException e) { log.errorFormat("Image data could not be retrieved for disk id {0} in storage domain id {1}. Error: {2}", ovfDisk.getId(), getParameters().getStorageDomainId(), e); } } } if (!isOvfDataRetirieved) { AuditLogDirector.log(this, AuditLogType.RETRIEVE_OVF_STORE_FAILED); } return ovfEntitiesFromTar; }
Source:
public void register(FContext context, FAsyncCallback callback) throws TException { if (context.getOpId() == 0) { context.setOpId(NEXT_OP_ID.incrementAndGet()); } if (handlers.containsKey(context.getOpId())) { throw new FException("context already registered"); } handlers.put(context.getOpId(), callback); }

Target:
public void register(FContext context, FAsyncCallback callback) throws TException { if (handlers.containsKey(context.getOpId())) { throw new FException("context already registered"); } long opId = NEXT_OP_ID.incrementAndGet(); context.setOpId(opId); handlers.put(opId, Pair.of(callback, Thread.currentThread())); }
Source:
public static long getFormIdForPath(File path) { long formId = -1; Cursor cursor = null; try { cursor = OdkXformSyncTask.getCursorForFormFile( path, new String[] { BaseColumns._ID }); if(cursor.getCount() >= 1) { if (cursor.getCount() > 1) { Log.e(TAG, "More than one form in database with the same id. This indicates an " + "error occurred on insert (probably a race condition) and should be " + "fixed. However, the app should still function correctly"); } Preconditions.checkArgument(cursor.getColumnCount() == 1); cursor.moveToNext(); formId = cursor.getLong(0); } } finally { if (cursor != null) { cursor.close(); } } return formId; }

Target:
public static long getFormIdForPath(File path) { long formId = -1; Cursor cursor = null; try { cursor = OdkXformSyncTask.getCursorForFormFile( path, new String[] { BaseColumns._ID }); if(cursor.getCount() >= 1) { if (cursor.getCount() > 1) { Log.e(TAG, "More than one form in database with the same id. This indicates an " + "error occurred on insert (probably a race condition) and should be " + "fixed. However, the app should still function correctly"); } cursor.moveToNext(); formId = cursor.getLong(0); } } finally { if (cursor != null) { cursor.close(); } } return formId; }
Source:
private void calculateTurn()

Target:
private void calculateTurn() { setupDiffusionMaps(); }
Source:
public Set<Executor> getAllActiveExecutors() { return activeExecutors; }

Target:
public Collection<Executor> getAllActiveExecutors() { return Collections.unmodifiableCollection(activeExecutors); }
Source:
private RefactoringStatus checkAbstractMembersInDestinationClasses(IMember[] membersToPushDown, IType[] destinationClassesForAbstract) throws JavaModelException { RefactoringStatus result= new RefactoringStatus(); IMember[] abstractMembersToPushDown= getAbstractMembers(membersToPushDown); for (IType t : destinationClassesForAbstract) { result.merge(MemberCheckUtil.checkMembersInDestinationType(abstractMembersToPushDown, t)); } return result; }

Target:
private RefactoringStatus checkAbstractMembersInDestinationClasses(IMember[] membersToPushDown, IType[] destinationClassesForAbstract) throws JavaModelException { RefactoringStatus result= new RefactoringStatus(); IMember[] abstractMembersToPushDown= getAbstractMembers(membersToPushDown); for (IType type : destinationClassesForAbstract) { result.merge(MemberCheckUtil.checkMembersInDestinationType(abstractMembersToPushDown, type)); } return result; }
Source:
public void addResourceSelfServiceGroup(PerunSession sess, Resource resource, Group group) throws InternalErrorException, PrivilegeException, AlreadyAdminException { Utils.checkPerunSession(sess); Vo vo; Facility facility; try { facility = sess.getPerun().getFacilitiesManager().getFacilityById(sess, resource.getFacilityId()); } catch (FacilityNotExistsException e) { throw new InternalErrorException("Failed to find facility for given resource."); } try { vo = sess.getPerun().getVosManager().getVoById(sess, resource.getVoId()); } catch (VoNotExistsException e) { throw new InternalErrorException("Failed to find vo for given resource."); } if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, vo) && !AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, facility)) { throw new PrivilegeException(sess, "addResourceSelfServiceUser"); } getResourcesManagerBl().addResourceSelfServiceGroup(sess, resource, group); }

Target:
public void addResourceSelfServiceGroup(PerunSession sess, Resource resource, Group group) throws InternalErrorException, PrivilegeException, AlreadyAdminException { Utils.checkPerunSession(sess); Vo vo; Facility facility; try { facility = sess.getPerun().getFacilitiesManager().getFacilityById(sess, resource.getFacilityId()); } catch (FacilityNotExistsException e) { throw new InternalErrorException("Failed to find facility for given resource."); } try { vo = sess.getPerun().getVosManager().getVoById(sess, resource.getVoId()); } catch (VoNotExistsException e) { throw new InternalErrorException("Failed to find vo for given resource."); } if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, vo) && !AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, facility)) { throw new PrivilegeException(sess, "addResourceSelfServiceGroup"); } getResourcesManagerBl().addResourceSelfServiceGroup(sess, resource, group); }
Source:
static boolean needsCompaction(@Nullable Long targetCompactionSizeBytes, List<DataSegment> candidates) { if (targetCompactionSizeBytes == null) { return true; } final double minAllowedSize = targetCompactionSizeBytes * (1 - ALLOWED_ERROR_OF_SEGMENT_SIZE); final double maxAllowedSize = targetCompactionSizeBytes * (1 + ALLOWED_ERROR_OF_SEGMENT_SIZE); return candidates .stream() .filter(segment -> segment.getSize() < minAllowedSize || segment.getSize() > maxAllowedSize) .count() > 1; }

Target:
static boolean needsCompaction(@Nullable Long targetCompactionSizeBytes, List<DataSegment> candidates) { if (targetCompactionSizeBytes == null) { return true; } final double minTargetThreshold = targetCompactionSizeBytes * (1 - ALLOWED_ERROR_OF_SEGMENT_SIZE); final double maxTargetThreshold = targetCompactionSizeBytes * (1 + ALLOWED_ERROR_OF_SEGMENT_SIZE); return candidates .stream() .filter(segment -> segment.getSize() < minTargetThreshold || segment.getSize() > maxTargetThreshold) .count() > 1; }
Source:
private static <T extends VmBase> void addImportedInterfaces(T entity, List<VmDevice> vmDeviceToUpdate) { final Guid id = entity.getId(); for (VmNetworkInterface iface : entity.getInterfaces()) { Guid deviceId = iface.getId(); VmDevice vmDevice = addManagedDevice(new VmDeviceId(deviceId, id), VmDeviceType.INTERFACE, VmDeviceType.BRIDGE, null, true, false, getAddress(entity, id)); updateVmDevice(entity, vmDevice, deviceId, vmDeviceToUpdate, iface); } }

Target:
private static <T extends VmBase> void addImportedInterfaces(T entity, List<VmDevice> vmDeviceToUpdate) { final Guid id = entity.getId(); for (VmNetworkInterface iface : entity.getInterfaces()) { Guid deviceId = iface.getId(); VmDevice vmDevice = addManagedDevice(new VmDeviceId(deviceId, id), VmDeviceType.INTERFACE, VmDeviceType.BRIDGE, null, true, false, getAddress(entity, id)); VmDevice exportedDevice = entity.getManagedDeviceMap().get(deviceId); if (exportedDevice == null) { entity.getManagedDeviceMap().put(deviceId, vmDevice); exportedDevice = vmDevice; } exportedDevice.setIsPlugged(exportedDevice.getIsPlugged() && canPlugInterface(iface)); updateVmDevice(entity, vmDevice, deviceId, vmDeviceToUpdate); } }
Source:
public ComponentWsRequest setComponentKey(@Nullable String componentKey) { return setComponent(componentKey); }

Target:
public ComponentWsRequest setComponentKey(@Nullable String componentKey) { this.componentKey = componentKey; return this; }
Source:
public boolean equals(Node graph, Node pattern) { if(graph!=null&& pattern!=null){ if (! (graph instanceof Relation) && ! (pattern instanceof Relation)) { if(pattern.getConcept() == null && pattern.getType() == null) { graph.setId(pattern.getId()); return true; } if (graph.getConcept()!=null && pattern.getConcept() != null) { boolean isFound = false; if (!graph.getConcept().equals(pattern.getConcept())) { if(graph.getAlternativeIds() != null) { for(String alternateId : graph.getAlternativeIds()) { if(alternateId.equals(pattern.getConcept())) { isFound = true; break; } } } if(!isFound) { return false; } } graph.setId(pattern.getId()); return true; } else if (graph.getType()!=null && pattern.getType() != null) { if (!graph.getType().equals(pattern.getType())) return false; graph.setId(pattern.getId()); return true; } } if (graph instanceof Relation && pattern instanceof Relation) { if (!equals(((Relation)graph).getSubject(), ((Relation)pattern).getSubject())) return false; if (!equals(((Relation)graph).getPredicate(), ((Relation)pattern).getPredicate())) return false; if (!equals(((Relation)graph).getObject(), ((Relation)pattern).getObject())) return false; graph.setId(null); return true; } } return false; }

Target:
public boolean equals(Node graph, Node pattern) { if(graph!=null&& pattern!=null){ if (! (graph instanceof Relation) && ! (pattern instanceof Relation)) { if(pattern.getConcept() == null && pattern.getType() == null) { graph.setId(pattern.getId()); return true; } if (pattern.getConcept() != null && graph.getAlternativeIds() != null) { if (graph.getAlternativeIds().contains(pattern.getConcept())) { graph.setId(pattern.getId()); return true; } return false; } else if (graph.getType()!=null && pattern.getType() != null) { if (!graph.getType().equals(pattern.getType())) return false; graph.setId(pattern.getId()); return true; } } if (graph instanceof Relation && pattern instanceof Relation) { if (!equals(((Relation)graph).getSubject(), ((Relation)pattern).getSubject())) return false; if (!equals(((Relation)graph).getPredicate(), ((Relation)pattern).getPredicate())) return false; if (!equals(((Relation)graph).getObject(), ((Relation)pattern).getObject())) return false; graph.setId(null); return true; } } return false; }