auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void configure(Binder binder) { Multibinder<SingularityAuthenticator> multibinder = Multibinder.newSetBinder(binder, SingularityAuthenticator.class); for (SingularityAuthenticatorClass clazz : getConfiguration().getAuthConfiguration().getAuthenticators()) { multibinder.addBinding().to(clazz.getAuthenticatorClass()); } binder.bind(SingularityAuthFeature.class); binder.bind(SingularityMultiMethodAuthenticator.class); binder.bind(SingularityAuthDatastore.class).to(getConfiguration().getAuthConfiguration().getDatastore().getAuthDatastoreClass()); binder.bind(SingularityAuthorizationHelper.class).in(Scopes.SINGLETON); getEnvironment().jersey().register(SingularityAuthFeature.class); }

Target:
public void configure(Binder binder) { Multibinder<SingularityAuthenticator> multibinder = Multibinder.newSetBinder(binder, SingularityAuthenticator.class); for (SingularityAuthenticatorClass clazz : getConfiguration().getAuthConfiguration().getAuthenticators()) { multibinder.addBinding().to(clazz.getAuthenticatorClass()); } binder.bind(SingularityAuthFeature.class); binder.bind(SingularityMultiMethodAuthenticator.class); binder.bind(SingularityAuthDatastore.class).to(getConfiguration().getAuthConfiguration().getDatastore().getAuthDatastoreClass()); binder.bind(SingularityAuthorizationHelper.class).in(Scopes.SINGLETON); }
Source:
public void onResult(boolean success, @Nullable String errorMessage) { if (success) { if (resetPasswordAlert!=null) { resetPasswordAlert.dismiss(); } showErrorDialog(getString(R.string.success_dialog_title_help), getString(R.string.success_dialog_message_help)); } else if (resetPasswordAlert!=null) { if (errorMessage!=null) { resetPasswordAlert.showError(errorMessage); } else { resetPasswordAlert.dismiss(); } } }

Target:
public void onResult(boolean success, @Nullable String errorMessage) { if (success) { if (resetPasswordAlert != null) { resetPasswordAlert.dismiss(); } showAlertDialog(getString(R.string.success_dialog_title_help), getString(R.string.success_dialog_message_help)); } else if (resetPasswordAlert != null) { if (errorMessage != null) { resetPasswordAlert.showError(errorMessage); } else { resetPasswordAlert.dismiss(); } } }
Source:
private static boolean isBinaryFile(String fullPath) { byte[] firstBytes = new byte[8]; try (FileInputStream input = new FileInputStream(fullPath)) { input.read(firstBytes); } catch (IOException e) { Activator.getDefault().logError("Cannot read the file "+fullPath+" due to ", e); } for (byte[] header : BINARY_HEADERS) { if (firstBytes.length >= header.length && startsWith(header, firstBytes)) { return true; } } return false; }

Target:
private static boolean isBinaryFile(String fullPath) { byte[] firstBytes = new byte[8]; try (FileInputStream input = new FileInputStream(fullPath)) { input.read(firstBytes); } catch (IOException e) { Activator.getDefault().logError("Cannot read the file "+fullPath+" ", e); } for (byte[] header : BINARY_HEADERS) { if (firstBytes.length >= header.length && startsWith(header, firstBytes)) { return true; } } return false; }
Source:
public void generateAll() { for (int i = 0; i < this.activeStages; i++) { QueueProcessor<Long> processor = this.stages.get(i).getProcessor().processor; CubicChunks.LOGGER.info("Stage: {}", processor.getName()); int numProcessed = 0; int round = 0; do { CubicChunks.LOGGER.info("\tround - cubes", ++round, processor.getNumInQueue()); Progress progress = new Progress(processor.getNumInQueue(), 1000); numProcessed = processor.processQueue(progress); advanceCubes(processor, i); CubicChunks.LOGGER.info("\t\tprocessed {}", numProcessed); } while (numProcessed > 0 && processor.getNumInQueue() > 0); } }

Target:
public void generateAll() { for (GeneratorStage stage : this.stages) { QueueProcessor<Long> processor = stage.getProcessor().processor; CubicChunks.LOGGER.info("Stage: {}", processor.getName()); int numProcessed = 0; int round = 0; do { CubicChunks.LOGGER.info("\tround - cubes", ++round, processor.getNumInQueue()); Progress progress = new Progress(processor.getNumInQueue(), 1000); numProcessed = processor.processQueue(progress); advanceCubes(processor, stage); CubicChunks.LOGGER.info("\t\tprocessed {}", numProcessed); } while (numProcessed > 0 && processor.getNumInQueue() > 0); } }
Source:
public ArrayList<String> getTopics() { return topics; }

Target:
public List<String> getTopics() { return topics; }
Source:
public void open() throws IOException { writer = CompressionFactory.getDoubleSerializer( ioPeon, String.format("%s.double_column", filenameBase), byteOrder, compression ); writer.open(); }

Target:
public void open() throws IOException { writer = CompressionFactory.getDoubleSerializer( ioPeon, StringUtils.format("%s.double_column", filenameBase), byteOrder, compression ); writer.open(); }
Source:
private void renderMetrics(List<MetricDto> loaded) { MetricRankingProvider.sortMetrics(loaded); summaryPanel.getSessionComparisonPanel().addMetricRecords(loaded); renderMetricPlots(loaded); ((ScrollPanel)summaryPanel.getParent()).scrollToBottom(); }

Target:
private void renderMetrics(List<MetricDto> loaded) { MetricRankingProvider.sortMetrics(loaded); summaryPanel.getSessionComparisonPanel().addMetricRecords(loaded); renderMetricPlots(loaded); summaryPanelScrollPanel.scrollToBottom(); }
Source:
public Set<T> getRunningJobs() { jobsAccessLock.lock(); Set<T> runningJobs = new HashSet<>(this.runningJobs); jobsAccessLock.unlock(); return runningJobs; }

Target:
public Set<T> getRunningJobs() { Set<T> runningJobs; try { jobsAccessLock.lock(); runningJobs = Collections.unmodifiableSet(this.runningJobs); } finally { jobsAccessLock.unlock(); } return runningJobs; }
Source:
public void setup(Context.OperatorContext context) { arrivedTopicMessagesToProcess = new ArrayBlockingQueue<BytesXMLMessage>(Integer.parseInt(this.unackedMessageLimit)); this.context = context; super.setConnectRetries(this.connectRetries); super.setReconnectRetries(this.reconnectRetries); super.setReapplySubscriptions(true); super.setup(context); topic = factory.createTopic(topicName); addSubscription(topic); }

Target:
public void setup(Context.OperatorContext context) { arrivedTopicMessagesToProcess = new ArrayBlockingQueue<BytesXMLMessage>(this.unackedMessageLimit); super.setReapplySubscriptions(true); super.setup(context); }
Source:
public void shutDown() { IngestEventsListener.disableCentralRepositoryModule(); if (EamDb.isEnabled() == false) { return; } EamDb dbManager; try { dbManager = EamDb.getInstance(); } catch (EamDbException ex) { LOGGER.log(Level.SEVERE, "Error connecting to Central Repository database.", ex); return; } try { dbManager.bulkInsertArtifacts(); } catch (EamDbException ex) { LOGGER.log(Level.SEVERE, "Error doing bulk insert of artifacts.", ex); } try { Long count = dbManager.getCountArtifactInstancesByCaseDataSource(eamCase.getCaseUUID(), eamDataSource.getDeviceID()); LOGGER.log(Level.INFO, "{0} artifacts in db for case: {1} ds:{2}", new Object[]{count, eamCase.getDisplayName(), eamDataSource.getName()}); } catch (EamDbException ex) { LOGGER.log(Level.SEVERE, "Error counting artifacts.", ex); } refCounter.decrementAndGet(jobId); }

Target:
public void shutDown() { IngestEventsListener.decrementCorrelationEngineModuleCount(); if ((EamDb.isEnabled() == false) || (eamCase == null) || (eamDataSource == null)) { return; } EamDb dbManager; try { dbManager = EamDb.getInstance(); } catch (EamDbException ex) { LOGGER.log(Level.SEVERE, "Error connecting to Central Repository database.", ex); return; } try { dbManager.bulkInsertArtifacts(); } catch (EamDbException ex) { LOGGER.log(Level.SEVERE, "Error doing bulk insert of artifacts.", ex); } try { Long count = dbManager.getCountArtifactInstancesByCaseDataSource(eamCase.getCaseUUID(), eamDataSource.getDeviceID()); LOGGER.log(Level.INFO, "{0} artifacts in db for case: {1} ds:{2}", new Object[]{count, eamCase.getDisplayName(), eamDataSource.getName()}); } catch (EamDbException ex) { LOGGER.log(Level.SEVERE, "Error counting artifacts.", ex); } refCounter.decrementAndGet(jobId); }
Source:
public void visitNewExpression(NewExpressionTree tree) { ExpressionTree expression = tree.expression(); if (expression.is(Tree.Kind.IDENTIFIER_REFERENCE)) { SyntaxToken token = ((IdentifierTree)expression).identifierToken(); if ("Function".equals(token.text()) && tree.arguments() != null && ! tree.arguments().parameters().isEmpty()) { addIssue(new PreciseIssue(this, new IssueLocation(tree.newKeyword(), tree.expression(), MESSAGE))); } } super.visitNewExpression(tree); }

Target:
public void visitNewExpression(NewExpressionTree tree) { if (isNonEmptyFunctionConstructor(tree.expression(), tree.arguments())) { addIssue(new PreciseIssue(this, new IssueLocation(tree.newKeyword(), tree.expression(), MESSAGE))); } super.visitNewExpression(tree); }
Source:
public void autonomousMain() throws AutonomousModeOverException, InterruptedException { try { Elevator.setTop.event(); waitUntil(Elevator.atTop); boolean r = Rollers.running.get(); boolean d = Rollers.direction.get(); boolean o = Rollers.open.get(); Rollers.direction.set(true); Rollers.running.set(true); Rollers.open.set(false); waitUntil(crateInPosition); wait(500); Rollers.running.set(r); Rollers.direction.set(d); Rollers.open.set(o); Elevator.setBottom.event(); } finally { running.set(false); } }

Target:
public void autonomousMain() throws AutonomousModeOverException, InterruptedException { try { Elevator.setTop.event(); waitUntil(Elevator.atTop); boolean r = Rollers.running.get(); boolean d = Rollers.direction.get(); boolean o = Rollers.open.get(); Rollers.direction.set(true); Rollers.running.set(true); Rollers.open.set(false); waitUntil(crateInPosition); waitForTime(timeout); Rollers.running.set(r); Rollers.direction.set(d); Rollers.open.set(o); Elevator.setBottom.event(); } finally { running.set(false); } }
Source:
public void init() { super.init(); setAttribute(AMBARI_AGENTS, addChild(EntitySpec.create(DynamicCluster.class) .configure(DynamicCluster.INITIAL_SIZE, getRequiredConfig(INITIAL_SIZE)) .configure(DynamicCluster.MEMBER_SPEC, AmbariAgentImpl.createAgentSpec(getParent())) .displayName("All Nodes") )); }

Target:
public void init() { super.init(); config().set(MEMBER_SPEC, AmbariAgentImpl.createAgentSpec(getParent())); }
Source:
public void handleExceptionsReturnsResponseWhenSuccessful() { ResponseEntity<?> response = resource.handleExceptions(() -> Mono.just(ok("ok"))).block(); assertThat(response.getStatusCode(), is(OK)); assertThat(response.getBody(), is("ok")); }

Target:
public void handleExceptionsReturnsResponseWhenSuccessful() { ResponseEntity<?> response = resource.handleExceptions(() -> just(ok("ok"))).block(); assertThat(response.getStatusCode(), is(OK)); assertThat(response.getBody(), is("ok")); }
Source:
LRESULT WM_MENUSELECT (long wParam, long lParam) { int code = OS.HIWORD (wParam); Shell shell = getShell (); OS.KillTimer (this.handle, Menu.ID_TOOLTIP_TIMER); if (menu != null) menu.hideCurrentToolTip (); if (code == 0xFFFF && lParam == 0) { Menu menu = shell.activeMenu; while (menu != null) { display.mnemonicKeyHit = true; menu.sendEvent (SWT.Hide); if (menu.isDisposed ()) break; menu = menu.getParentMenu (); } shell.activeMenu = null; return null; } if ((code & OS.MF_SYSMENU) != 0) return null; if ((code & OS.MF_HILITE) != 0) { MenuItem item = null; Decorations menuShell = menuShell (); if ((code & OS.MF_POPUP) != 0) { int index = OS.LOWORD (wParam); MENUITEMINFO info = new MENUITEMINFO (); info.cbSize = MENUITEMINFO.sizeof; info.fMask = OS.MIIM_SUBMENU; if (OS.GetMenuItemInfo (lParam, index, true, info)) { Menu newMenu = menuShell.findMenu (info.hSubMenu); if (newMenu != null) item = newMenu.cascade; } } else { Menu newMenu = menuShell.findMenu (lParam); if (newMenu != null) { int id = OS.LOWORD (wParam); item = display.getMenuItem (id); } if (item != null) { menu.selectedMenuItem = item; OS.SetTimer (this.handle, Menu.ID_TOOLTIP_TIMER, OS.TTM_GETDELAYTIME, 0); } } if (item != null) item.sendEvent (SWT.Arm); } return null; }

Target:
LRESULT WM_MENUSELECT (long wParam, long lParam) { int code = OS.HIWORD (wParam); Shell shell = getShell (); OS.KillTimer (this.handle, Menu.ID_TOOLTIP_TIMER); if (activeMenu != null) activeMenu.hideCurrentToolTip (); if (code == 0xFFFF && lParam == 0) { Menu menu = shell.activeMenu; while (menu != null) { display.mnemonicKeyHit = true; menu.sendEvent (SWT.Hide); if (menu.isDisposed ()) break; menu = menu.getParentMenu (); } shell.activeMenu = null; return null; } if ((code & OS.MF_SYSMENU) != 0) return null; if ((code & OS.MF_HILITE) != 0) { MenuItem item = null; Decorations menuShell = menuShell (); if ((code & OS.MF_POPUP) != 0) { int index = OS.LOWORD (wParam); MENUITEMINFO info = new MENUITEMINFO (); info.cbSize = MENUITEMINFO.sizeof; info.fMask = OS.MIIM_SUBMENU; if (OS.GetMenuItemInfo (lParam, index, true, info)) { Menu newMenu = menuShell.findMenu (info.hSubMenu); if (newMenu != null) item = newMenu.cascade; } } else { Menu newMenu = menuShell.findMenu (lParam); if (newMenu != null) { int id = OS.LOWORD (wParam); item = display.getMenuItem (id); } activeMenu = (menu != null) ? menu : newMenu; if (item != null && activeMenu != null) { activeMenu.selectedMenuItem = item; OS.SetTimer (this.handle, Menu.ID_TOOLTIP_TIMER, OS.TTM_GETDELAYTIME, 0); } } if (item != null) item.sendEvent (SWT.Arm); } return null; }
Source:
public void testBlockUseHostCpuWithPPCArch() { final int osId = 0; prepareVmToPassValidate(); command.initEffectiveCompatibilityVersion(); vm.setClusterArch(ArchitectureType.ppc64le); group.setArchitecture(ArchitectureType.ppc); when(osRepository.getArchitectureFromOS(osId)).thenReturn(ArchitectureType.ppc); vmStatic.setUseHostCpuFlags(true); vmStatic.setMigrationSupport(MigrationSupport.PINNED_TO_HOST); boolean validInput = command.validate(); assertFalse("validate should fail with can't use host CPU.", validInput); assertValidateMessage(EngineMessage.USE_HOST_CPU_REQUESTED_ON_UNSUPPORTED_ARCH); }

Target:
public void testBlockUseHostCpuWithPPCArch() { prepareVmToPassValidate(); command.initEffectiveCompatibilityVersion(); vm.setClusterArch(ArchitectureType.ppc64le); group.setArchitecture(ArchitectureType.ppc); when(osRepository.getArchitectureFromOS(OsType.Windows.ordinal())).thenReturn(ArchitectureType.ppc); vmStatic.setUseHostCpuFlags(true); vmStatic.setMigrationSupport(MigrationSupport.PINNED_TO_HOST); boolean validInput = command.validate(); assertFalse("validate should fail with can't use host CPU.", validInput); assertValidateMessage(EngineMessage.USE_HOST_CPU_REQUESTED_ON_UNSUPPORTED_ARCH); }
Source:
public BlobProperties getBlobProperties(String blobIdString) throws CoordinatorException { long startTimeInMs = System.currentTimeMillis(); try { logger.trace("getBlobProperties. " + blobIdString); coordinatorMetrics.getBlobPropertiesOperationRate.mark(); BlobId blobId = getBlobIdFromString(blobIdString); GetBlobPropertiesOperation gbpo = new GetBlobPropertiesOperation(datacenterName, connectionPool, requesterPool, getOperationContext(), blobId, operationTimeoutMs, clusterMap, sslEnabledColos); gbpo.execute(); return gbpo.getBlobProperties(); } catch (CoordinatorException e) { logger.trace("getBlobProperties re-throwing CoordinatorException", e); coordinatorMetrics.countError(CoordinatorMetrics.CoordinatorOperationType.GetBlobProperties, e.getErrorCode()); throw e; } finally { coordinatorMetrics.getBlobPropertiesOperationLatencyInMs.update(System.currentTimeMillis() - startTimeInMs); } }

Target:
public BlobProperties getBlobProperties(String blobIdString) throws CoordinatorException { long startTimeInMs = System.currentTimeMillis(); try { logger.trace("getBlobProperties. " + blobIdString); coordinatorMetrics.getBlobPropertiesOperationRate.mark(); BlobId blobId = getBlobIdFromString(blobIdString); GetBlobPropertiesOperation gbpo = new GetBlobPropertiesOperation(datacenterName, connectionPool, requesterPool, getOperationContext(), blobId, operationTimeoutMs, clusterMap); gbpo.execute(); return gbpo.getBlobProperties(); } catch (CoordinatorException e) { logger.trace("getBlobProperties re-throwing CoordinatorException", e); coordinatorMetrics.countError(CoordinatorMetrics.CoordinatorOperationType.GetBlobProperties, e.getErrorCode()); throw e; } finally { coordinatorMetrics.getBlobPropertiesOperationLatencyInMs.update(System.currentTimeMillis() - startTimeInMs); } }
Source:
public List<String> deprecationWarnings() { if (supportsMultiPathCoverage()) { if (multiPathCoverageUsed()) { return usedLegacyCoveragePaths().map(pathKey -> String.format(SKIPPED_WARNING_TEMPLATE, pathKey)).collect(Collectors.toList()); } else { return usedLegacyCoveragePaths().map(pathKey -> String.format(DEPRECATION_WARNING_TEMPLATE, pathKey)).collect(Collectors.toList()); } } return new ArrayList<>(); }

Target:
public List<String> deprecationWarnings() { if (supportsMultiPathCoverage()) { if (multiPathCoverageUsed()) { return printWarningForUsedLegacyPaths(SKIPPED_WARNING_TEMPLATE); } else { return printWarningForUsedLegacyPaths(DEPRECATION_WARNING_TEMPLATE); } } else if (multiPathCoverageUsed()) { return Collections.singletonList(NOT_YET_SUPPORTED_WARNING); } return new ArrayList<>(); }
Source:
public void createConnectionsUponTopologyChange() { m_distributer.getExecutorService().execute(new Runnable() { @Override public void run() { try{ ClientResponse resp = callProcedure("@SystemInformation", "OVERVIEW"); if (resp.getStatus() == ClientResponse.SUCCESS) { Map<Integer, HostConfig> hosts = buildUnconnectedHostConfigMap(resp.getResults()[0]); for(Map.Entry<Integer, HostConfig> entry : hosts.entrySet()) { HostConfig config = entry.getValue(); try { connectToOneServerWithRetry(config.m_ipAddress,config.getPort(m_useAdminPort)); nofifyClientConnectionCreation(config, ClientResponse.SUCCESS, null); } catch (IOException e) { nofifyClientConnectionCreation(config, ClientResponse.SERVER_UNAVAILABLE, e); } } m_distributer.updateClientAffinityPartitionsUponTopoChange(); } else { nofifyClientConnectionCreation(null, resp.getStatus(), null); } } catch (Exception e) { nofifyClientConnectionCreation(null, ClientResponse.SERVER_UNAVAILABLE, e); } } }); }

Target:
public void createConnectionsUponTopologyChange() { m_ex.execute(new CreateConnectionTask(this, connectionTaskCount)); }
Source:
public TimestampService createTimestampService(KeyValueService rawKvs, boolean initializeAsync) { AtlasDbVersion.ensureVersionReported(); return PersistentTimestampServiceImpl.create(JdbcTimestampBoundStore.create((JdbcKeyValueService) rawKvs)); }

Target:
public TimestampService createTimestampService(KeyValueService rawKvs, boolean initializeAsync) { if (initializeAsync) { log.warn("Asynchronous initialization not implemented, will initialize synchronousy."); } AtlasDbVersion.ensureVersionReported(); return PersistentTimestampServiceImpl.create(JdbcTimestampBoundStore.create((JdbcKeyValueService) rawKvs)); }
Source:
private void removeNodes(final Collection<RMNodeData> nodes) { if (nodeRecoveryDisabled()) { return; } if (rmdbManagerBuffer.canOperateDatabaseSynchronouslyWithNodes(nodes)) { logger.info("Remove nodes " + Arrays.toString(nodes.toArray()) + " in database"); try { executeReadWriteTransaction(new SessionWork<Void>() { @Override public Void doInTransaction(Session session) { for (RMNodeData rmNodeData : nodes) { session.delete(rmNodeData); } return null; } }); } catch (RuntimeException e) { throw new RuntimeException("Exception occurred while removing nodes", e); } } else { logger.info("Request " + RMDBManagerBuffer.class.getSimpleName() + " to remove nodes " + Arrays.toString(nodes.toArray()) + " in database"); rmdbManagerBuffer.addRemoveNodesToPendingDatabaseOperations(nodes); } }

Target:
private void removeNodes(final Collection<RMNodeData> nodes) { if (nodeRecoveryDisabled()) { return; } if (rmdbManagerBuffer.canOperateDatabaseSynchronouslyWithNodes(nodes)) { try { logger.info("Remove " + nodes.size() + " nodes" + IN_DATABASE_STRING); if (logger.isDebugEnabled()) { logger.debug("Nodes removed: " + Arrays.toString(nodes.toArray())); } executeReadWriteTransaction(new SessionWork<Void>() { @Override public Void doInTransaction(Session session) { for (RMNodeData rmNodeData : nodes) { session.delete(rmNodeData); } return null; } }); } catch (RuntimeException e) { throw new RuntimeException("Exception occurred while removing nodes", e); } } else { logger.debug(REQUEST_BUFFER_STRING + "remove " + nodes.size() + " nodes" + IN_DATABASE_STRING); rmdbManagerBuffer.addRemoveNodesToPendingDatabaseOperations(nodes); } }
Source:
protected void postProcessReplyProducer(AbstractMessageProducingHandler handler) { if (this.sendTimeout != null) { handler.setSendTimeout(sendTimeout); } if (this.requiresReply != null) { if(handler instanceof AbstractReplyProducingMessageHandler) { ((AbstractReplyProducingMessageHandler) handler).setRequiresReply(this.requiresReply); } } if (!(handler instanceof AbstractMessageSplitter)) { Assert.isNull(this.applySequence, "Cannot set applySequence if the referenced bean is " + "an AbstractReplyProducingMessageHandler, but not an AbstractMessageSplitter"); Assert.isNull(this.delimiters, "Cannot set delimiters if the referenced bean is not an " + "an AbstractReplyProducingMessageHandler, but not an AbstractMessageSplitter"); } else { AbstractMessageSplitter splitter = (AbstractMessageSplitter) handler; if (this.delimiters != null) { Assert.isTrue(splitter instanceof DefaultMessageSplitter, "The 'delimiters' property is only available" + " for a Splitter definition where no 'ref', 'expression', or inner bean has been provided."); ((DefaultMessageSplitter) splitter).setDelimiters(this.delimiters); } if (this.applySequence != null) { splitter.setApplySequence(applySequence); } } }

Target:
protected void postProcessReplyProducer(AbstractMessageProducingHandler handler) { if (this.sendTimeout != null) { handler.setSendTimeout(sendTimeout); } if (this.requiresReply != null) { if(handler instanceof AbstractReplyProducingMessageHandler) { ((AbstractReplyProducingMessageHandler) handler).setRequiresReply(this.requiresReply); } else if (true == this.requiresReply && logger.isDebugEnabled()) { logger.debug("requires-reply can only be set to AbstractReplyProducingMessageHandler or its subclass, " + handler.getComponentName() + " doesn't support it."); } } if (!(handler instanceof AbstractMessageSplitter)) { Assert.isNull(this.applySequence, "Cannot set applySequence if the referenced bean is " + "an AbstractReplyProducingMessageHandler, but not an AbstractMessageSplitter"); Assert.isNull(this.delimiters, "Cannot set delimiters if the referenced bean is not an " + "an AbstractReplyProducingMessageHandler, but not an AbstractMessageSplitter"); } else { AbstractMessageSplitter splitter = (AbstractMessageSplitter) handler; if (this.delimiters != null) { Assert.isTrue(splitter instanceof DefaultMessageSplitter, "The 'delimiters' property is only available" + " for a Splitter definition where no 'ref', 'expression', or inner bean has been provided."); ((DefaultMessageSplitter) splitter).setDelimiters(this.delimiters); } if (this.applySequence != null) { splitter.setApplySequence(applySequence); } } }
Source:
private Configuration getConfigurationWithContext(String pidWithContext) { String pid = null; String configContext = null; if (pidWithContext.contains(ConfigDispatcher.SERVICE_CONTEXT_MARKER)) { pid = pidWithContext.split(ConfigDispatcher.SERVICE_CONTEXT_MARKER)[0]; configContext = pidWithContext.split(ConfigDispatcher.SERVICE_CONTEXT_MARKER)[1]; } else { fail("PID does not have a context"); } Configuration[] configs = null; try { configs = configAdmin.listConfigurations("(&(service.factoryPid=" + pid + ")(" + ConfigDispatcher.SERVICE_CONTEXT + "=" + configContext + "))"); } catch (IOException e) { fail("IOException occured while retrieving configuration for pid " + pidWithContext); } catch (InvalidSyntaxException e) { fail("InvalidSyntaxException occured while retrieving configuration for pid " + pidWithContext); } if (configs == null) { return null; } assertThat(configs.length, is(1)); return configs[0]; }

Target:
private Configuration getConfigurationWithContext(String pidWithContext) { String pid = null; String configContext = null; if (pidWithContext.contains(ConfigDispatcher.SERVICE_CONTEXT_MARKER)) { pid = pidWithContext.split(ConfigDispatcher.SERVICE_CONTEXT_MARKER)[0]; configContext = pidWithContext.split(ConfigDispatcher.SERVICE_CONTEXT_MARKER)[1]; } else { throw new IllegalArgumentException("PID does not have a context"); } Configuration[] configs = null; try { configs = configAdmin.listConfigurations("(&(service.factoryPid=" + pid + ")(" + ConfigDispatcher.SERVICE_CONTEXT + "=" + configContext + "))"); } catch (IOException e) { throw new IllegalArgumentException( "IOException occured while retrieving configuration for pid " + pidWithContext, e); } catch (InvalidSyntaxException e) { throw new IllegalArgumentException( "InvalidSyntaxException occured while retrieving configuration for pid " + pidWithContext, e); } if (configs == null) { return null; } assertThat(configs.length, is(1)); return configs[0]; }
Source:
private List<SqlNode> permutedOperands(final SqlCall call) { final SqlOperandMetadata operandMetadata = (SqlOperandMetadata) call.getOperator().getOperandTypeChecker(); final List<String> paramNames = operandMetadata.paramNames(); final List<SqlNode> permuted = new ArrayList<>(); final SqlNameMatcher nameMatcher = validator.getCatalogReader().nameMatcher(); for (final String paramName : paramNames) { Pair<String, SqlIdentifier> args = null; for (int j = 0; j < call.getOperandList().size(); j++) { final SqlCall call2 = call.operand(j); assert call2.getKind() == SqlKind.ARGUMENT_ASSIGNMENT; final SqlIdentifier operandID = call2.operand(1); final String operandName = operandID.getSimple(); if (nameMatcher.matches(operandName, paramName)) { permuted.add(call2.operand(0)); break; } else if (args == null && nameMatcher.isCaseSensitive() && operandName.equalsIgnoreCase(paramName)) { args = Pair.of(paramName, operandID); } if (j == call.getOperandList().size() - 1) { if (args != null) { throw SqlUtil.newContextException(args.right.getParserPosition(), RESOURCE.paramNotFoundInFunctionDidYouMean(args.right.getSimple(), call.getOperator().getName(), args.left)); } if (operandMetadata.isFixedParameters()) { permuted.add(createDefaultCall()); } } } } return permuted; }

Target:
private List<SqlNode> permutedOperands(final SqlCall call) { final SqlOperandMetadata operandMetadata = (SqlOperandMetadata) call.getOperator().getOperandTypeChecker(); final List<String> paramNames = operandMetadata.paramNames(); final List<SqlNode> permuted = new ArrayList<>(); final SqlNameMatcher nameMatcher = validator.getCatalogReader().nameMatcher(); for (final String paramName : paramNames) { Pair<String, SqlIdentifier> args = null; for (int j = 0; j < call.getOperandList().size(); j++) { final SqlCall call2 = call.operand(j); assert call2.getKind() == SqlKind.ARGUMENT_ASSIGNMENT; final SqlIdentifier operandID = call2.operand(1); final String operandName = operandID.getSimple(); if (nameMatcher.matches(operandName, paramName)) { permuted.add(call2.operand(0)); break; } else if (args == null && nameMatcher.isCaseSensitive() && operandName.equalsIgnoreCase(paramName)) { args = Pair.of(paramName, operandID); } if (j == call.getOperandList().size() - 1) { if (args != null) { throw SqlUtil.newContextException(args.right.getParserPosition(), RESOURCE.paramNotFoundInFunctionDidYouMean(args.right.getSimple(), call.getOperator().getName(), args.left)); } if (operandMetadata.isFixedParameters()) { permuted.add(DefaultCallHolder.DEFAULT_CALL); } } } } return permuted; }
Source:
public void run() { final PayaraNotification notification = notificationQueue.peek(); try { if (notification != null && isEnabled()) { notifier.handleNotification(notification); notificationQueue.remove(); } } catch (Exception ex) { LOGGER.log(Level.WARNING, format("Notifier %s failed to handle notification \"%s\".", notifierName, notification), ex); } }

Target:
private void run() { assert isEnabled(); try { final PayaraNotification notification = notificationQueue.take(); try { if (notification != null) { notifier.handleNotification(notification); } } catch (final Exception ex) { LOGGER.log(Level.WARNING, format("Notifier %s failed to handle notification \"%s\".", notifierName, notification), ex); } } catch (InterruptedException ex) { LOGGER.log(Level.FINE, format("Cancelled waiting on queue for notifier \"%s\".", notifierName), ex); } }
Source:
public void init(FilterConfig filterConfig) throws ServletException { M_log.debug("Filter Init(): Called"); appExtPropertiesFile = Utils.loadProperties(CCM_PROPERTY_FILE_PATH); appExtSecurePropertiesFile = Utils.loadProperties(CCM_SECURE_PROPERTY_FILE_PATH); getExternalAppProperties(); }

Target:
public void init(FilterConfig filterConfig) throws ServletException { M_log.debug("Filter Init(): Called"); appExtProperties = Utils.loadProperties(CCM_PROPERTY_FILE_PATH); appExtSecureProperties = Utils.loadProperties(CCM_SECURE_PROPERTY_FILE_PATH); getExternalAppProperties(); }
Source:
public Baked(ResourceLocation location, boolean perspective, @Nullable IBakedModel base, ImmutableMap<String, IBakedModel> parts) { this.location = location; this.base = base; this.parts = parts; if (base != null) internalBase = base; else { Iterator<IBakedModel> iter = parts.values().iterator(); if (iter.hasNext()) internalBase = iter.next(); else throw new IllegalArgumentException("No base model or submodel provided for MultiModel.Baked " + location + "."); } if(base != null && perspective) { EnumMap<TransformType, Pair<Baked, TRSRTransformation>> map = new EnumMap<>(TransformType.class); for(TransformType type : TransformType.values()) { Pair<? extends IBakedModel, Matrix4f> p = base.handlePerspective(type); IBakedModel newBase = p.getLeft(); map.put(type, Pair.of(new Baked(location, false, newBase, parts), new TRSRTransformation(p.getRight()))); } transforms = ImmutableMap.copyOf(map); } else { transforms = ImmutableMap.of(); } }

Target:
public Baked(ResourceLocation location, boolean perspective, @Nullable IBakedModel base, ImmutableMap<String, IBakedModel> parts) { this.location = location; this.base = base; this.parts = parts; if (base != null) internalBase = base; else { Iterator<IBakedModel> iter = parts.values().iterator(); if (iter.hasNext()) internalBase = iter.next(); else throw new IllegalArgumentException("No base model or submodel provided for MultiModel.Baked " + location + "."); } if(base != null && perspective) { EnumMap<TransformType, Pair<Baked, TRSRTransformation>> map = new EnumMap<>(TransformType.class); for(TransformType type : TransformType.values()) { Pair<? extends IBakedModel, Matrix4f> p = base.handlePerspective(type); IBakedModel newBase = p.getLeft(); Matrix4f matrix = p.getRight(); if (newBase != base || matrix != null) { map.put(type, Pair.of(new Baked(location, false, newBase, parts), new TRSRTransformation(matrix))); } } transforms = ImmutableMap.copyOf(map); } else { transforms = ImmutableMap.of(); } }
Source:
protected ScriptTemplate asScriptFrom(ScriptTemplate sourceScript, ScriptTemplate patternScript) { ParamsBuilder params = paramsBuilder(); String template = formatTemplate("{eql}.endsWith(" + sourceScript.template() + "," + patternScript.template() + ",{})"); params.script(sourceScript.params()) .script(patternScript.params()) .variable(isCaseSensitive()); return new ScriptTemplate(template, params.build(), dataType()); }

Target:
protected ScriptTemplate asScriptFrom(ScriptTemplate sourceScript, ScriptTemplate patternScript) { return new ScriptTemplate(format(Locale.ROOT, formatTemplate("{eql}.%s(%s,%s,%s)"), "endsWith", sourceScript.template(), patternScript.template(), "{}"), paramsBuilder() .script(sourceScript.params()) .script(patternScript.params()) .variable(isCaseSensitive()) .build(), dataType()); }
Source:
public Mono<U> getFinalResult() { return Mono.defer(() -> { if (!this.pollResponse.getStatus().isComplete()) { return Mono.empty(); } else { try { return this.fetchResultOperation .apply(this.pollingContext); } catch (Throwable throwable) { return Mono.error(throwable); } } }); }

Target:
public Mono<U> getFinalResult() { return Mono.defer(() -> { if (!this.pollResponse.getStatus().isComplete()) { return Mono.empty(); } else { try { return this.fetchResultOperation .apply(this.pollingContext); } catch (RuntimeException re) { return FluxUtil.monoError(logger, re); } } }); }
Source:
public void processElement(RowData input, Context ctx, Collector<RowData> out) throws Exception { RowData currentKey = ctx.getCurrentKey(); boolean firstRow; RowData accumulators = accState.value(); if (null == accumulators) { if (isRetractMsg(input)) { return; } firstRow = true; accumulators = function.createAccumulators(); } else { firstRow = false; } function.setAccumulators(accumulators); RowData prevAggValue = function.getValue(); if (isAccumulateMsg(input)) { function.accumulate(input); } else { function.retract(input); } RowData newAggValue = function.getValue(); accumulators = function.getAccumulators(); if (!recordCounter.recordCountIsZero(accumulators)) { accState.update(accumulators); if (!firstRow) { if (stateRetentionTime > 0 && equaliser.equals(prevAggValue, newAggValue)) { return; } else { if (generateUpdateBefore) { resultRow.replace(currentKey, prevAggValue).setRowKind(RowKind.UPDATE_BEFORE); out.collect(resultRow); } resultRow.replace(currentKey, newAggValue).setRowKind(RowKind.UPDATE_AFTER); } } else { resultRow.replace(currentKey, newAggValue).setRowKind(RowKind.INSERT); } out.collect(resultRow); } else { if (!firstRow) { resultRow.replace(currentKey, prevAggValue).setRowKind(RowKind.DELETE); out.collect(resultRow); } accState.clear(); function.cleanup(); } }

Target:
public void processElement(RowData input, Context ctx, Collector<RowData> out) throws Exception { RowData currentKey = ctx.getCurrentKey(); boolean firstRow; RowData accumulators = accState.value(); if (null == accumulators) { if (isRetractMsg(input)) { return; } firstRow = true; accumulators = function.createAccumulators(); } else { firstRow = false; } function.setAccumulators(accumulators); RowData prevAggValue = function.getValue(); if (isAccumulateMsg(input)) { function.accumulate(input); } else { function.retract(input); } RowData newAggValue = function.getValue(); accumulators = function.getAccumulators(); if (!recordCounter.recordCountIsZero(accumulators)) { accState.update(accumulators); if (!firstRow) { if (stateRetentionTime <= 0 && equaliser.equals(prevAggValue, newAggValue)) { return; } else { if (generateUpdateBefore) { resultRow.replace(currentKey, prevAggValue).setRowKind(RowKind.UPDATE_BEFORE); out.collect(resultRow); } resultRow.replace(currentKey, newAggValue).setRowKind(RowKind.UPDATE_AFTER); } } else { resultRow.replace(currentKey, newAggValue).setRowKind(RowKind.INSERT); } out.collect(resultRow); } else { if (!firstRow) { resultRow.replace(currentKey, prevAggValue).setRowKind(RowKind.DELETE); out.collect(resultRow); } accState.clear(); function.cleanup(); } }
Source:
public CollectProducer(final Operator child, final ExchangePairID operatorID, final int collectConsumerWorkerID) { super(child, new ExchangePairID[] { operatorID }, new int[][] { { MyriaConstants.MASTER_ID } }, new int[] { collectConsumerWorkerID }, new FixValuePartitionFunction(0), true); }

Target:
public CollectProducer(final Operator child, final ExchangePairID operatorID, final int collectConsumerWorkerID) { super(child, new ExchangePairID[] { operatorID }, COLLECTOR_PARTITION_TO_CHANNEL, new int[] { collectConsumerWorkerID }, new FixValuePartitionFunction(0), true); }
Source:
public InputStream openNext() throws IOException { if (!iterator.hasNext()) { return null; } final String key = iterator.next(); final GetObjectRequest request = new GetObjectRequest(bucket, key); return new DefaultRetryable<ResumableInputStream>("Opening the file") { @Override public ResumableInputStream call() throws Exception { S3Object obj = client.getObject(request); long objectSize = obj.getObjectMetadata().getContentLength(); LOGGER.info("Open S3Object with bucket [{}], key [{}], with size [{}]", bucket, key, objectSize); return new ResumableInputStream(obj.getObjectContent(), new S3InputStreamReopener(client, request, objectSize, retryExec)); } }.executeWithCheckedException(retryExec, IOException.class); }

Target:
public InputStream openNext() throws IOException { if (!iterator.hasNext()) { return null; } final String key = iterator.next(); final GetObjectRequest request = new GetObjectRequest(bucket, key); S3Object object = new DefaultRetryable<S3Object>(format("Getting object '%s'", request.getKey())) { @Override public S3Object call() { return client.getObject(request); } }.executeWithCheckedException(retryExec, IOException.class); long objectSize = object.getObjectMetadata().getContentLength(); LOGGER.info("Open S3Object with bucket [{}], key [{}], with size [{}]", bucket, key, objectSize); return new ResumableInputStream(object.getObjectContent(), new S3InputStreamReopener(client, request, objectSize, retryExec)); }
Source:
public RelSubset getSubset(RelNode rel) { assert rel != null : "pre: rel != null"; if (rel instanceof RelSubset) { return canonize((RelSubset) rel); } else { RelSubset s = mapRel2Subset.get(rel); return s == null ? null : canonize(s); } }

Target:
public RelSubset getSubset(RelNode rel) { assert rel != null : "pre: rel != null"; if (rel instanceof RelSubset) { return (RelSubset) rel; } else { return mapRel2Subset.get(rel); } }
Source:
public File createSegmentDescriptorFile(final ObjectMapper jsonMapper, final DataSegment segment) throws IOException { File descriptorFile = File.createTempFile(TEMP_DIR, AzureStorageDruidModule.DESCRIPTOR_FILE_NAME); try (FileOutputStream stream = new FileOutputStream(descriptorFile)) { stream.write(jsonMapper.writeValueAsBytes(segment)); } return descriptorFile; }

Target:
public File createSegmentDescriptorFile(final ObjectMapper jsonMapper, final DataSegment segment) throws IOException { File descriptorFile = File.createTempFile("descriptor", ".json"); try (FileOutputStream stream = new FileOutputStream(descriptorFile)) { stream.write(jsonMapper.writeValueAsBytes(segment)); } return descriptorFile; }
Source:
void set(DiffPreferences prefs, JsArray<RevisionInfo> list, DiffInfo info) { this.changeType = info.change_type(); patchSetSelectBoxA.setUpPatchSetNav(list, info.meta_a()); patchSetSelectBoxB.setUpPatchSetNav(list, info.meta_b()); JsArrayString hdr = info.diff_header(); if (hdr != null) { StringBuilder b = new StringBuilder(); for (int i = 1; i < hdr.length(); i++) { String s = hdr.get(i); if (s.startsWith("diff --git ") || s.startsWith("index ") || s.startsWith("+++ ") || s.startsWith("--- ")) { continue; } b.append(s).append('\n'); } String hdrTxt = b.toString().trim(); header = !hdrTxt.isEmpty(); diffHeaderText.setInnerText(hdrTxt); UIObject.setVisible(diffHeaderRow, header); } else { header = false; UIObject.setVisible(diffHeaderRow, false); } if (prefs.hideEmptyPane()) { if (changeType == ChangeType.ADDED) { setVisibleA(false); } else if (changeType == ChangeType.DELETED) { setVisibleB(false); } } }

Target:
void set(DiffPreferences prefs, JsArray<RevisionInfo> list, DiffInfo info) { this.changeType = info.change_type(); patchSetSelectBoxA.setUpPatchSetNav(list, info.meta_a()); patchSetSelectBoxB.setUpPatchSetNav(list, info.meta_b()); JsArrayString hdr = info.diff_header(); if (hdr != null) { StringBuilder b = new StringBuilder(); for (int i = 1; i < hdr.length(); i++) { String s = hdr.get(i); if (s.startsWith("diff --git ") || s.startsWith("index ") || s.startsWith("+++ ") || s.startsWith("--- ")) { continue; } b.append(s).append('\n'); } String hdrTxt = b.toString().trim(); header = !hdrTxt.isEmpty(); diffHeaderText.setInnerText(hdrTxt); UIObject.setVisible(diffHeaderRow, header); } else { header = false; UIObject.setVisible(diffHeaderRow, false); } setHideEmptyPane(prefs.hideEmptyPane()); }
Source:
public void open(FileInputSplit split) throws IOException { super.open(split); @SuppressWarnings("unchecked") FieldParser<Object>[] fieldParsers = (FieldParser<Object>[]) getFieldParsers(); if(fieldParsers.length == 0) { throw new IOException("CsvInputFormat.open(FileInputSplit split) - no field parsers to parse input"); } this.parsedValues = new Object[fieldParsers.length]; for (int i = 0; i < fieldParsers.length; i++) { this.parsedValues[i] = fieldParsers[i].createValue(); } if(this.getDelimiter().length == 1 && this.getDelimiter()[0] == "\n".getBytes(Charsets.UTF_8)[0] ) { this.lineDelimiterIsLinebreak = true; } }

Target:
public void open(FileInputSplit split) throws IOException { super.open(split); @SuppressWarnings("unchecked") FieldParser<Object>[] fieldParsers = (FieldParser<Object>[]) getFieldParsers(); if(fieldParsers.length == 0) { throw new IOException("CsvInputFormat.open(FileInputSplit split) - no field parsers to parse input"); } this.parsedValues = new Object[fieldParsers.length]; for (int i = 0; i < fieldParsers.length; i++) { this.parsedValues[i] = fieldParsers[i].createValue(); } if(this.getDelimiter().length == 1 && this.getDelimiter()[0] == '\n' ) { this.lineDelimiterIsLinebreak = true; } }
Source:
private List<Job> getJobs(long limit, int dayInterval, String whereClause) { try (Handle handle = dbi.open()) { Query<Map<String, Object>> query = handle.createQuery( "SELECT j.*, t.connector_id AS connectorId, t.schema_ AS \"schema\", t.table_ AS \"table\", t.columns, jo.type, jo.description, jo.location FROM " + "(SELECT * FROM jobs " + "WHERE query_finished > DATE_SUB(NOW(), INTERVAL :day_interval day) " + "ORDER BY query_finished DESC LIMIT :limit) j " + "LEFT OUTER JOIN job_tables jt ON j.id = jt.job_id " + "LEFT OUTER JOIN tables t ON jt.table_id = t.id " + "LEFT OUTER JOIN job_outputs jo ON j.id = jo.job_id " + whereClause + " " + "ORDER BY query_finished DESC") .bind("limit", limit) .bind("day_interval", dayInterval); Map<Long, Job> idToJobMap = query. map(RosettaResultSetMapperFactory.mapperFor(JobTableOutputJoinRow.class)). fold(new HashMap<Long, Job>(), new JobTableOutputJoinRow.JobFolder()); return new ArrayList<>(idToJobMap.values()); } }

Target:
private List<Job> getJobs(long limit, int dayInterval, String whereClause) { try (Handle handle = dbi.open()) { Query<Map<String, Object>> query = handle.createQuery( "SELECT " + "j.id AS id, " + "j.query AS query, " + "j.user AS user, " + "j.uuid AS uuid, " + "j.queryStats as queryStats, " + "j.state AS state, " + "j.columns AS columns, " + "j.query_finished AS queryFinished, " + "j.query_started AS queryStarted, " + "j.error AS error, " + "t.connector_id AS connectorId, " + "t.schema_ AS \"schema\", " + "t.table_ AS \"table\", " + "t.columns, " + "jo.type, " + "jo.description, " + "jo.location " + "FROM (SELECT * FROM jobs " + "WHERE query_finished > DATE_SUB(NOW(), INTERVAL :day_interval day) " + "ORDER BY query_finished DESC LIMIT :limit) j " + "LEFT OUTER JOIN job_tables jt ON j.id = jt.job_id " + "LEFT OUTER JOIN tables t ON jt.table_id = t.id " + "LEFT OUTER JOIN job_outputs jo ON j.id = jo.job_id " + whereClause + " " + "ORDER BY query_finished DESC") .bind("limit", limit) .bind("day_interval", dayInterval); Map<Long, Job> idToJobMap = query. map(RosettaResultSetMapperFactory.mapperFor(JobTableOutputJoinRow.class)). fold(new HashMap<Long, Job>(), new JobTableOutputJoinRow.JobFolder()); return new ArrayList<>(idToJobMap.values()); } }
Source:
public Matrix hadamardProduct(Matrix matrix, Factory factory) { ensureFactoryIsNotNull(factory); if (matrix == null) { throw new IllegalArgumentException("Matrix can not be null."); } if (columns != matrix.rows()) { throw new IllegalArgumentException("Wrong matrix dimensions: " + matrix.rows() + "x" + matrix.columns()); } Matrix result = factory.createMatrix(rows, matrix.columns()); for (int i = 0; i < matrix.columns(); i++) { for (int j = 0; j < this.columns(); j++) { result.set(i, j, matrix.get(i, j) * this.get(i, j)); } } return result; }

Target:
public Matrix hadamardProduct(Matrix matrix, Factory factory) { ensureFactoryIsNotNull(factory); if (matrix == null) { throw new IllegalArgumentException("Matrix can not be null."); } if ((columns != matrix.columns()) || (rows != matrix.rows())) { throw new IllegalArgumentException( "Matrices dimensions are not equal: " + matrix.rows() + "x" + matrix.columns() + " not equal to " + rows + "x" + columns); } Matrix result = factory.createMatrix(rows, columns); for (int i = 0; i < rows; i++) { for (int j = 0; j < columns; j++) { result.set(i, j, matrix.get(i, j) * get(i, j)); } } return result; }
Source:
protected LayoutEditPolicy getLayoutPolicy() { return new DataInterfaceLayoutEditPolicy() { @Override protected Command getCreateCommand(CreateRequest request) { if (((getHost() instanceof InterfaceEditPart) && (request.getNewObjectType() instanceof ResourceTypeEntry))){ ResourceTypeEntry type = (ResourceTypeEntry) request.getNewObjectType(); Device dev = (Device)((InterfaceEditPart)getHost()).getModel().eContainer(); return new ResourceCreateCommand(type, dev, false); } return super.getCreateCommand(request); } @Override @SuppressWarnings("unchecked") protected Command getAddCommand(Request generic) { ChangeBoundsRequest request = (ChangeBoundsRequest) generic; List<Object> editParts = request.getEditParts(); CompoundCommand command = new CompoundCommand(); for (Object child : editParts) { if (child instanceof ResourceEditPart) { Device targetDevice = (Device)((InterfaceEditPart)getHost()).getModel().eContainer(); return new ResourceMoveCommand(((ResourceEditPart)child).getModel(), targetDevice, targetDevice.getResource().size()); } } return command.unwrap(); } }; }

Target:
protected LayoutEditPolicy getLayoutPolicy() { return new DataInterfaceLayoutEditPolicy() { @Override protected Command getCreateCommand(CreateRequest request) { if (((getHost() instanceof InterfaceEditPart) && (request.getNewObjectType() instanceof ResourceTypeEntry))){ ResourceTypeEntry type = (ResourceTypeEntry) request.getNewObjectType(); Device dev = (Device)((InterfaceEditPart)getHost()).getModel().eContainer(); return new ResourceCreateCommand(type, dev, false); } return super.getCreateCommand(request); } @Override protected Command getAddCommand(Request generic) { ChangeBoundsRequest request = (ChangeBoundsRequest) generic; @SuppressWarnings("unchecked") List<EditPart> editParts = request.getEditParts(); CompoundCommand command = new CompoundCommand(); for (EditPart child : editParts) { if (child instanceof ResourceEditPart) { Device targetDevice = (Device)((InterfaceEditPart)getHost()).getModel().eContainer(); return new ResourceMoveCommand(((ResourceEditPart)child).getModel(), targetDevice, targetDevice.getResource().size()); } } return command.unwrap(); } }; }