auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected boolean canDoAction() { if (!checkRemoveEditValidations()) { return false; } if (SchedulingManager.getInstance().getClustersByClusterPolicyId(getParameters().getClusterPolicyId()).size() > 0) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_POLICY_INUSE); } return true; }

Target:
protected boolean canDoAction() { if (!checkRemoveEditValidations()) { return false; } if (SchedulingManager.getInstance().getClustersByClusterPolicyId(getParameters().getClusterPolicyId()).size() > 0) { StringBuffer attachedClustersStringBf = new StringBuffer(""); List<VDSGroup> attachedClustersList = SchedulingManager.getInstance().getClustersByClusterPolicyId(getParameters().getClusterPolicyId()); boolean isFirstCluster = true; for (VDSGroup vdsGroup : attachedClustersList) { if (isFirstCluster == false) attachedClustersStringBf.append(','); attachedClustersStringBf.append('\'').append(vdsGroup.getName()).append('\''); isFirstCluster = false; } return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_POLICY_INUSE, String.format("$clusters %1$s", attachedClustersStringBf.toString())); } return true; }
Source:
void removeTableQuotasnapshot(TableName table) { this.tableQuotaSnapshots.remove(table); }

Target:
synchronized void removeTableQuotasnapshot(TableName table) { this.tableQuotaSnapshots.remove(table); }
Source:
public AdaptTempAuthResponseToAccess setContext(HttpRequest request) { String host = request.getEndpoint().getHost(); this.host = host; this.username = request.getFirstHeaderOrNull(SwiftAuthenticationModule.getIdentityHeaderName()); return this; }

Target:
public AdaptTempAuthResponseToAccess setContext(HttpRequest request) { String host = request.getEndpoint().getHost(); this.host = host; this.username = request.getFirstHeaderOrNull(identityHeaderNameUser); return this; }
Source:
private <T> T callRecurlySafeXmlContent(final AsyncHttpClient.BoundRequestBuilder builder, @Nullable final Class<T> clazz) { try { return callRecurlyXmlContent(builder, clazz); } catch (IOException e) { log.warn("Error while calling Recurly", e); return null; } catch (ExecutionException e) { if (e.getCause() != null && e.getCause() instanceof ConnectException) { throw new ConnectionErrorException(e.getCause()); } else if (e.getCause() != null && e.getCause().getCause() != null && e.getCause().getCause() instanceof TransactionErrorException) { throw (TransactionErrorException) e.getCause().getCause(); } else if (e.getCause() != null && e.getCause() instanceof TransactionErrorException) { throw (TransactionErrorException) e.getCause(); } log.error("Execution error", e); return null; } catch (InterruptedException e) { log.error("Interrupted while calling Recurly", e); return null; } }

Target:
private <T> T callRecurlySafeXmlContent(final AsyncHttpClient.BoundRequestBuilder builder, @Nullable final Class<T> clazz) { try { return callRecurlyXmlContent(builder, clazz); } catch (IOException e) { log.warn("Error while calling Recurly", e); return null; } catch (ExecutionException e) { if (e.getCause() instanceof ConnectException) { throw new ConnectionErrorException(e.getCause()); } else if (e.getCause() != null && e.getCause().getCause() != null && e.getCause().getCause() instanceof TransactionErrorException) { throw (TransactionErrorException) e.getCause().getCause(); } else if (e.getCause() != null && e.getCause() instanceof TransactionErrorException) { throw (TransactionErrorException) e.getCause(); } log.error("Execution error", e); return null; } catch (InterruptedException e) { log.error("Interrupted while calling Recurly", e); return null; } }
Source:
public void removeFromParentSlot() { assert parent != null : "Tried to remove a presenter that has no parent from its parent"; parent.removeFromSlot(slot, this); }

Target:
public void removeFromParentSlot() { if (parent == null) { return; } parent.removeFromSlot(slot, this); }
Source:
public <A extends CanvasControl> A newControl(final Class<A> type) { if (CONTROL_TYPES.containsKey(type)) { final Annotation q = CONTROL_TYPES.get(type); return beanManager.lookupBean(type, q).newInstance(); } else { LOGGER.log(Level.WARNING, "Canvas Control for type [" + type.getName() + "] is not supported by " + "this canvas factory [" + this.getClass().getName() + "]"); } return null; }

Target:
public <A extends CanvasControl> A newControl(final Class<A> type) { if (controls.containsKey(type)) { final ManagedInstance<A> mi = controls.get(type); return mi.get(); } else { LOGGER.log(Level.WARNING, "Canvas Control for type [" + type.getName() + "] is not supported by " + "this canvas factory [" + this.getClass().getName() + "]"); } return null; }
Source:
protected Case getElement(int recordId, QueryContext context) { if(context == null) { return super.getElement(recordId, context); } CaseGroupResultCache cue = context.getQueryCacheOrNull(CaseGroupResultCache.class); if(cue != null && cue.hasMatchingCaseSet(recordId)) { if(!cue.isLoaded(recordId)) { EvaluationTrace loadTrace = new EvaluationTrace("Bulk Case Load"); SqlStorage<ACase> sqlStorage = ((SqlStorage<ACase>)storage); LinkedHashSet<Integer> body = cue.getTranche(recordId); sqlStorage.bulkRead(body, cue.getLoadedCaseMap()); loadTrace.setOutcome("Loaded: " + body.size()); context.reportTrace(loadTrace); } return cue.getLoadedCase(recordId); } return super.getElement(recordId, context); }

Target:
protected Case getElement(int recordId, QueryContext context) { if(context == null) { return super.getElement(recordId, context); } CaseGroupResultCache caseGroupCache = context.getQueryCacheOrNull(CaseGroupResultCache.class); if(caseGroupCache != null && caseGroupCache.hasMatchingCaseSet(recordId)) { if(!caseGroupCache.isLoaded(recordId)) { EvaluationTrace loadTrace = new EvaluationTrace("Bulk Case Load"); SqlStorage<ACase> sqlStorage = ((SqlStorage<ACase>)storage); LinkedHashSet<Integer> body = caseGroupCache.getTranche(recordId); sqlStorage.bulkRead(body, caseGroupCache.getLoadedCaseMap()); loadTrace.setOutcome("Loaded: " + body.size()); context.reportTrace(loadTrace); } return caseGroupCache.getLoadedCase(recordId); } return super.getElement(recordId, context); }
Source:
String getEnvName(String serverName) { String serverNameEnv = serverName.replaceAll("[^\\w]", "_"); return String.format(SERVER_PORT_ENV_FMT, serverNameEnv.toUpperCase()); }

Target:
String getEnvName(String serverName) { String serverNameEnv = serverName.replaceAll("\\W", "_"); return String.format(SERVER_PORT_ENV_FMT, serverNameEnv.toUpperCase()); }
Source:
public void update(LogData entry) { long entryAddress = entry.getGlobalAddress(); updateGlobalTail(entryAddress); for (UUID streamId : entry.getStreams()) { long currentStreamTail = streamTails.getOrDefault(streamId, Address.NON_ADDRESS); streamTails.put(streamId, Math.max(currentStreamTail, entryAddress)); if (streamsAddressSpaceMap.containsKey(streamId)) { streamsAddressSpaceMap.get(streamId).addAddress(entryAddress); } else { streamsAddressSpaceMap.put(streamId, new StreamAddressSpace(Address.NON_ADDRESS, Roaring64NavigableMap.bitmapOf(entryAddress))); } } if (entry.hasCheckpointMetadata()) { UUID streamId = entry.getCheckpointedStreamId(); long streamTailAtCP = entry.getCheckpointedStreamStartLogAddress(); if (Address.isAddress(streamTailAtCP)) { long currentStreamTail = streamTails.getOrDefault(streamId, Address.NON_ADDRESS); streamTails.put(streamId, Math.max(currentStreamTail, streamTailAtCP)); if (streamsAddressSpaceMap.containsKey(streamId) && streamsAddressSpaceMap.get(streamId).getAddressCount() != 0) { StreamAddressSpace streamAddressSpace = streamsAddressSpaceMap.get(streamId); streamAddressSpace.setTrimMark(Math.max(streamAddressSpace.getTrimMark(), streamTailAtCP)); } else { streamsAddressSpaceMap.put(streamId, new StreamAddressSpace(streamTailAtCP, new Roaring64NavigableMap())); } } } }

Target:
public void update(LogData entry) { long entryAddress = entry.getGlobalAddress(); updateGlobalTail(entryAddress); for (UUID streamId : entry.getStreams()) { long currentStreamTail = streamTails.getOrDefault(streamId, Address.NON_ADDRESS); streamTails.put(streamId, Math.max(currentStreamTail, entryAddress)); streamsAddressSpaceMap.putIfAbsent(streamId, new StreamAddressSpace(entry.getBackpointer(streamId), new Roaring64NavigableMap())); streamsAddressSpaceMap.get(streamId).addAddress(entryAddress); } if (entry.hasCheckpointMetadata()) { UUID streamId = entry.getCheckpointedStreamId(); long streamTailAtCP = entry.getCheckpointedStreamStartLogAddress(); if (Address.isAddress(streamTailAtCP)) { long currentStreamTail = streamTails.getOrDefault(streamId, Address.NON_ADDRESS); streamTails.put(streamId, Math.max(currentStreamTail, streamTailAtCP)); streamsAddressSpaceMap.putIfAbsent(streamId, new StreamAddressSpace(streamTailAtCP, new Roaring64NavigableMap())); } } }
Source:
public void attachNodeFailAtPrepare() throws Exception { startNode(1, 1); waitUntil(out.getLog(1, 1), containsLog("Started the server in diagnostic mode")); assertThat(getUpcomingCluster("localhost", getNodePort(1, 1)).getNodeCount(), is(equalTo(1))); startNode(1, 2); waitUntil(out.getLog(1, 1), containsLog("Started the server in diagnostic mode")); assertThat(getUpcomingCluster("localhost", getNodePort(1, 2)).getNodeCount(), is(equalTo(1))); assertThat(configToolInvocation("attach", "-d", "localhost:" + getNodePort(1, 1), "-s", "localhost:" + getNodePort(1, 2)), is(successful())); activateCluster(); assertThat(configToolInvocation("set", "-s", "localhost:" + getNodePort(1, 1), "-c", "stripe.1.node.1.tc-properties.attachStatus=prepareAddition-failure"), is(successful())); startNode(1, 3); waitUntil(out.getLog(1, 3), containsLog("Started the server in diagnostic mode")); assertThat(getUpcomingCluster("localhost", getNodePort(1, 3)).getNodeCount(), is(equalTo(1))); assertThat( configToolInvocation("attach", "-f", "-d", "localhost:" + getNodePort(1, 1), "-s", "localhost:" + getNodePort(1, 3)), containsOutput("Two-Phase commit failed")); assertThat(getUpcomingCluster("localhost", getNodePort(1, 1)).getNodeCount(), is(equalTo(2))); assertThat(getUpcomingCluster("localhost", getNodePort(1, 2)).getNodeCount(), is(equalTo(2))); assertThat(getUpcomingCluster("localhost", getNodePort(1, 3)).getNodeCount(), is(equalTo(3))); }

Target:
public void attachNodeFailAtPrepare() throws Exception { startNode(1, 1); waitUntil(out.getLog(1, 1), containsLog("Started the server in diagnostic mode")); assertThat(getUpcomingCluster("localhost", getNodePort(1, 1)).getNodeCount(), is(equalTo(1))); startNode(1, 2); waitUntil(out.getLog(1, 1), containsLog("Started the server in diagnostic mode")); assertThat(getUpcomingCluster("localhost", getNodePort(1, 2)).getNodeCount(), is(equalTo(1))); assertThat(configToolInvocation("attach", "-d", "localhost:" + getNodePort(1, 1), "-s", "localhost:" + getNodePort(1, 2)), is(successful())); activateCluster(); assertThat(configToolInvocation("set", "-s", "localhost:" + getNodePort(1, 1), "-c", "stripe.1.node.1.tc-properties.attachStatus=prepareAddition-failure"), is(successful())); startNode(1, 3); waitUntil(out.getLog(1, 3), containsLog("Started the server in diagnostic mode")); assertThat(getUpcomingCluster("localhost", getNodePort(1, 3)).getNodeCount(), is(equalTo(1))); assertThat( configToolInvocation("attach", "-f", "-d", "localhost:" + getNodePort(1, 1), "-s", "localhost:" + getNodePort(1, 3)), containsOutput("Two-Phase commit failed")); assertThat(getUpcomingCluster("localhost", getNodePort(1, 1)).getNodeCount(), is(equalTo(2))); assertThat(getUpcomingCluster("localhost", getNodePort(1, 2)).getNodeCount(), is(equalTo(2))); assertThat(getUpcomingCluster("localhost", getNodePort(1, 3)).getNodeCount(), is(equalTo(1))); withTopologyService(1, 1, topologyService -> assertTrue(topologyService.isActivated())); withTopologyService(1, 2, topologyService -> assertTrue(topologyService.isActivated())); withTopologyService(1, 3, topologyService -> assertFalse(topologyService.isActivated())); }
Source:
private void addApplication(File file) { String app; if (isApp(file)) { if (!isResigned(file)) { app = file.getAbsolutePath(); selendroidConfiguration.addSupportedApp(app); log.info("added:\n\t" + app); } } }

Target:
private void addApplication(File file) { String app; if (isApp(file)) { if (!isResigned(file)) { app = file.getAbsolutePath(); selendroidConfiguration.addSupportedApp(app); log.info("File added to supported list:\n\t" + app); } } }
Source:
public org.codice.solr.client.solrj.SolrClient newClient(String core) { String solrUrl = StringUtils.defaultIfBlank( AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty(SOLR_HTTP_URL)), getDefaultHttpsAddress()); final String coreUrl = solrUrl + "/" + core; final String solrDataDir = AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty(SOLR_DATA_DIR)); if (solrDataDir != null) { ConfigurationStore.getInstance().setDataDirectoryPath(solrDataDir); } LOGGER.debug("Solr({}): Creating an HTTP Solr client using url [{}]", core, coreUrl); SolrClientAdapter adaptor = new SolrClientAdapter(core, () -> createSolrHttpClient(solrUrl, core, coreUrl)); try { if (!adaptor.isAvailable(30, 5, TimeUnit.SECONDS)) { LOGGER.warn("Solr Client is not available after 30 seconds", core); } } catch (InterruptedException e) { LOGGER.error("Unable to connect to solr client {}: ", core, e.getStackTrace()); } return adaptor; }

Target:
public org.codice.solr.client.solrj.SolrClient newClient(String core) { String solrUrl = StringUtils.defaultIfBlank( AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty(SOLR_HTTP_URL)), getDefaultHttpsAddress()); final String coreUrl = solrUrl + "/" + core; final String solrDataDir = AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty(SOLR_DATA_DIR)); if (solrDataDir != null) { ConfigurationStore.getInstance().setDataDirectoryPath(solrDataDir); } LOGGER.debug("Solr({}): Creating an HTTP Solr client using url [{}]", core, coreUrl); SolrClientAdapter adaptor = new SolrClientAdapter(core, () -> createSolrHttpClient(solrUrl, core, coreUrl)); try { if (!adaptor.isAvailable(30, 5, TimeUnit.SECONDS)) { LOGGER.warn("Solr Client is not available after 30 seconds", core); } } catch (InterruptedException e) { LOGGER.error("Unable to connect to solr client {}: ", core, e.getStackTrace()); Thread.currentThread().interrupt(); } return adaptor; }
Source:
public void listSettingsContext() { ConfigurationClient configurationClient = createSyncConfigurationClient(); SettingSelector settingSelector = new SettingSelector().keys("prodDBConnection"); Context ctx = new Context(key2, value2); PagedIterable<ConfigurationSetting> csStream = configurationClient.listSettings(settingSelector, ctx); csStream.streamByPage().forEach(setting -> { System.out.printf("Key: %s, Value: %s", setting.value().get(0).key(), setting.value().get(0).value()); }); END: com.azure.data.applicationconfig.configurationclient.listSettings#SettingSelector-Context }

Target:
public void listSettingsContext() { ConfigurationClient configurationClient = createSyncConfigurationClient(); SettingSelector settingSelector = new SettingSelector().keys("prodDBConnection"); Context ctx = new Context(key2, value2); configurationClient.listSettings(settingSelector, ctx).forEach(setting -> { System.out.printf("Key: %s, Value: %s", setting.key(), setting.value()); }); END: com.azure.data.applicationconfig.configurationclient.listSettings#settingSelector-context }
Source:
protected WebsocketProxyConfig getConfig() { if (config != null) { new WebsocketProxyConfig( (String) AsyncDataProvider.getInstance().getConfigValuePreConverted(ConfigurationValues.WebSocketProxy), getVncHost()); } return config; }

Target:
protected WebsocketProxyConfig getConfig() { if (config != null) { config = new WebsocketProxyConfig((String) AsyncDataProvider.getInstance().getConfigValuePreConverted(ConfigurationValues.WebSocketProxy), getVncHost()); } return config; }
Source:
public Iterator<E> find(EntityFilters filters, FieldMask fieldMask) { checkNotNull(filters); checkNotNull(fieldMask); final EntityQuery<I> entityQuery = EntityQueries.from(filters, columnCache()); final EntityQuery<I> completeQuery = toCompleteQuery(entityQuery); final Iterator<EntityRecord> records = recordStorage().readAll(completeQuery, fieldMask); final Function<EntityRecord, E> toEntity = entityConverter().reverse(); final Iterator<E> result = transform(records, toEntity); return result; }

Target:
public Iterator<E> find(EntityFilters filters, FieldMask fieldMask) { checkNotNull(filters); checkNotNull(fieldMask); final EntityQuery<I> entityQuery = EntityQueries.from(filters, recordStorage()); final EntityQuery<I> completeQuery = toCompleteQuery(entityQuery); final Iterator<EntityRecord> records = recordStorage().readAll(completeQuery, fieldMask); final Function<EntityRecord, E> toEntity = entityConverter().reverse(); final Iterator<E> result = transform(records, toEntity); return result; }
Source:
public FastTextExecutorService() { this.executorService = Executors.newFixedThreadPool(8); }

Target:
private FastTextExecutorService() { this.executorService = Executors.newFixedThreadPool(Configuration.getThreadPoolSize()); }
Source:
public void testReportingMigrationCorrectRawObjectIsSentAsPartOfTheEventReport() throws RecoverableException, WriteException, JsonProcessingException { this.content.setLastFetched(DateTime.parse("2016-08-28T00:00:00Z")); ResourceUpdatedMessage updatedMessage = createUpdatedMessage(); when(resourceRef.getId()).thenReturn(Id.valueOf(1)); when(contentResolver.resolveIds(any(Collection.class))).thenReturn(Futures.immediateFuture(Resolved.valueOf(ImmutableList.of(content)))); when(writer.writeContent(content)).thenReturn(successfulWriteResult); when(metricsTimer.time()).thenReturn(timerContext); when(objectMapper.writeValueAsString(any(Content.class))).thenReturn("{ \"test\":\"test\"}"); bootstrapWorker.process(updatedMessage); verify(telescopeClient, times(1)).createEvent(any(Event.class)); verify(telescopeClient).createEvent(columbusTelescopeEventCaptor.capture()); Event event = columbusTelescopeEventCaptor.getValue(); assertThat(event.getEntityState().get().getRaw().get(), is("{ \"test\":\"test\"}")); assertThat(event.getEntityState().get().getRawMime().get(), is(MimeType.APPLICATION_JSON.toString())); assertThat(event.getEntityState().get().getAtlasId().get(), is("c")); }

Target:
public void testReportingMigrationCorrectRawObjectIsSentAsPartOfTheEventReport() throws RecoverableException, WriteException, JsonProcessingException { this.content.setLastFetched(DateTime.parse("2016-08-28T00:00:00Z")); ResourceUpdatedMessage updatedMessage = createUpdatedMessage(); when(resourceRef.getId()).thenReturn(Id.valueOf(1)); when(contentResolver.resolveIds(any(Collection.class))).thenReturn(Futures.immediateFuture(Resolved.valueOf(ImmutableList.of(content)))); when(writer.writeContent(content)).thenReturn(successfulWriteResult); when(metricsTimer.time()).thenReturn(timerContext); when(objectMapper.writeValueAsString(any(Content.class))).thenReturn(TEST_RAW_STRING); bootstrapWorker.process(updatedMessage); verify(telescopeClient, times(1)).createEvent(any(Event.class)); verify(telescopeClient).createEvent(columbusTelescopeEventCaptor.capture()); Event event = columbusTelescopeEventCaptor.getValue(); assertThat(event.getEntityState().get().getRaw().get(), is(TEST_RAW_STRING)); assertThat(event.getEntityState().get().getRawMime().get(), is(MimeType.APPLICATION_JSON.toString())); assertThat(event.getEntityState().get().getAtlasId().get(), is("c")); }
Source:
public void GIVEN_component_not_in_config_WHEN_adding_duplicate_ioc_THEN_no_conflict_returned() { DuplicateChecker<Ioc> checker = new IocDuplicateChecker(); configIocs.add(ioc1); allComps.add(mockComp(COMP_NAME_1, Collections.emptyList(), Arrays.asList(ioc1))); baseConfig = mockConfig(BASE_CONFIG_NAME, configBlocks, configComps, configIocs); checker.setBase(baseConfig, allComps); Map<String, Set<String>> result = checker.checkItemsOnAddItem(mockIoc(IOC_NAME_1, COMP_NAME_1), COMP_NAME_1); assertTrue(result.isEmpty()); }

Target:
public void GIVEN_component_not_in_config_WHEN_adding_duplicate_ioc_THEN_no_conflict_returned() { configIocs.add(ioc1); allComps.add(mockComp(COMP_NAME_1, Collections.emptyList(), Arrays.asList(ioc1))); baseConfig = mockConfig(BASE_CONFIG_NAME, configBlocks, configComps, configIocs); iocDuplicateChecker.setBase(baseConfig, allComps); Map<String, Set<String>> result = iocDuplicateChecker.checkItemsOnAddItem(mockIoc(IOC_NAME_1, COMP_NAME_1), COMP_NAME_1); assertTrue(result.isEmpty()); }
Source:
public void setDIOValue(IOLine ioLine, IOValue ioValue) throws InvalidOperatingModeException, XBeeException { if (!connectionInterface.isOpen()) throw new XBeeException(XBeeException.CONNECTION_NOT_OPEN); if (ioLine == null) throw new NullPointerException("IO line cannot be null."); if (ioValue == null) throw new NullPointerException("IO value cannot be null."); String atCommand = ioLine.getATCommand(); byte[] valueByte = new byte[]{(byte)ioValue.getID()}; ATCommandResponse response = sendATCommand(new ATCommand(atCommand, valueByte)); if (response == null || response.getResponseStatus() != ATCommandStatus.OK) throw new XBeeException(XBeeException.INVALID_OPERATION); }

Target:
public void setDIOValue(IOLine ioLine, IOValue ioValue) throws InvalidOperatingModeException, XBeeException { if (!connectionInterface.isOpen()) throw new XBeeException(XBeeException.CONNECTION_NOT_OPEN); if (ioLine == null) throw new NullPointerException("IO line cannot be null."); if (ioValue == null) throw new NullPointerException("IO value cannot be null."); String atCommand = ioLine.getConfigurationATCommand(); byte[] valueByte = new byte[]{(byte)ioValue.getID()}; ATCommandResponse response = sendATCommand(new ATCommand(atCommand, valueByte)); if (response == null || response.getResponseStatus() != ATCommandStatus.OK) throw new XBeeException(XBeeException.INVALID_OPERATION); }
Source:
private JToolBar getToolBar() { if (mainToolBar == null) { mainToolBar = new JToolBar(); mainToolBar.setLayout(new java.awt.GridBagLayout()); mainToolBar.setEnabled(true); mainToolBar.setFloatable(false); mainToolBar.setRollover(true); mainToolBar.setPreferredSize(new java.awt.Dimension(800,30)); mainToolBar.setName("Callback Toolbar"); mainToolBar.add(getClearButton(), newGBC(0)); mainToolBar.add(new JPanel(), newPlaceholderGBC(1)); mainToolBar.add(getOptionsButton(), newOptionsGBC(2)); } return mainToolBar; }

Target:
private JToolBar getToolBar() { if (mainToolBar == null) { mainToolBar = new JToolBar(); mainToolBar.setEnabled(true); mainToolBar.setFloatable(false); mainToolBar.setRollover(true); mainToolBar.setName("Callback Toolbar"); mainToolBar.add(getClearButton()); mainToolBar.add(Box.createHorizontalGlue()); mainToolBar.add(getOptionsButton()); } return mainToolBar; }
Source:
public Future<Channel> acquire(Promise<Channel> promise) { http2ClientMetrics.http2NewStreamCount.inc(); if (closed.get()) { return promise.setFailure(new IOException("Channel pool is closed!")); } List<MultiplexedChannelRecord> multiplexedChannelRecords = new ArrayList<>(parentConnections); for (int i = 0; i < multiplexedChannelRecords.size(); i++) { int randomIndex = random.nextInt(multiplexedChannelRecords.size()); MultiplexedChannelRecord multiplexedChannelRecord = multiplexedChannelRecords.get(randomIndex); if (acquireStreamOnInitializedConnection(multiplexedChannelRecord, promise)) { return promise; } log.warn("Stream slip acquire on {}", inetSocketAddress); http2ClientMetrics.http2StreamSlipAcquireCount.inc(); } acquireStreamOnNewConnection(promise); return promise; }

Target:
public Future<Channel> acquire(Promise<Channel> promise) { http2ClientMetrics.http2NewStreamCount.inc(); if (closed.get()) { return promise.setFailure(new IOException("Channel pool is closed!")); } if (parentConnections.size() >= http2ClientConfig.http2MinConnectionPerPort) { List<MultiplexedChannelRecord> multiplexedChannelRecords = new ArrayList<>(parentConnections); Collections.shuffle(multiplexedChannelRecords); for (MultiplexedChannelRecord multiplexedChannelRecord : multiplexedChannelRecords) { if (acquireStreamOnInitializedConnection(multiplexedChannelRecord, promise)) { return promise; } log.warn("Stream slip acquire on {}", inetSocketAddress); http2ClientMetrics.http2StreamSlipAcquireCount.inc(); } } acquireStreamOnNewConnection(promise); return promise; }
Source:
public void widgetSelected(SelectionEvent e) { Table table = fTableViewer.getTable(); table.setSortDirection(getSortDirection()); TableColumn prevSortcolumn = table.getSortColumn(); if (prevSortcolumn == fColumn) { flipSortDirection(); } table.setSortColumn(fColumn); ViewerCompoundComparator comparator = fComparators.get(fColumn.getText()); if (fDirection == SWT.DOWN) { fTableViewer.setComparator(comparator); } else { fTableViewer.setComparator(new InvertSorter(comparator)); } refreshContentProvider(); }

Target:
public void widgetSelected(SelectionEvent e) { Table table = fTableViewer.getTable(); TableColumn prevSortcolumn = table.getSortColumn(); if (prevSortcolumn == fColumn) { flipSortDirection(); } table.setSortDirection(fDirection); table.setSortColumn(fColumn); ViewerCompoundComparator comparator = fComparators.get(fColumn.getText()); if (fDirection == SWT.DOWN) { fTableViewer.setComparator(comparator); } else { fTableViewer.setComparator(new InvertSorter(comparator)); } sortOrderChanged(); }
Source:
public DeserializationResult getNextRecord(T target) throws IOException { if (nonSpanningWrapper.canReadLength()) { return nonSpanningWrapper.getNextRecord( target, recordLength -> spanningWrapper.transferFrom(nonSpanningWrapper, recordLength)); } else if (nonSpanningWrapper.hasRemaining()) { nonSpanningWrapper.transferTo(spanningWrapper.lengthBuffer); return PARTIAL_RECORD; } else if (spanningWrapper.hasFullRecord()) { target.read(spanningWrapper.getInputView()); spanningWrapper.transferLeftOverTo(nonSpanningWrapper); return nonSpanningWrapper.hasRemaining() ? INTERMEDIATE_RECORD_FROM_BUFFER : LAST_RECORD_FROM_BUFFER; } else { return PARTIAL_RECORD; } }

Target:
public DeserializationResult getNextRecord(T target) throws IOException { if (nonSpanningWrapper.hasCompleteLength()) { return readNonSpanningRecord(target); } else if (nonSpanningWrapper.hasRemaining()) { nonSpanningWrapper.transferTo(spanningWrapper.lengthBuffer); return PARTIAL_RECORD; } else if (spanningWrapper.hasFullRecord()) { target.read(spanningWrapper.getInputView()); spanningWrapper.transferLeftOverTo(nonSpanningWrapper); return nonSpanningWrapper.hasRemaining() ? INTERMEDIATE_RECORD_FROM_BUFFER : LAST_RECORD_FROM_BUFFER; } else { return PARTIAL_RECORD; } }
Source:
public StreamLogFiles(ServerContext serverContext, boolean noVerify) { logDir = Paths.get(serverContext.getServerConfig().get("--log-path").toString(), "log"); writeChannels = new ConcurrentHashMap<>(); channelsToSync = new HashSet<>(); this.verify = !noVerify; this.dataStore = StreamLogDataStore.builder().dataStore(serverContext.getDataStore()).build(); initStreamLogDirectory(); verifyLogs(); long startingAddress = dataStore.getStartingAddress(); long firstSegment = startingAddress / RECORDS_PER_LOG_FILE; long lastSegment = dataStore.getTailSegment(); logMetadata = initializeLogMetadata(firstSegment, lastSegment, startingAddress); if (Math.max(logMetadata.getGlobalTail(), 0L) < getTrimMark()) { syncTailSegment(getTrimMark() - 1); } }

Target:
public StreamLogFiles(ServerContext serverContext, boolean noVerify) { logDir = Paths.get(serverContext.getServerConfig().get("--log-path").toString(), "log"); writeChannels = new ConcurrentHashMap<>(); channelsToSync = new HashSet<>(); this.verify = !noVerify; this.dataStore = StreamLogDataStore.builder().dataStore(serverContext.getDataStore()).build(); initStreamLogDirectory(); verifyLogs(); logMetadata = initializeLogMetadata(); if (Math.max(logMetadata.getGlobalTail(), 0L) < getTrimMark()) { syncTailSegment(getTrimMark() - 1); } }
Source:
private String getMethodName(String httpMethod) { if (httpMethod.equals("POST")) { return "add"; } if (httpMethod.equals("PUT")) { return "update"; } if (httpMethod.equals("GET")) { return "get"; } if (httpMethod.equals("DELETE")) { return "remove"; } return ""; }

Target:
private String getMethodName(String httpMethod) { switch (httpMethod) { case "POST": return "add"; case "PUT": return "update"; case "GET": return "get"; case "DELETE": return "remove"; default: return ""; } }
Source:
private HttpMessage createHttpMessage(String cspHeaderName, String cspPolicy) { HttpMessage msg = new HttpMessage(); String header = !cspHeaderName.isEmpty() ? cspHeaderName : "Content-Security-Policy"; try { msg.setRequestHeader("GET <LINK_0> HTTP/1.1"); msg.setResponseBody("<html></html>"); msg.setResponseHeader( "HTTP/1.1 200 OK\r\n" + "Server: Apache-Coyote/1.1\r\n" + header + ":" + cspPolicy + "\r\n" + "Content-Type: text/html;charset=ISO-8859-1\r\n" + "Content-Length: " + msg.getResponseBody().length() + "\r\n"); } catch (HttpMalformedHeaderException e) { } return msg; }

Target:
private HttpMessage createHttpMessage(String cspHeaderName, String cspPolicy) { HttpMessage msg = new HttpMessage(); String header = !cspHeaderName.isEmpty() ? cspHeaderName : HTTP_HEADER_CSP; try { msg.setRequestHeader("GET <LINK_0> HTTP/1.1"); msg.setResponseBody("<html></html>"); msg.setResponseHeader( "HTTP/1.1 200 OK\r\n" + "Server: Apache-Coyote/1.1\r\n" + header + ":" + cspPolicy + "\r\n" + "Content-Type: text/html;charset=ISO-8859-1\r\n" + "Content-Length: " + msg.getResponseBody().length() + "\r\n"); } catch (HttpMalformedHeaderException e) { throw new RuntimeException(e); } return msg; }
Source:
public static boolean isPublicKeyValid(String publicKey) { String[] words = publicKey.split("\\s+", 3); if (words.length < 2 || words.length > 3) { return false; } if (!words[0].matches("^[\\p{Alpha}\\p{Digit}-]*$")) { return false; } if (!Base64.isArrayByteBase64(words[1].getBytes())) { return false; } return true; }

Target:
public static boolean isPublicKeyValid(String publicKey) { String[] words = publicKey.split("\\s+", 3); if (words.length < 2 || words.length > 3) { return false; } if (!words[0].matches("^[\\p{Alpha}\\p{Digit}-]*$")) { return false; } if (!isBase64(words[1].getBytes())) { return false; } return true; }
Source:
public void determineProfileTest() { assertEquals(Profile.SUMMARY_STATION, controller.determineProfile(null)); FilterParameters filter = new FilterParameters(); filter.setDataProfile("summarystation"); assertEquals(Profile.SUMMARY_STATION, controller.determineProfile(filter)); filter.setDataProfile("periodofrecord"); assertEquals(Profile.PERIOD_OF_RECORD, controller.determineProfile(filter)); }

Target:
public void determineProfileTest() { assertEquals(Profile.SUMMARY_STATION, controller.determineProfile(null)); FilterParameters filter = new FilterParameters(); filter.setDataProfile("summarystation"); assertEquals(Profile.SUMMARY_STATION, controller.determineProfile(filter)); filter.setDataProfile("periodOfRecord"); assertEquals(Profile.PERIOD_OF_RECORD, controller.determineProfile(filter)); }
Source:
private EventData traceMessageSpan(EventData eventData) { Optional<Object> eventContextData = eventData.getContext().getData(SPAN_CONTEXT_KEY); if (eventContextData.isPresent()) { return eventData; } else { Context eventSpanContext = tracerProvider.startSpan(eventData.getContext(), ProcessKind.MESSAGE); if (eventSpanContext != null) { Optional<Object> eventDiagnosticIdOptional = eventSpanContext.getData(DIAGNOSTIC_ID_KEY); if (eventDiagnosticIdOptional.isPresent()) { eventData.addProperty(DIAGNOSTIC_ID_KEY, eventDiagnosticIdOptional.get().toString()); tracerProvider.endSpan(eventSpanContext, Signal.complete()); eventData.addContext(SPAN_CONTEXT_KEY, eventSpanContext); } } } return eventData; }

Target:
private EventData traceMessageSpan(EventData eventData) { Optional<Object> eventContextData = eventData.getContext().getData(SPAN_CONTEXT_KEY); if (eventContextData.isPresent()) { return eventData; } else { Context eventSpanContext = tracerProvider.startSpan(eventData.getContext(), ProcessKind.MESSAGE); Optional<Object> eventDiagnosticIdOptional = eventSpanContext.getData(DIAGNOSTIC_ID_KEY); if (eventDiagnosticIdOptional.isPresent()) { eventData.getProperties().put(DIAGNOSTIC_ID_KEY, eventDiagnosticIdOptional.get().toString()); tracerProvider.endSpan(eventSpanContext, Signal.complete()); eventData.addContext(SPAN_CONTEXT_KEY, eventSpanContext); } } return eventData; }
Source:
public static int[] convertRGBAFunctiontoIntTable(String rgba) { int[] extract = new int[3]; int start = 0; int end = 0; start = rgba.indexOf("(", 0) + 1; end = rgba.indexOf(",", 0); int red = Integer.parseInt(rgba.substring(start, end)); start = rgba.indexOf(" ", end + 1) + 1; end = rgba.indexOf(",", end + 1); int green = Integer.parseInt(rgba.substring(start, end)); start = rgba.indexOf(" ", end + 1) + 1; end = rgba.indexOf(",", end + 1); int blue = Integer.parseInt(rgba.substring(start, end)); extract[0] = red; extract[1] = green; extract[2] = blue; return extract; }

Target:
public static int[] convertRGBAFunctiontoIntTable(String rgba) { int[] extract = new int[3]; int start = rgba.indexOf("(", 0) + 1; int end = rgba.indexOf(",", 0); int red = Integer.parseInt(rgba.substring(start, end)); start = rgba.indexOf(" ", end + 1) + 1; end = rgba.indexOf(",", end + 1); int green = Integer.parseInt(rgba.substring(start, end)); start = rgba.indexOf(" ", end + 1) + 1; end = rgba.indexOf(",", end + 1); int blue = Integer.parseInt(rgba.substring(start, end)); extract[0] = red; extract[1] = green; extract[2] = blue; return extract; }
Source:
public boolean onMapClick(@NonNull LatLng point) { List<Feature> renderedStationFeatures = mapboxMap.queryRenderedFeatures( mapboxMap.getProjection().toScreenLocation(point), LAYER_ID); if (!renderedStationFeatures.isEmpty()) { Point pointOfSelectedStation = (Point) renderedStationFeatures.get(0).geometry(); if (pointOfSelectedStation != null) { String selectedBoltFeatureName = renderedStationFeatures.get(0).getStringProperty(STATION_NAME_PROPERTY); List<Feature> featureList = featureCollection.features(); for (int i = 0; i < featureList.size(); i++) { if (featureList.get(i).getStringProperty(STATION_NAME_PROPERTY).equals(selectedBoltFeatureName)) { makeMapboxMatrixApiCall(i); } } } } return true; }

Target:
public boolean onMapClick(@NonNull LatLng point) { List<Feature> renderedStationFeatures = mapboxMap.queryRenderedFeatures( mapboxMap.getProjection().toScreenLocation(point), LAYER_ID); if (!renderedStationFeatures.isEmpty()) { Feature featureOfSelectedStation = renderedStationFeatures.get(0); if (featureOfSelectedStation != null) { String selectedBoltFeatureName = featureOfSelectedStation.getStringProperty(STATION_NAME_PROPERTY); List<Feature> featureList = featureCollection.features(); if (featureList != null) { for (int i = 0; i < featureList.size(); i++) { if (featureList.get(i).getStringProperty(STATION_NAME_PROPERTY).equals(selectedBoltFeatureName)) { makeMapboxMatrixApiCall(i); } } } } } return true; }
Source:
public VDSReturnValue get(long timeout, TimeUnit unit) throws TimeoutException { try { status = new StatusOnlyReturnForXmlRpc(httpTask.get(timeout, unit)); proceedProxyReturnValue(); } catch (TimeoutException e) { httpTask.cancel(true); VDSNetworkException ex = new VDSNetworkException("Timeout during xml-rpc call"); ex.setVdsError(new VDSError(VdcBllErrors.VDS_NETWORK_ERROR, "Timeout during xml-rpc call")); setVdsRuntimeError(ex); log.error("Timeout waiting for VDSM response: {}", e.getMessage()); log.debug("Exception", e); throw e; } catch (VDSNetworkException e) { if (!"Policy reset".equals(e.getVdsError().getMessage())) { log.error("Exception", e); } setVdsExceptionAndLog(e); } catch (Exception e) { log.error("Exception", e); setVdsExceptionAndLog(e); } return getVDSReturnValue(); }

Target:
public VDSReturnValue get(long timeout, TimeUnit unit) throws TimeoutException { try { status = new StatusOnlyReturnForXmlRpc(httpTask.get(timeout, unit)); proceedProxyReturnValue(); } catch (TimeoutException e) { httpTask.cancel(true); VDSNetworkException ex = new VDSNetworkException("Timeout during xml-rpc call"); ex.setVdsError(new VDSError(VdcBllErrors.VDS_NETWORK_ERROR, "Timeout during xml-rpc call")); setVdsRuntimeError(ex); log.error("Timeout waiting for VDSM response: {}", e.getMessage()); log.debug("Exception", e); throw e; } catch (VDSNetworkException e) { setVdsRuntimeError(e); log.error("Error: {}", e.getMessage()); if (!"Policy reset".equals(e.getVdsError().getMessage())) { log.error("Exception", e); } } catch (Exception e) { log.error("Error: {}", e.getMessage()); log.error("Exception", e); setVdsRuntimeError(e instanceof RuntimeException ? (RuntimeException) e : new RuntimeException(e)); } return getVDSReturnValue(); }
Source:
public <T, ID> List<T> findByIds(Iterable<ID> ids, Class<T> domainType, String containerName) { Assert.notNull(ids, "Id list should not be null"); Assert.notNull(domainType, "domainType should not be null."); Assert.hasText(containerName, "container should not be null, empty or only whitespaces"); final List<Object> idList = new ArrayList<>(); for (ID id : ids) { if (id instanceof String) { idList.add(id); } else if (id instanceof Integer) { idList.add(Integer.toString((Integer) id)); } else if (id instanceof Long) { idList.add(Long.toString((Long) id)); } else { throw new IllegalQueryException("Type of id field must be String or Integer or Long"); } } final DocumentQuery query = new DocumentQuery(Criteria.getInstance(CriteriaType.IN, "id", Collections.singletonList(idList), Part.IgnoreCaseType.NEVER)); return find(query, domainType, containerName); }

Target:
public <T, ID> List<T> findByIds(Iterable<ID> ids, Class<T> domainType, String containerName) { Assert.notNull(ids, "Id list should not be null"); Assert.notNull(domainType, "domainType should not be null."); Assert.hasText(containerName, "container should not be null, empty or only whitespaces"); final List<Object> idList = new ArrayList<>(); for (ID id : ids) { idList.add(CosmosUtils.getStringIDValue(id)); } final DocumentQuery query = new DocumentQuery(Criteria.getInstance(CriteriaType.IN, "id", Collections.singletonList(idList), Part.IgnoreCaseType.NEVER)); return find(query, domainType, containerName); }
Source:
protected OuterSchemaCompatibility resolveOuterSchemaCompatibility(RowSerializer newSerializer) { if (version == translateVersion(newSerializer)) { return OuterSchemaCompatibility.COMPATIBLE_AS_IS; } return OuterSchemaCompatibility.COMPATIBLE_AFTER_MIGRATION; }

Target:
protected OuterSchemaCompatibility resolveOuterSchemaCompatibility(RowSerializer newSerializer) { if (readVersion <= LAST_VERSION_WITHOUT_ROW_KIND) { return OuterSchemaCompatibility.COMPATIBLE_AFTER_MIGRATION; } return OuterSchemaCompatibility.COMPATIBLE_AS_IS; }
Source:
public synchronized void close() throws IOException { if (closed) { return; } this.closed = true; final Collection<EJBClientContextListener> listeners = new ArrayList<EJBClientContextListener>(this.ejbClientContextListeners); for (final EJBClientContextListener listener : listeners) { try { listener.contextClosed(this); } catch (Throwable t) { logger.debug("Ignoring the exception thrown by an EJB client context listener while closing the context " + this, t); } } this.ejbClientContextTasksExecutorService.shutdownNow(); }

Target:
public synchronized void close() throws IOException { if (closed) { return; } this.closed = true; EJBClientContextListener[] listeners; synchronized (this.ejbClientContextListeners) { listeners = this.ejbClientContextListeners.toArray(new EJBClientContextListener[this.ejbClientContextListeners.size()]); } for (final EJBClientContextListener listener : listeners) { try { listener.contextClosed(this); } catch (Throwable t) { logger.debug("Ignoring the exception thrown by an EJB client context listener while closing the context " + this, t); } } this.ejbClientContextTasksExecutorService.shutdownNow(); }
Source:
public void propagateEvent(Blackhole hole) { for (int i = 0; i < 100; i++) { pipeline.fireChannelReadComplete(); hole.consume(i); } }

Target:
public void propagateEvent(Blackhole hole) { for (int i = 0; i < 100; i++) { hole.consume(pipeline.fireChannelReadComplete()); } }
Source:
private void deleteSshKey(final String key, final Account account) throws OrmException { ResultSet<AccountSshKey> keys = db.accountSshKeys().byAccount(account.getId()); if (key.equals("ALL")) { db.accountSshKeys().delete(keys); } else { for (AccountSshKey accountSshKey : keys) { if ((accountSshKey.getSshPublicKey() != null && accountSshKey.getSshPublicKey().equals(key.trim())) || accountSshKey.getComment().trim().equals(key)) { db.accountSshKeys().delete(Collections.singleton(accountSshKey)); } } } sshKeyCache.evict(account.getUserName()); }

Target:
private void deleteSshKey(final String key, final Account account) throws OrmException { ResultSet<AccountSshKey> keys = db.accountSshKeys().byAccount(account.getId()); if (key.equals("ALL")) { db.accountSshKeys().delete(keys); } else { for (AccountSshKey accountSshKey : keys) { if (key.trim().equals(accountSshKey.getSshPublicKey()) || accountSshKey.getComment().trim().equals(key)) { db.accountSshKeys().delete(Collections.singleton(accountSshKey)); } } } sshKeyCache.evict(account.getUserName()); }
Source:
private Properties loadKieServerInstanceData() { Properties properties = new Properties(); try (InputStream is = new FileInputStream(userFile)) { properties.load(is); } catch (Exception e) { log.errorf("file not found %1$s", userFile); } return properties; }

Target:
private Properties loadKieServerInstanceData() { Properties properties = new Properties(); try (InputStream is = new FileInputStream(userFile)) { properties.load(is); } catch (IOException e) { log.errorf(e, "An error ocurred. File <%1$s> is a directory, it does not exist or it cannot be opened", userFile); } return properties; }
Source:
private boolean resolvesReferenceBindingTo(ITypeBinding sb, String signature) { if (sb == null) { return false; } if (new String(sb.getName()).startsWith(signature) || (sb.isArray() && "array".equals(signature))) { return true; } List<ITypeBinding> bindings = new ArrayList<>(); Collections.addAll(bindings, sb.getInterfaces()); bindings.add(sb.getSuperclass()); boolean result = false; Iterator<ITypeBinding> it = bindings.iterator(); while (it.hasNext() && result == false) { result = resolvesReferenceBindingTo(it.next(), signature); } return result; }

Target:
private boolean resolvesReferenceBindingTo(ITypeBinding sb, String signature) { if (sb == null) { return false; } if (new String(sb.getQualifiedName()).startsWith(signature) || (sb.isArray() && "array".equals(signature))) { return true; } List<ITypeBinding> bindings = new ArrayList<>(); Collections.addAll(bindings, sb.getInterfaces()); bindings.add(sb.getSuperclass()); boolean result = false; Iterator<ITypeBinding> it = bindings.iterator(); while (it.hasNext() && result == false) { result = resolvesReferenceBindingTo(it.next(), signature); } return result; }
Source:
public void annotationKeys() { assertThat(CassandraUtil.annotationKeys(QueryRequest.builder() .lookback(86400000L) .serviceName("service") .addAnnotation(Constants.ERROR) .addBinaryAnnotation(TraceKeys.HTTP_METHOD, "GET").build())) .containsExactly("service", "error", "http.method:GET"); }

Target:
public void annotationKeys() { assertThat(CassandraUtil.annotationKeys(QueryRequest.builder() .lookback(86400000L) .serviceName("service") .addAnnotation(Constants.ERROR) .addBinaryAnnotation(TraceKeys.HTTP_METHOD, "GET").build())) .containsExactly("error", "http.method:GET", "service"); }
Source:
public void testEquationXY() { final IterableInterval<DoubleType> image1 = ops.create().img(dimensions, new DoubleType()); ops.image().equation(image1, (x, y) -> 10 * (Math.cos(0.3 * x) + Math.sin( 0.3 * y))); assertEquals(ops.stats().sum(image1).getRealDouble(), 446.1755977585166, 0.001); final IterableInterval<IntType> image2 = ops.create().img(dimensions, new IntType()); ops.image().equation(image2, (x, y) -> Math.pow(x, 2) + Math.pow(y, 2)); assertEquals(ops.stats().sum(image2).getRealDouble(), 6.567e7, 0.001); final IterableInterval<FloatType> image3 = ops.create().img(dimensions, new FloatType()); ops.image().equation(image3, (x, y) -> Math.pow(start[0] + spacing[0] * x, 2) + Math.pow(start[1] + spacing[1] * y, 2)); assertEquals(6801.346801346799, ops.stats().sum(image3).getRealDouble(), 0.00001); }

Target:
public void testEquationXY() { final IterableInterval<DoubleType> image1 = ops.create().img(dimensions, new DoubleType()); ops.image().equation(image1, (x, y) -> 10 * (Math.cos(0.3 * x) + Math.sin( 0.3 * y))); assertEquals(ops.stats().sum(image1).getRealDouble(), 446.1755977585166, 0.001); final IterableInterval<IntType> image2 = ops.create().img(dimensions, new IntType()); ops.image().equation(image2, (x, y) -> Math.pow(x, 2) + Math.pow(y, 2)); assertEquals(ops.stats().sum(image2).getRealDouble(), 6.567e7, 0.001); final IterableInterval<FloatType> image3 = ops.create().img(dimensions, new FloatType()); DoubleBinaryOperator equation = (x, y) -> Math.pow(start[0] + spacing[0] * x, 2) + Math.pow(start[1] + spacing[1] * y, 2); ops.run(net.imagej.ops.image.equation.DefaultXYEquation.class, image3, equation); assertEquals(6801.346801346799, ops.stats().sum(image3).getRealDouble(), 0.00001); }
Source:
private void writeGetMethod(JavaWriter writer, ExecutableElement constructor, boolean disambiguateFields, boolean injectMembers, String strippedTypeName) throws IOException { writer.emitJavadoc(AdapterJavadocs.GET_METHOD, strippedTypeName); writer.emitAnnotation(Override.class); writer.beginMethod(strippedTypeName, "get", PUBLIC); StringBuilder newInstance = new StringBuilder(); newInstance.append(strippedTypeName).append(" result = new "); newInstance.append(strippedTypeName).append('('); boolean first = true; for (VariableElement parameter : constructor.getParameters()) { if (!first) newInstance.append(", "); else first = false; newInstance.append(createParameterName(disambiguateFields, parameter)).append(".get()"); } newInstance.append(')'); writer.emitStatement(newInstance.toString()); if (injectMembers) { writer.emitStatement("injectMembers(result)"); } writer.emitStatement("return result"); writer.endMethod(); writer.emitEmptyLine(); }

Target:
private void writeGetMethod(JavaWriter writer, ExecutableElement constructor, boolean disambiguateFields, boolean injectMembers, String strippedTypeName) throws IOException { writer.emitJavadoc(AdapterJavadocs.GET_METHOD, strippedTypeName); writer.emitAnnotation(Override.class); writer.beginMethod(strippedTypeName, "get", PUBLIC); StringBuilder newInstance = new StringBuilder(); newInstance.append(strippedTypeName).append(" result = new "); newInstance.append(strippedTypeName).append('('); boolean first = true; for (VariableElement parameter : constructor.getParameters()) { if (!first) newInstance.append(", "); else first = false; newInstance.append(parameterName(disambiguateFields, parameter)).append(".get()"); } newInstance.append(')'); writer.emitStatement(newInstance.toString()); if (injectMembers) { writer.emitStatement("injectMembers(result)"); } writer.emitStatement("return result"); writer.endMethod(); writer.emitEmptyLine(); }