auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean execute(MultiKeyMap<Integer, Triplet> slice, int leftBound, int rightBound, double mz) { double[] referenceEIC = new double[rightBound - leftBound + 1]; CurveTool.normalize(slice, leftBound, rightBound, (int) Math.round(mz * 10000), referenceEIC); BiGaussian objBiGaussian = new BiGaussian(slice, 140.1037, 1, 23); double[] bigaussianValues = new double[rightBound - leftBound + 1]; for (int i = 0; i < referenceEIC.length; i++) { bigaussianValues[i] = objBiGaussian.getValue(leftBound + i); } double[] normBigaussianValues = new double[rightBound - leftBound + 1]; CurveTool.normalize(bigaussianValues, normBigaussianValues); double similarityValue = CurveTool.similarityValue(referenceEIC, normBigaussianValues, leftBound, rightBound); final double peakSimilarityThreshold = 0.25; boolean goodPeak = similarityValue > peakSimilarityThreshold ? true : false; return goodPeak; }

Target:
public boolean execute(MultiKeyMap<Integer, Triplet> slice, int leftBound, int rightBound, double mz) { double[] referenceEIC = new double[rightBound - leftBound + 1]; CurveTool.normalize(slice, leftBound, rightBound, (int) Math.round(mz * 10000), referenceEIC); BiGaussian objBiGaussian = new BiGaussian(slice, mz, leftBound, rightBound); double[] bigaussianValues = IntStream.range(0, referenceEIC.length) .mapToDouble(i -> objBiGaussian.getValue(leftBound + i)).toArray(); double[] normBigaussianValues = new double[rightBound - leftBound + 1]; CurveTool.normalize(bigaussianValues, normBigaussianValues); double similarityValue = CurveTool.similarityValue(referenceEIC, normBigaussianValues, leftBound, rightBound); return similarityValue > PEAK_SIMILARITY_THRESHOLD; }
Source:
protected boolean requiresWaitForAngular(Method method) { String methodName = method.getName(); return !methodsNoWait.contains(methodName); }

Target:
protected boolean requiresWaitForAngular(Method method) { String methodName = method.getName(); return !METHODS_NO_WAIT.contains(methodName) && !hasNoWaitAnnotation(method); }
Source:
private void handleAppearanceColorListSelection() { ColorEntry selectedColor= getSelectedAppearanceColorOption(); RGB rgb= PreferenceConverter.getColor(fOverlayStore, selectedColor.currentColorKey); fAppearanceColorEditor.setColorValue(rgb); updateAppearanceColorWidgets(selectedColor.defaultColorKey); }

Target:
private void handleAppearanceColorListSelection() { ColorEntry selectedColor= getSelectedAppearanceColorOption(); RGB rgb= selectedColor.getRGB(false); fAppearanceColorEditor.setColorValue(rgb); updateAppearanceColorWidgets(selectedColor.isSystemDefaultKey); }
Source:
public Set<Organization> getStarredOrganizations(@ApiParam(hidden = true) @Auth User user) { User u = userDAO.findById(user.getId()); return u.getStarredOrganizations().stream().filter(element -> element instanceof Organization) .collect(Collectors.toCollection(LinkedHashSet::new)); }

Target:
public Set<Organization> getStarredOrganizations(@ApiParam(hidden = true) @Auth User user) { User u = userDAO.findById(user.getId()); return u.getStarredOrganizations(); }
Source:
public Response queryCaseByVariables(@Context HttpHeaders headers, String payload, @ApiParam(value = "optional pagination - at which page to start, defaults to 0 (meaning first)", required = false) @QueryParam("page") @DefaultValue("0") Integer page, @ApiParam(value = "optional pagination - size of the result, defaults to 10", required = false) @QueryParam("pageSize") @DefaultValue("10") Integer pageSize) { Header conversationIdHeader = buildConversationIdHeader("", context, headers); Variant v = getVariant(headers); try { String type = getContentType(headers); CaseInstanceCustomVarsList processVariableSummaryList = caseManagementRuntimeDataServiceBase.queryCasesByVariables(payload, type, new QueryContext(page * pageSize, pageSize)); logger.debug("Returning result of process instance search: {}", processVariableSummaryList); return createCorrectVariant(processVariableSummaryList, headers, Response.Status.OK, conversationIdHeader); } catch (Exception e) { logger.error("Unexpected error during processing {}", e.getMessage(), e); return internalServerError(errorMessage(e), v, conversationIdHeader); } }

Target:
public Response queryCaseByVariables(@Context HttpHeaders headers, String payload, @ApiParam(value = "optional pagination - at which page to start, defaults to 0 (meaning first)", required = false) @QueryParam("page") @DefaultValue("0") Integer page, @ApiParam(value = "optional pagination - size of the result, defaults to 10", required = false) @QueryParam("pageSize") @DefaultValue("10") Integer pageSize) { Header conversationIdHeader = buildConversationIdHeader("", context, headers); Variant v = getVariant(headers); try { String type = getContentType(headers); CaseInstanceCustomVarsList processVariableSummaryList = caseManagementRuntimeDataServiceBase.queryCasesByVariables(payload, type, new QueryContext(page * pageSize, pageSize)); logger.debug("Returning result of case instance search: {}", processVariableSummaryList); return createCorrectVariant(processVariableSummaryList, headers, Response.Status.OK, conversationIdHeader); } catch (Exception e) { logger.error("Unexpected error during processing {}", e.getMessage(), e); return internalServerError(errorMessage(e), v, conversationIdHeader); } }
Source:
private Group nextRowInternal() throws IOException, TranslatorException { while (rowIterator != null) { if (pageRowCount-- <= 0) { this.rowIterator = null; PageReadStore nextRowGroup = this.reader.readNextRowGroup(); if(nextRowGroup == null){ VirtualFile nextParquetFile = getNextParquetFile(); if (nextParquetFile == null) { return null; } this.rowIterator = readParquetFile(nextParquetFile); continue; } else{ this.pageRowCount = nextRowGroup.getRowCount(); this.rowIterator = columnIO.getRecordReader(nextRowGroup, new GroupRecordConverter(filteredSchema)); } } return rowIterator.read(); } return null; }

Target:
private Group nextRowInternal() throws IOException, TranslatorException { while (rowIterator != null) { if (pageRowCount-- <= 0) { this.rowIterator = null; PageReadStore nextRowGroup = this.reader.readNextRowGroup(); if(nextRowGroup == null){ VirtualFile nextParquetFile = getNextParquetFile(); if (nextParquetFile == null) { return null; } this.rowIterator = readParquetFile(nextParquetFile); continue; } this.pageRowCount = nextRowGroup.getRowCount(); this.rowIterator = columnIO.getRecordReader(nextRowGroup, new GroupRecordConverter(filteredSchema)); } Group presentRow = rowIterator.read(); if(presentRow == null){ return nextRowInternal(); } return presentRow; } return null; }
Source:
public void testLiveEventListGet() throws Exception { Client client = getLiveClient(); Request<ScopedList<Event>> request = new Event.ListRequestBuilder().build(); ScopedList<Event> events = client.sendRequest(request, new TypeReference<ScopedList<Event>>() { }); assertEquals(20, events.getLimit()); assertEquals(114, events.getTotal()); Event event = events.getData().get(0); assertNotNull(event); }

Target:
public void testLiveEventListGet() throws Exception { Request<ScopedList<Event>> request = new Event.ListRequestBuilder().build(); ScopedList<Event> events = client.sendRequest(request, new TypeReference<ScopedList<Event>>() { }); assertEquals(20, events.getLimit()); assertEquals(114, events.getTotal()); Event event = events.getData().get(0); assertNotNull(event); }
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); genderOptionsList = new ArrayList<>(); clientClassificationList = new ArrayList<>(); clientTypeList = new ArrayList<>(); officeList = new ArrayList<>(); staffList = new ArrayList<>(); Bundle bundle = this.getArguments(); if (bundle != null) { int groupId = getArguments().getInt("groupId"); mGroupId = groupId; } }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); genderOptionsList = new ArrayList<>(); clientClassificationList = new ArrayList<>(); clientTypeList = new ArrayList<>(); officeList = new ArrayList<>(); staffList = new ArrayList<>(); Bundle bundle = this.getArguments(); if (bundle != null) { mGroupId = getArguments().getInt("groupId"); } }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } URL url = (URL) o; if (port != url.port) { return false; } if (secure != url.secure) { return false; } if (!domain.equals(url.domain)) { return false; } if (!host.equals(url.host)) { return false; } return path.equals(url.path); }

Target:
public boolean equals(Object o) { if (o instanceof URL) { URL other = (URL) o; return domain.equals(other.domain) && host.equals(other.host) && path.equals(other.path) && port == other.port && secure == other.secure; } return false; }
Source:
public ErrorLogBean() { try { dropdowns = service.getDropdowns(); } catch (Exception ex) { LOG.error("Error calling service.dropdowns: {}", ex.getMessage(), ex); HelperUtil.addMessageError(null, SERVICE_ERROR); } }

Target:
public ErrorLogBean() { dropdowns = service.getDropdowns(); }
Source:
private boolean shouldReplayEvent(FileStatus dir, DumpType dumpType) throws SemanticException { if (dbNameOrPattern == null || dbNameOrPattern.isEmpty()) { return true; } else if ((tblNameOrPattern == null) || (tblNameOrPattern.isEmpty())) { Database database; try { database = Hive.get().getDatabase(dbNameOrPattern); } catch (HiveException e) { LOG.info("failed to get the database " + dbNameOrPattern); return true; } String replLastId; Map<String, String> params = database.getParameters(); if (params != null && (params.containsKey(ReplicationSpec.KEY.CURR_STATE_ID.toString()))) { replLastId = params.get(ReplicationSpec.KEY.CURR_STATE_ID.toString()); if (Long.parseLong(replLastId) >= Long.parseLong(dir.getPath().getName())) { LOG.debug("Event " + dumpType + " with replId " + Long.parseLong(dir.getPath().getName()) + " is already replayed. LastReplId - " + Long.parseLong(replLastId)); return false; } } } else { Table tbl; try { tbl = Hive.get().getTable(dbNameOrPattern, tblNameOrPattern); } catch (HiveException e) { LOG.info("failed to get the table " + dbNameOrPattern + "." + tblNameOrPattern); return true; } if (tbl != null) { Map<String, String> params = tbl.getParameters(); if (params != null && (params.containsKey(ReplicationSpec.KEY.CURR_STATE_ID.toString()))) { String replLastId = params.get(ReplicationSpec.KEY.CURR_STATE_ID.toString()); if (Long.parseLong(replLastId) >= Long.parseLong(dir.getPath().getName())) { LOG.debug("Event " + dumpType + " with replId " + Long.parseLong(dir.getPath().getName()) + " is already replayed. LastReplId - " + Long.parseLong(replLastId)); return false; } } } } return true; }

Target:
private boolean shouldReplayEvent(FileStatus dir, DumpType dumpType) throws SemanticException { if (dbNameOrPattern == null || dbNameOrPattern.isEmpty()) { return true; } else if ((tblNameOrPattern == null) || (tblNameOrPattern.isEmpty())) { Database database; try { database = Hive.get().getDatabase(dbNameOrPattern); return isEventNotReplayed(database.getParameters(), dir, dumpType); } catch (HiveException e) { LOG.debug("failed to get the database " + dbNameOrPattern); return true; } } else { Table tbl; try { tbl = Hive.get().getTable(dbNameOrPattern, tblNameOrPattern); return isEventNotReplayed(tbl.getParameters(), dir, dumpType); } catch (HiveException e) { LOG.debug("failed to get the table " + dbNameOrPattern + "." + tblNameOrPattern); return true; } } }
Source:
public Parser<String, Object> makeParser() { if (firstRowIsHeader) { return new CSVParser(Optional.fromNullable(listDelimiter), columns, firstRowIsHeader); } else { return new CSVParser(Optional.fromNullable(listDelimiter), columns); } }

Target:
public Parser<String, Object> makeParser() { return new CSVParser(Optional.fromNullable(listDelimiter), columns, hasHeaderRow); }
Source:
public String getLabel(Object object) { return "" + object; }

Target:
public String getLabel(Object object) { return object.toString(); }
Source:
public View getView(int position, View convertView, ViewGroup parent) { HierarchyElementView hev; if (convertView == null) { hev = new HierarchyElementView(mContext, mItems.get(position)); } else { hev = (HierarchyElementView)convertView; HierarchyElement entry = mItems.get(position); hev.setPrimaryText(entry.getPrimaryText(), entry.getTextColor()); hev.setSecondaryText(entry.getSecondaryText(), entry.getTextColor()); hev.setIcon(entry.getIcon()); hev.setColor(entry.getBgColor()); } if (mItems.get(position).getSecondaryText() == null || mItems.get(position).getSecondaryText().equals("")) { hev.showSecondary(false); } else { hev.showSecondary(true); } return hev; }

Target:
public View getView(int position, View convertView, ViewGroup parent) { HierarchyElementView hev; if (convertView == null) { hev = new HierarchyElementView(mContext, mItems.get(position)); } else { hev = (HierarchyElementView)convertView; HierarchyElement entry = mItems.get(position); hev.setFromHierarchyElement(entry); } if (mItems.get(position).getSecondaryText() == null || mItems.get(position).getSecondaryText().equals("")) { hev.showSecondary(false); } else { hev.showSecondary(true); } return hev; }
Source:
private static String getAccessLevelValue(Object value) { String retentionValue = null; if (value instanceof Tree) { Tree tree = (Tree) value; if (tree.is(Tree.Kind.MEMBER_SELECT)) { retentionValue = ((MemberSelectExpressionTree) tree).identifier().name(); } else if (tree.is(Tree.Kind.IDENTIFIER)) { retentionValue = ((IdentifierTree) tree).name(); } } else if (value instanceof Symbol.VariableSymbol) { retentionValue = ((Symbol.VariableSymbol) value).name(); } return retentionValue; }

Target:
private static String getAccessLevelValue(Object value) { if (value instanceof Tree) { Tree tree = (Tree) value; if (tree.is(Tree.Kind.MEMBER_SELECT)) { return ((MemberSelectExpressionTree) tree).identifier().name(); } else if (tree.is(Tree.Kind.IDENTIFIER)) { return ((IdentifierTree) tree).name(); } } else if (value instanceof Symbol.VariableSymbol) { return ((Symbol.VariableSymbol) value).name(); } return null; }
Source:
public IPath replacePath(IPath path, int index, String newValue) { final String[] segmentsNode = path.segments(); segmentsNode[index - 1] = newValue; String renamedPath = ""; for (final String segmentNode : segmentsNode) { renamedPath += segmentNode; renamedPath += NAME_DEFAULT_VARIABLES_GROUP; } return new Path(renamedPath); }

Target:
public IPath replacePath(IPath path, int index, String newValue) { final String[] segmentsNode = path.segments(); segmentsNode[index - 1] = newValue; String renamedPath = ""; for (final String segmentNode : segmentsNode) { renamedPath += segmentNode; renamedPath += Path.ROOT.toString(); } return new Path(renamedPath); }
Source:
public Concept getNonCodedDrugConcept() { String conceptUuid = Context.getAdministrationService().getGlobalProperty(OpenmrsConstants.GP_DRUG_NON_CODED_CONCEPT_UUID); return Context.getConceptService().getConceptByUuid(conceptUuid); }

Target:
public Concept getNonCodedDrugConcept() { String conceptUuid = Context.getAdministrationService().getGlobalProperty(OpenmrsConstants.GP_DRUG_ORDER_DRUG_OTHER); if(org.apache.commons.lang.StringUtils.isNotBlank(conceptUuid)){ return Context.getConceptService().getConceptByUuid(conceptUuid); } return null; }
Source:
private void addRouteDefinitions(List<RouteDefinition> routeDefinitions) { try { camelContext.addRouteDefinitions(routeDefinitions); } catch (Exception e) { throw new RuntimeException(e); } }

Target:
private void addRouteDefinitions(List<RouteDefinition> routeDefinitions) { try { camelContext.addRouteDefinitions(routeDefinitions); } catch (Exception e) { throw new RuntimeCamelException(e); } }
Source:
public void testRemoveColumnsWithTooManyZeros(final ReadCountCollection readCount) { final RealMatrix counts = readCount.counts(); final int[] numberOfZeros = IntStream.range(0, counts.getColumnDimension()) .map(i -> (int) DoubleStream.of(counts.getColumn(i)).filter(d -> d == 0.0).count()).toArray(); final int maximumNumberOfZeros = IntStream.of(numberOfZeros).max().getAsInt(); for (int maxZeros = 0; maxZeros < maximumNumberOfZeros; maxZeros++) { final int maxZerosThres = maxZeros; final int expectedRemainingCount = (int) IntStream.of(numberOfZeros).filter(i -> i <= maxZerosThres).count(); if (expectedRemainingCount == 0) { try { CreatePanelOfNormals.removeColumnsWithTooManyZeros(readCount, maxZeros, NULL_LOGGER); } catch (final UserException.BadInput ex) { continue; } Assert.fail("expects an exception"); } final ReadCountCollection rc = CreatePanelOfNormals.removeColumnsWithTooManyZeros(readCount, maxZeros, NULL_LOGGER); Assert.assertEquals(rc.columnNames().size(), expectedRemainingCount); final int[] newIndeces = new int[expectedRemainingCount]; int nextIndex = 0; for (int i = 0; i < readCount.columnNames().size(); i++) { final String name = readCount.columnNames().get(i); final int newIndex = rc.columnNames().indexOf(name); if (numberOfZeros[i] <= maxZeros) { Assert.assertTrue(newIndex >= 0); newIndeces[nextIndex++] = i; } else { Assert.assertEquals(newIndex, -1); } } Assert.assertEquals(nextIndex, expectedRemainingCount); for (int i = 1; i < newIndeces.length; i++) { Assert.assertTrue(newIndeces[i - 1] < newIndeces[i]); } } }

Target:
public void testRemoveColumnsWithTooManyZeros(final ReadCountCollection readCount) { final RealMatrix counts = readCount.counts(); final int[] numberOfZeros = IntStream.range(0, counts.getColumnDimension()) .map(i -> (int) DoubleStream.of(counts.getColumn(i)).filter(d -> d == 0.0).count()).toArray(); final int maximumNumberOfZeros = IntStream.of(numberOfZeros).max().getAsInt(); for (int maxZeros = 0; maxZeros < maximumNumberOfZeros; maxZeros++) { final int maxZerosThres = maxZeros; final int expectedRemainingCount = (int) IntStream.of(numberOfZeros).filter(i -> i <= maxZerosThres).count(); if (expectedRemainingCount == 0) { try { CreatePanelOfNormals.removeColumnsWithTooManyZeros(readCount, maxZeros, NULL_LOGGER); } catch (final UserException.BadInput ex) { continue; } Assert.fail("expects an exception"); } final ReadCountCollection rc = CreatePanelOfNormals.removeColumnsWithTooManyZeros(readCount, maxZeros, NULL_LOGGER); Assert.assertEquals(rc.columnNames().size(), expectedRemainingCount); final int[] newIndices = new int[expectedRemainingCount]; int nextIndex = 0; for (int i = 0; i < readCount.columnNames().size(); i++) { final String name = readCount.columnNames().get(i); final int newIndex = rc.columnNames().indexOf(name); if (numberOfZeros[i] <= maxZeros) { Assert.assertTrue(newIndex >= 0); newIndices[nextIndex++] = i; } else { Assert.assertEquals(newIndex, -1); } } Assert.assertEquals(nextIndex, expectedRemainingCount); for (int i = 1; i < newIndices.length; i++) { Assert.assertTrue(newIndices[i - 1] < newIndices[i]); } } }
Source:
public long nextLong() { TokenResponse token = rt.getSequencerView().nextOrderedGuid(); return (token.getEpoch() & MAX_EPOCH) << SHIFT_EPOCH | (token.getSequence() & MAX_SEQUENCE); }

Target:
public long nextLong() { long currentTimestamp = getCorrectedTimestamp(); return (currentTimestamp << TIMESTAMP_SHIFT) | ((instanceId & MAX_INSTANCE_ID) << INSTANCE_ID_SHIFT) | (timestampCorrection & MAX_TIMESTAMP_CORRECTION); }
Source:
public int getVersion() { return 3; }

Target:
public int getVersion() { return VERSION_NUMBER; }
Source:
private ApiResultWrapper sisUploadCall(String csvFileContent){ String url = Utils.urlConstructor("/accounts/1/sis_imports?batch_mode=0&override_sis_stickiness=0&extension=csv"); HttpPost post = new HttpPost(url); post.setEntity(new StringEntity(csvFileContent, ContentType.create(Utils.CONSTANT_MIME_TEXT_CSV, "UTF-8"))); ApiResultWrapper arw = Utils.makeApiCall(post); M_log.debug("API response: "+arw.getApiResp()); return arw; }

Target:
private ApiResultWrapper sisUploadCall(String csvFileContent){ String url = Utils.urlConstructor(Utils.URL_CHUNK_ACCOUNTS_1_SIS_IMPORTS+Utils.URL_CHUNK_SIS_IMPORT_WITH_BATCH_MODE_STICKINESS_DISABLED); HttpPost post = new HttpPost(url); post.setEntity(new StringEntity(csvFileContent, ContentType.create(Utils.CONSTANT_MIME_TEXT_CSV, "UTF-8"))); ApiResultWrapper arw = Utils.makeApiCall(post); M_log.debug("API response: "+arw.getApiResp()); return arw; }
Source:
public void handleInspectAddressesRequest(RequestMsg req, ChannelHandlerContext ctx, IServerRouter r) { final List<Long> addresses = req.getPayload().getInspectAddressesRequest().getAddressList(); List<Long> emptyAddresses = new ArrayList<>(); if (log.isTraceEnabled()) { log.trace("handleInspectAddressesRequest[{}]: " + "addresses {}", req.getHeader().getRequestId(), addresses); } for (long address : addresses) { try { if (!streamLog.contains(address)) emptyAddresses.add(address); } catch (TrimmedException te) { r.sendResponse(getResponseMsg(req.getHeader(), getTrimmedErrorMsg()), ctx); return; } catch (DataCorruptionException dce) { r.sendResponse(getResponseMsg(req.getHeader(), getDataCorruptionErrorMsg(address)), ctx); return; } } r.sendResponse(getResponseMsg(req.getHeader(), getInspectAddressesResponseMsg(emptyAddresses)), ctx); }

Target:
public void handleInspectAddressesRequest(RequestMsg req, ChannelHandlerContext ctx, IServerRouter r) { final List<Long> addresses = req.getPayload().getInspectAddressesRequest().getAddressList(); List<Long> emptyAddresses = new ArrayList<>(); if (log.isTraceEnabled()) { log.trace("handleInspectAddressesRequest[{}]: " + "addresses {}", req.getHeader().getRequestId(), addresses); } for (long address : addresses) { try { if (!streamLog.contains(address)) { emptyAddresses.add(address); } } catch (TrimmedException te) { r.sendResponse(getResponseMsg(req.getHeader(), getTrimmedErrorMsg()), ctx); return; } catch (DataCorruptionException dce) { r.sendResponse(getResponseMsg(req.getHeader(), getDataCorruptionErrorMsg(address)), ctx); return; } } r.sendResponse(getResponseMsg(req.getHeader(), getInspectAddressesResponseMsg(emptyAddresses)), ctx); }
Source:
private static void logClientInitWarning() { DebugLogger.INSTANCE.w("It appears that Bugsnag.init() was called more than once. " + "Subsequent calls have no effect, but may indicate that Bugsnag is not integrated in " + "an Application subclass, which can lead to undesired behaviour."); }

Target:
private static void logClientInitWarning() { getClient().logger.w("It appears that Bugsnag.init() was called more than once. " + "Subsequent calls have no effect, but may indicate that Bugsnag is not integrated in" + " an Application subclass, which can lead to undesired behaviour."); }
Source:
public void deleteUsers(List<User> users) { EKBCommit commit = getEKBCommit(); preparePersistenceAccess(); for (User user : users) { List<User> result = queryService.queryByString(User.class, "username:\"" + user.getUsername() + "\""); if (result.size() == 0) { LOGGER.warn("User {1} does not exist.", user.getUsername()); } else { commit.addDelete(user); } } persistService.commit(commit); revokePersistenceAccess(); }

Target:
public void deleteUsers(List<User> users) { EKBCommit commit = getEKBCommit(); preparePersistenceAccess(); for (User user : users) { List<User> result = queryService.query(User.class, QueryRequest.query("username", user.getUsername())); if (result.size() == 0) { LOGGER.warn("User {1} does not exist.", user.getUsername()); } else { commit.addDelete(user); } } persistService.commit(commit); revokePersistenceAccess(); }
Source:
public static Map<String, ValueType> rowSignatureFor(final GroupByQuery query) { final ImmutableMap.Builder<String, ValueType> types = ImmutableMap.builder(); for (DimensionSpec dimensionSpec : query.getDimensions()) { types.put(dimensionSpec.getOutputName(), dimensionSpec.getOutputType()); } for (AggregatorFactory aggregatorFactory : query.getAggregatorSpecs()) { final String typeName = aggregatorFactory.getTypeName(); final ValueType valueType = GuavaUtils.getEnumIfPresent( ValueType.class, typeName == null ? null : StringUtils.toUpperCase(typeName) ); if (valueType != null) { types.put(aggregatorFactory.getName(), valueType); } } return types.build(); }

Target:
public static Map<String, ValueType> rowSignatureFor(final GroupByQuery query) { final ImmutableMap.Builder<String, ValueType> types = ImmutableMap.builder(); for (DimensionSpec dimensionSpec : query.getDimensions()) { types.put(dimensionSpec.getOutputName(), dimensionSpec.getOutputType()); } for (AggregatorFactory aggregatorFactory : query.getAggregatorSpecs()) { final String typeName = aggregatorFactory.getTypeName(); final ValueType valueType; if (typeName != null) { valueType = GuavaUtils.getEnumIfPresent(ValueType.class, StringUtils.toUpperCase(typeName)); } else { valueType = null; } if (valueType != null) { types.put(aggregatorFactory.getName(), valueType); } } return types.build(); }
Source:
public void pause(boolean persist) throws Exception { if (AuditLogger.isEnabled()) { AuditLogger.pause(addressInfo); } checkStarted(); clearIO(); try { if (!addressInfo.isPaused()) { addressInfo.pause(); if (persist) { server.getStorageManager().storeAddressStatus(addressInfo.getId(), AddressStatus.PAUSED); } Bindings bindings = server.getPostOffice().lookupBindingsForAddress(addressInfo.getName()); if (bindings != null) { for (Binding binding : bindings.getBindings()) { if (binding instanceof QueueBinding) { QueueControl coreQueueControl = (QueueControl) managementService.getResource(ResourceNames.QUEUE + binding.getUniqueName().toString()); if (coreQueueControl != null) { coreQueueControl.pause(); } } } } } } finally { blockOnIO(); } }

Target:
public void pause(boolean persist) { if (AuditLogger.isEnabled()) { AuditLogger.pause(addressInfo); } checkStarted(); clearIO(); try { addressInfo.setPostOffice(server.getPostOffice()); addressInfo.setStorageManager(server.getStorageManager()); addressInfo.pause(persist); } finally { blockOnIO(); } }
Source:
public void testSomethingByIterableHandleNullWithEmptyList() { final SomethingByIterableHandleNull s = handle.attach(SomethingByIterableHandleNull.class); final List<Something> out = s.get(new ArrayList<Object>()); Assert.assertEquals(4, out.size()); }

Target:
public void testSomethingByIterableHandleNullWithEmptyList() { final SomethingByIterableHandleNull s = handle.attach(SomethingByIterableHandleNull.class); final List<Something> out = s.get(new ArrayList<Object>()); Assert.assertEquals(0, out.size()); }
Source:
public void afterRefreshTreatment() { try { if (processHardwareCapsNeeded) { monitoringStrategy.processHardwareCapabilities(vds); markIsSetNonOperationalExecuted(); } if (refreshedCapabilities) { getVdsEventListener().handleVdsVersion(vds.getId()); markIsSetNonOperationalExecuted(); } if (vdsMaintenanceTimeoutOccurred) { handleVdsMaintenanceTimeout(); } if (vds.getStatus() == VDSStatus.Maintenance) { try { getVdsEventListener().vdsMovedToMaintenance(vds); } catch (RuntimeException ex) { log.error("Host encounter a problem moving to maintenance mode, probably error during " + "disconnecting it from pool. The Host will stay in Maintenance: {}", ex.getMessage()); log.debug("Exception", ex); } } else if (vds.getStatus() == VDSStatus.NonOperational && firstStatus != VDSStatus.NonOperational) { if (!vdsManager.isSetNonOperationalExecuted()) { getVdsEventListener().vdsNonOperational(vds.getId(), vds.getNonOperationalReason(), true, Guid.Empty); } else { log.info("Host '{}'({}) is already in NonOperational status for reason '{}'. SetNonOperationalVds command is skipped.", vds.getName(), vds.getId(), (vds.getNonOperationalReason() != null) ? vds.getNonOperationalReason().name() : "unknown"); } } } catch (IRSErrorException ex) { logFailureMessage("Could not finish afterRefreshTreatment", ex); log.debug("Exception", ex); } catch (RuntimeException ex) { logFailureMessage("Could not finish afterRefreshTreatment", ex); log.error("Exception", ex); } }

Target:
public void afterRefreshTreatment() { try { if (processHardwareCapsNeeded) { monitoringStrategy.processHardwareCapabilities(vds); markIsSetNonOperationalExecuted(); } if (refreshedCapabilities) { getVdsEventListener().handleVdsVersion(vds.getId()); markIsSetNonOperationalExecuted(); } if (vdsMaintenanceTimeoutOccurred) { handleVdsMaintenanceTimeout(); } if (vds.getStatus() == VDSStatus.Maintenance) { try { getVdsEventListener().vdsMovedToMaintenance(vds); } catch (RuntimeException ex) { log.error("Host encounter a problem moving to maintenance mode, probably error during " + "disconnecting it from pool. The Host will stay in Maintenance: {}", ex.getMessage()); log.debug("Exception", ex); } } else if (vds.getStatus() == VDSStatus.NonOperational && firstStatus != VDSStatus.NonOperational) { if (!vdsManager.isSetNonOperationalExecuted()) { getVdsEventListener().vdsNonOperational(vds.getId(), vds.getNonOperationalReason(), true, Guid.Empty); } else { log.info("Host '{}'({}) is already in NonOperational status for reason '{}'. SetNonOperationalVds command is skipped.", vds.getName(), vds.getId(), (vds.getNonOperationalReason() != null) ? vds.getNonOperationalReason().name() : "unknown"); } } } catch (RuntimeException ex) { logFailureMessage("Could not finish afterRefreshTreatment", ex); log.debug("Exception", ex); } }
Source:
public void placeRadiologyOrder_shouldCreateRadiologyOrderEncounter() throws Exception { RadiologyOrder radiologyOrder = getUnsavedRadiologyOrder(); EncounterSearchCriteriaBuilder encounterSearchCriteria = new EncounterSearchCriteriaBuilder().setPatient(radiologyOrder.getPatient()); List<Encounter> matchingEncounters = encounterService.getEncounters(encounterSearchCriteria.createEncounterSearchCriteria()); assertThat(matchingEncounters, is(empty())); assertThat(radiologyOrder.getEncounter(), is(nullValue())); radiologyOrder = radiologyOrderService.placeRadiologyOrder(radiologyOrder); assertThat(radiologyOrder.getEncounter(), is(not(nullValue()))); encounterSearchCriteria = new EncounterSearchCriteriaBuilder().setPatient(radiologyOrder.getPatient()) .setProviders(Arrays.asList(radiologyOrder.getOrderer())); matchingEncounters = encounterService.getEncounters(encounterSearchCriteria.createEncounterSearchCriteria()); assertThat(matchingEncounters, hasItem(radiologyOrder.getEncounter())); assertThat(matchingEncounters.size(), is(1)); }

Target:
public void placeRadiologyOrder_shouldCreateRadiologyOrderEncounter() throws Exception { RadiologyOrder radiologyOrder = getUnsavedRadiologyOrder(); EncounterSearchCriteriaBuilder encounterSearchCriteria = new EncounterSearchCriteriaBuilder().setPatient(radiologyOrder.getPatient()) .setProviders(Arrays.asList(radiologyOrder.getOrderer())); List<Encounter> matchingEncounters = encounterService.getEncounters(encounterSearchCriteria.createEncounterSearchCriteria()); assertThat(matchingEncounters, is(empty())); assertThat(radiologyOrder.getEncounter(), is(nullValue())); radiologyOrder = radiologyOrderService.placeRadiologyOrder(radiologyOrder); assertThat(radiologyOrder.getEncounter(), is(not(nullValue()))); matchingEncounters = encounterService.getEncounters(encounterSearchCriteria.createEncounterSearchCriteria()); assertThat(matchingEncounters, hasItem(radiologyOrder.getEncounter())); assertThat(matchingEncounters.size(), is(1)); }
Source:
public void writeTo(Path directory) throws IOException { checkArgument(Files.notExists(directory) || Files.isDirectory(directory), "path %s exists but is not a directory.", directory); Path outputDirectory = directory; if (!packageName.isEmpty()) { for (String packageComponent : packageName.split("\\.")) { outputDirectory = outputDirectory.resolve(packageComponent); } Files.createDirectories(outputDirectory); } TypeSpec firstTypeSpec = typeSpecs.get(0); Path outputPath = outputDirectory.resolve(firstTypeSpec.name + ".java"); try (Writer writer = new OutputStreamWriter(Files.newOutputStream(outputPath), UTF_8)) { writeTo(writer); } }

Target:
public void writeTo(Path directory) throws IOException { checkArgument(Files.notExists(directory) || Files.isDirectory(directory), "path %s exists but is not a directory.", directory); Path outputDirectory = directory; if (!packageName.isEmpty()) { for (String packageComponent : packageName.split("\\.")) { outputDirectory = outputDirectory.resolve(packageComponent); } Files.createDirectories(outputDirectory); } Path outputPath = outputDirectory.resolve(typeSpec.name + ".java"); try (Writer writer = new OutputStreamWriter(Files.newOutputStream(outputPath), UTF_8)) { writeTo(writer); } }
Source:
static boolean CanTrack() { try { FirebaseAnalyticsClass = Class.forName("com.google.firebase.analytics.FirebaseAnalytics"); return true; } catch (ClassNotFoundException t) { return false; } }

Target:
static boolean CanTrack() { try { FirebaseAnalyticsClass = Class.forName("com.google.firebase.analytics.FirebaseAnalytics"); return true; } catch (ClassNotFoundException e) { return false; } }
Source:
public static List<BaseEdit> fromEditList(List<Edit> edits) { ArrayList<BaseEdit> gwtOrmEdits = new ArrayList<BaseEdit>(edits.size()); for (Edit e : edits) { gwtOrmEdits.add(fromEdit(e)); } return Collections.unmodifiableList(gwtOrmEdits); }

Target:
public static List<BaseEdit> fromEditList(List<Edit> edits) { ArrayList<BaseEdit> out = new ArrayList<BaseEdit>(edits.size()); for (Edit e : edits) { out.add(fromEdit(e)); } return Collections.unmodifiableList(out); }
Source:
public synchronized ICleanUp[] createCleanUps(Set<String> ids) { ensureCleanUpsRegistered(); ArrayList<ICleanUp> result= new ArrayList<>(fCleanUpDescriptors.length); for (CleanUpDescriptor fCleanUpDescriptor : fCleanUpDescriptors) { if (ids == null || ids.contains(fCleanUpDescriptor.getId())) { ICleanUp cleanUp= fCleanUpDescriptor.createCleanUp(); if (cleanUp != null) result.add(cleanUp); } } return result.toArray(new ICleanUp[result.size()]); }

Target:
public synchronized ICleanUp[] createCleanUps(Set<String> ids) { ensureCleanUpsRegistered(); ArrayList<ICleanUp> result= new ArrayList<>(fCleanUpDescriptors.length); for (CleanUpDescriptor descriptor : fCleanUpDescriptors) { if (ids == null || ids.contains(descriptor.getId())) { ICleanUp cleanUp= descriptor.createCleanUp(); if (cleanUp != null) result.add(cleanUp); } } return result.toArray(new ICleanUp[result.size()]); }
Source:
public THIS validate() { if (serverId == null) { throw new IllegalArgumentException("Server id has to be set!"); } return (THIS) this; }

Target:
protected void validate() { if (serverId == null) { throw new IllegalArgumentException("Server id has to be set!"); } }
Source:
public VoidResult call() throws NoSuchProjectException, OrmException, SecurityException, IOException { final ProjectControl projectControl = projectControlFactory.controlFor(projectName); if (user.isAdministrator() || projectControl.isOwner()) { repoManager.deleteRepository(projectName.get()); for (final RefRight k : db.refRights().byProject(projectName)) { db.refRights().delete(Collections.singleton(k)); } for (final AccountProjectWatch a : db.accountProjectWatches().byProject( projectName)) { db.accountProjectWatches().delete(Collections.singleton(a)); } for (final Project j : db.projects().getChildren(projectName.get())) { j.setParent(null); db.projects().update(Collections.singleton(j)); projectCache.evict(j); } db.projects().deleteKeys(Collections.singleton(projectName)); replication.replicateProjectDeletion(projectName); projectCache.evict(projectControl.getProject()); } return VoidResult.INSTANCE; }

Target:
public List<NameKey> call() { final List<NameKey> failedProjects = new ArrayList<NameKey>(); for (NameKey p : projectsList) { try { final ProjectControl projectControl = projectControlFactory.controlFor(p); if (projectControl.isOwner()) { final Repository r = repoManager.openRepository(p.get()); Map<String, Ref> refs; refs = r.getAllRefs(); r.close(); if (refs.isEmpty()) { repoManager.deleteRepository(p.get()); for (final Project c : db.projects().getChildren(p.get())) { c.setParent(projectControl.getProject().getParent()); db.projects().update(Collections.singleton(c)); projectCache.evict(c); } db.refRights().delete(db.refRights().byProject(p)); db.accountProjectWatches().delete( db.accountProjectWatches().byProject(p)); db.projects().deleteKeys(Collections.singleton(p)); replication.replicateProjectDeletion(p); projectCache.evict(projectControl.getProject()); } else { failedProjects.add(p); log.error(p.get() + " is not empty."); } } else { failedProjects.add(p); log.error("User has no rights to delete " + p.get()); } } catch (RepositoryNotFoundException e) { failedProjects.add(p); log.error("Repository " + p.get() + " was not found"); } catch (IOException e) { failedProjects.add(p); log.error(e.getMessage()); } catch (SecurityException e) { failedProjects.add(p); log.error(p.get() + " repository deletion is not allowed.", e); } catch (OrmException e) { failedProjects.add(p); log.error("Could not update/delete " + p.get() + "from database.", e); } catch (NoSuchProjectException e) { failedProjects.add(p); log.error("Project " + p.get() + " was not found."); } } return failedProjects; }
Source:
private void doRemoteHostXml(String hostXmlFile) throws Exception { KernelServices kernelServices = createKernelServicesBuilder(TestModelType.HOST) .setXmlResource(hostXmlFile) .setModelInitializer(MODEL_SANITIZER, new ModelWriteSanitizer() { @Override public ModelNode sanitize(ModelNode model) { return model; } }) .build(); Assert.assertTrue(kernelServices.isSuccessfulBoot()); String xml = kernelServices.getPersistedSubsystemXml(); ModelTestUtils.compareXml(ModelTestUtils.readResource(this.getClass(), hostXmlFile), xml); ModelTestUtils.validateModelDescriptions(PathAddress.EMPTY_ADDRESS, kernelServices.getRootRegistration()); }

Target:
private void doRemoteHostXml(String hostXmlFile) throws Exception { KernelServices kernelServices = createKernelServicesBuilder(TestModelType.HOST) .setXmlResource(hostXmlFile) .setModelInitializer(MODEL_SANITIZER, null) .build(); Assert.assertTrue(kernelServices.isSuccessfulBoot()); String xml = kernelServices.getPersistedSubsystemXml(); ModelTestUtils.compareXml(ModelTestUtils.readResource(this.getClass(), hostXmlFile), xml); ModelTestUtils.validateModelDescriptions(PathAddress.EMPTY_ADDRESS, kernelServices.getRootRegistration()); }
Source:
private Path getPreviousDumpMetadataPath(Path dumpRoot) throws IOException { FileSystem fs = dumpRoot.getFileSystem(conf); if (fs.exists(dumpRoot)) { FileStatus[] statuses = fs.listStatus(dumpRoot); if (statuses.length == 1) { return statuses[0].getPath(); } } return null; }

Target:
private Path getPreviousDumpMetadataPath(Path dumpRoot) throws IOException { FileSystem fs = dumpRoot.getFileSystem(conf); if (fs.exists(dumpRoot)) { FileStatus[] statuses = fs.listStatus(dumpRoot); if (statuses.length > 0) { FileStatus latestUpdatedStatus = statuses[0]; for (FileStatus status : statuses) { if (status.getModificationTime() > latestUpdatedStatus.getModificationTime()) { latestUpdatedStatus = status; } } return latestUpdatedStatus.getPath(); } } return null; }
Source:
private String getGuidList(String editedList) { StringBuilder guidList = new StringBuilder(); boolean first = true; Matcher idMatch = idPattern.matcher(editedList); while (idMatch.find()) { first = false; String artId = editedList.substring(idMatch.start() + 1, idMatch.end() - 1); Artifact checkArtifactFromId = ArtifactQuery.checkArtifactFromId(ArtifactId.valueOf(artId), attributeConflict.getSourceBranch(), DeletionFlag.INCLUDE_DELETED); if (checkArtifactFromId.isInvalid()) { Artifact art = ArtifactQuery.getArtifactFromId(ArtifactId.valueOf(artId), attributeConflict.getDestBranch()); if (art.isValid()) { if (!first) { guidList.append(","); } guidList.append(art.getGuid()); } } else if (!checkArtifactFromId.isDeleted()) { if (!first) { guidList.append(","); } guidList.append(checkArtifactFromId.getGuid()); } else { throw new OseeCoreException( "Artifact '" + checkArtifactFromId.getName() + "' with id " + checkArtifactFromId.getArtId() + " was deleted on this source branch"); } } return guidList.toString(); }

Target:
private String getGuidList(String editedList) { StringBuilder guidList = new StringBuilder(); boolean first = true; Matcher idMatch = idPattern.matcher(editedList); while (idMatch.find()) { first = false; String artId = editedList.substring(idMatch.start() + 1, idMatch.end() - 1); Artifact checkArtifactFromId = ArtifactQuery.checkArtifactFromId(ArtifactId.valueOf(artId), attributeConflict.getSourceBranch(), DeletionFlag.INCLUDE_DELETED); if (checkArtifactFromId.isInvalid()) { Artifact art = ArtifactQuery.getArtifactFromId(ArtifactId.valueOf(artId), attributeConflict.getDestBranch()); if (art.isValid()) { if (!first) { guidList.append(","); } guidList.append(art.getGuid()); } } else if (checkArtifactFromId.isDeleted()) { results.error( "Artifact '" + checkArtifactFromId.getName() + "' with id " + checkArtifactFromId.getArtId() + " was deleted on this source branch"); } else if (!checkArtifactFromId.isDeleted()) { if (!first) { guidList.append(","); } guidList.append(checkArtifactFromId.getGuid()); } else { results.error( "There was a problem with Artifact '" + checkArtifactFromId.getName() + "' with id " + checkArtifactFromId.getArtId() + "\nSave Failed"); } } return guidList.toString(); }
Source:
private void blockingNewSession() { newSessionLock.lock(); try { if(!expired()) { return; } asyncNewSession(); if (false == newSessionCondition.await(NEW_SESSION_MAX_WAIT_SECONDS, TimeUnit.SECONDS)) { if (expired()) { throw new AmazonClientException("Session credentials request timed-out.", lastException.get()); } } } catch (InterruptedException ex) { throw new AmazonClientException(ex); } finally { newSessionLock.unlock(); } }

Target:
private void blockingNewSession() { newSessionLock.lock(); try { if (!expired()) { return; } asyncNewSession(); if (!newSessionCondition.await(NEW_SESSION_MAX_WAIT_SECONDS, TimeUnit.SECONDS)) { if (expired()) { handleWaitError("Session credentials request timed-out.", lastException.get()); } } } catch (InterruptedException ex) { handleWaitError("Interrupted waiting for new session credentials.", ex); } finally { newSessionLock.unlock(); } }
Source:
protected Map<String, String> getAdditionalAttributes(SiteItem siteItem) { SiteContext siteContext = SiteContext.getCurrent(); Configuration siteConfig = siteContext.getConfig(); if(siteConfig != null && siteConfig.containsKey(KEY_NAV_ADDITIONAL_FIELDS)) { Map<String, String> attrs = new HashMap<>(); String[] fields = siteConfig.getStringArray(KEY_NAV_ADDITIONAL_FIELDS); for (String field : fields) { String value = siteItem.queryValue(field); if(value != null) { attrs.put(field, value); } } return attrs; } return Collections.emptyMap(); }

Target:
protected Map<String, String> getAdditionalAttributes(SiteItem siteItem) { Map<String, String> attrs = new HashMap<>(); String[] fields = SiteProperties.getNavigationAdditionalFields(); for (String field : fields) { String value = siteItem.queryValue(field); if(value != null) { attrs.put(field, value); } } return attrs; }
Source:
public EntityType getEntityType() { return Sponge.getRegistry().getType(EntityType.class, this.entityId).get(); }

Target:
public EntityType getEntityType() { return EntityTypeRegistryModule.getInstance().getById(this.entityId).get(); }
Source:
public UpdateCapturingIndexProvider( SchemaIndexProvider actual, Map<Long,Collection<IndexEntryUpdate>> initialUpdates ) { super( actual.getProviderDescriptor(), actual.priority() ); this.actual = actual; this.initialUpdates = initialUpdates; }

Target:
public UpdateCapturingIndexProvider( SchemaIndexProvider actual, Map<Long,Collection<IndexEntryUpdate>> initialUpdates ) { super( actual ); this.actual = actual; this.initialUpdates = initialUpdates; }
Source:
public void createPartControl(@Nullable Composite parent) { super.createPartControl(parent); SashForm sf = new SashForm(parent, SWT.NONE); TableViewer tableViewer = new TableViewer(sf, SWT.FULL_SELECTION | SWT.VIRTUAL); fSegmentStoreViewer = createSegmentStoreViewer(tableViewer); getViewSite().getActionBars().getMenuManager().add(fExportAction); ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace(); if (trace != null) { TmfTraceSelectedSignal signal = new TmfTraceSelectedSignal(this, trace); if (fSegmentStoreViewer != null) { fSegmentStoreViewer.traceSelected(signal); } } else { setInitialData(); } }

Target:
public void createPartControl(@Nullable Composite parent) { super.createPartControl(parent); SashForm sf = new SashForm(parent, SWT.NONE); TableViewer tableViewer = new TableViewer(sf, SWT.FULL_SELECTION | SWT.VIRTUAL); fSegmentStoreViewer = createSegmentStoreViewer(tableViewer); getViewSite().getActionBars().getMenuManager().add(fExportAction); ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace(); if (trace != null) { TmfTraceSelectedSignal signal = new TmfTraceSelectedSignal(this, trace); if (fSegmentStoreViewer != null) { fSegmentStoreViewer.traceSelected(signal); } } }
Source:
public void testComputeOffsetAndBackToOrigin() { LatLng start = new LatLng(40, 40); double distance = 1e5; double heading = 15; LatLng end; end = SphericalUtil.computeOffset(start, distance, heading); expectLatLngApproxEquals( start, SphericalUtil.computeOffsetOrigin(end, distance, heading)); heading = -37; end = SphericalUtil.computeOffset(start, distance, heading); expectLatLngApproxEquals( start, SphericalUtil.computeOffsetOrigin(end, distance, heading)); distance = 3.8e+7; end = SphericalUtil.computeOffset(start, distance, heading); expectLatLngApproxEquals( start, SphericalUtil.computeOffsetOrigin(end, distance, heading)); start = new LatLng(-21, -73); end = SphericalUtil.computeOffset(start, distance, heading); expectLatLngApproxEquals( start, SphericalUtil.computeOffsetOrigin(end, distance, heading)); start = SphericalUtil.computeOffsetOrigin(new LatLng(0, 90), Math.PI * EARTH_RADIUS / 2, 90); expectLatLngApproxEquals( new LatLng(0, 90), SphericalUtil.computeOffset(start, Math.PI * EARTH_RADIUS / 2, 90)); start = SphericalUtil.computeOffsetOrigin(new LatLng(90, 0), Math.PI * EARTH_RADIUS / 4, 0); if (start != null) { expectLatLngApproxEquals( new LatLng(90, 0), SphericalUtil.computeOffset(start, Math.PI * EARTH_RADIUS / 4, 0)); } }

Target:
public void testComputeOffsetAndBackToOrigin() { LatLng start = new LatLng(40, 40); double distance = 1e5; double heading = 15; LatLng end; end = SphericalUtil.computeOffset(start, distance, heading); expectLatLngApproxEquals( start, SphericalUtil.computeOffsetOrigin(end, distance, heading)); heading = -37; end = SphericalUtil.computeOffset(start, distance, heading); expectLatLngApproxEquals( start, SphericalUtil.computeOffsetOrigin(end, distance, heading)); distance = 3.8e+7; end = SphericalUtil.computeOffset(start, distance, heading); expectLatLngApproxEquals( start, SphericalUtil.computeOffsetOrigin(end, distance, heading)); start = new LatLng(-21, -73); end = SphericalUtil.computeOffset(start, distance, heading); expectLatLngApproxEquals( start, SphericalUtil.computeOffsetOrigin(end, distance, heading)); start = SphericalUtil.computeOffsetOrigin(new LatLng(0, 90), Math.PI * EARTH_RADIUS / 2, 90); expectLatLngApproxEquals( new LatLng(0, 90), SphericalUtil.computeOffset(start, Math.PI * EARTH_RADIUS / 2, 90)); start = SphericalUtil.computeOffsetOrigin(new LatLng(90, 0), Math.PI * EARTH_RADIUS / 4, 0); expectLatLngApproxEquals( new LatLng(90, 0), SphericalUtil.computeOffset(start, Math.PI * EARTH_RADIUS / 4, 0)); }
Source:
public List<HtmlParameterStats> getParams(HtmlParameter.Type type) { List<HtmlParameterStats> params = new ArrayList<>(); switch (type) { case cookie: for (HtmlParameterStats param : this.cookieParams.values()) { params.add(param); } break; case url: for (HtmlParameterStats param : this.urlParams.values()) { params.add(param); } break; case form: for (HtmlParameterStats param : this.formParams.values()) { params.add(param); } break; case header: for (HtmlParameterStats param : this.headerParams.values()) { params.add(param); } break; } return params; }

Target:
public List<HtmlParameterStats> getParams(HtmlParameter.Type type) { List<HtmlParameterStats> params = new ArrayList<>(); switch (type) { case cookie: params.addAll(this.cookieParams.values()); break; case url: params.addAll(this.urlParams.values()); break; case form: params.addAll(this.formParams.values()); break; case header: params.addAll(this.headerParams.values()); break; } return params; }