auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private Optional<InputWithData<InputChannel, BufferAndAvailability>> waitAndGetNextData(boolean blocking) throws IOException, InterruptedException { while (true) { Optional<InputChannel> inputChannelOpt = getChannel(blocking); if (!inputChannelOpt.isPresent()) { return Optional.empty(); } final InputChannel inputChannel = inputChannelOpt.get(); Optional<BufferAndAvailability> bufferAndAvailabilityOpt = inputChannel.getNextBuffer(); synchronized (inputChannelsWithData) { if (!bufferAndAvailabilityOpt.isPresent()) { if (inputChannelsWithData.isEmpty()) { availabilityHelper.resetUnavailable(); } continue; } final BufferAndAvailability bufferAndAvailability = bufferAndAvailabilityOpt.get(); if (bufferAndAvailability.moreAvailable()) { queueChannelUnsafe(inputChannel, bufferAndAvailability.morePriorityEvents()); } final boolean morePriorityEvents = inputChannelsWithData.getNumPriorityElements() > 0; if (bufferAndAvailability.hasPriority() && !morePriorityEvents) { priorityAvailabilityHelper.resetUnavailable(); } if (inputChannelsWithData.isEmpty()) { availabilityHelper.resetUnavailable(); } return Optional.of(new InputWithData<>( inputChannel, bufferAndAvailability, !inputChannelsWithData.isEmpty(), morePriorityEvents)); } } }

Target:
private Optional<InputWithData<InputChannel, BufferAndAvailability>> waitAndGetNextData(boolean blocking) throws IOException, InterruptedException { while (true) { synchronized (inputChannelsWithData) { Optional<InputChannel> inputChannelOpt = getChannel(blocking); if (!inputChannelOpt.isPresent()) { return Optional.empty(); } final InputChannel inputChannel = inputChannelOpt.get(); Optional<BufferAndAvailability> bufferAndAvailabilityOpt = inputChannel.getNextBuffer(); if (!bufferAndAvailabilityOpt.isPresent()) { checkUnavailability(); continue; } final BufferAndAvailability bufferAndAvailability = bufferAndAvailabilityOpt.get(); if (bufferAndAvailability.moreAvailable()) { queueChannelUnsafe(inputChannel, bufferAndAvailability.morePriorityEvents()); } final boolean morePriorityEvents = inputChannelsWithData.getNumPriorityElements() > 0; if (bufferAndAvailability.hasPriority()) { lastPrioritySequenceNumber[inputChannel.getChannelIndex()] = bufferAndAvailability.getSequenceNumber(); if (!morePriorityEvents) { priorityAvailabilityHelper.resetUnavailable(); } } checkUnavailability(); return Optional.of(new InputWithData<>( inputChannel, bufferAndAvailability, !inputChannelsWithData.isEmpty(), morePriorityEvents)); } } }
Source:
private void setRingerModeInt(int ringerMode, boolean persist) { mRingerMode = ringerMode; AudioSystem.setRingerMode(ringerMode, 0); int numStreamTypes = AudioSystem.getNumStreamTypes(); for (int streamType = numStreamTypes - 1; streamType >= 0; streamType--) { if (isStreamMutedByRingerMode(streamType)) { if (!isStreamAffectedByRingerMode(streamType) || mRingerMode == AudioManager.RINGER_MODE_NORMAL || (streamType == AudioSystem.STREAM_RING && (mConnectedDevices.containsKey(AudioSystem.DEVICE_OUT_WIRED_HEADSET) || mConnectedDevices.containsKey(AudioSystem.DEVICE_OUT_WIRED_HEADPHONE)))) { mStreamStates[streamType].mute(null, false); mRingerModeMutedStreams &= ~(1 << streamType); } } else { if (isStreamAffectedByRingerMode(streamType) && mRingerMode != AudioManager.RINGER_MODE_NORMAL && (streamType != AudioSystem.STREAM_RING || (!mConnectedDevices.containsKey(AudioSystem.DEVICE_OUT_WIRED_HEADSET) && !mConnectedDevices.containsKey(AudioSystem.DEVICE_OUT_WIRED_HEADPHONE)))) { mStreamStates[streamType].mute(null, true); mRingerModeMutedStreams |= (1 << streamType); } } } if (persist) { sendMsg(mAudioHandler, MSG_PERSIST_RINGER_MODE, SHARED_MSG, SENDMSG_REPLACE, 0, 0, null, PERSIST_DELAY); } }

Target:
private void setRingerModeInt(int ringerMode, boolean persist) { mRingerMode = ringerMode; AudioSystem.setRingerMode(ringerMode, 0); int numStreamTypes = AudioSystem.getNumStreamTypes(); for (int streamType = numStreamTypes - 1; streamType >= 0; streamType--) { if (isStreamMutedByRingerMode(streamType)) { if (!isStreamAffectedByRingerMode(streamType) || mRingerMode == AudioManager.RINGER_MODE_NORMAL || isStreamRoutedToWiredHeadset(streamType)) { if (mVoiceCapable && STREAM_VOLUME_ALIAS[streamType] == AudioSystem.STREAM_RING && mStreamStates[streamType].mLastAudibleIndex == 0) { mStreamStates[streamType].mLastAudibleIndex = 10; } mStreamStates[streamType].mute(null, false); mRingerModeMutedStreams &= ~(1 << streamType); } } else { if (isStreamAffectedByRingerMode(streamType) && mRingerMode != AudioManager.RINGER_MODE_NORMAL && !isStreamRoutedToWiredHeadset(streamType)) { mStreamStates[streamType].mute(null, true); mRingerModeMutedStreams |= (1 << streamType); } else if (mVoiceCapable && mRingerMode == AudioManager.RINGER_MODE_NORMAL && mStreamStates[streamType].mLastAudibleIndex == 0 && isStreamRoutedToWiredHeadset(streamType)) { mStreamStates[streamType].mLastAudibleIndex = 10; mStreamStates[streamType].mIndex = 10; } } } if (persist) { sendMsg(mAudioHandler, MSG_PERSIST_RINGER_MODE, SHARED_MSG, SENDMSG_REPLACE, 0, 0, null, PERSIST_DELAY); } }
Source:
public int getItemCount() { Log.isLoggable("dhjjy", mItems.size()); return mItems.size(); }

Target:
public int getItemCount() { return mItems.size(); }
Source:
public <T extends Method> List<SelectedMethod<T>> getMatchingMethods(Method mappingMethod, List<SelectedMethod<T>> methods, List<Type> sourceTypes, Type targetType, SelectionCriteria criteria) { if ( methods.isEmpty() ) { return methods; } List<SelectedMethod<T>> result = new ArrayList<>(); List<ParameterBinding> availableBindings; if ( sourceTypes.isEmpty() ) { availableBindings = getAvailableParameterBindingsFromMethod( mappingMethod, targetType, criteria.getSourceRHS() ); } else { availableBindings = getAvailableParameterBindingsFromSourceTypes( sourceTypes, targetType, mappingMethod ); } for ( SelectedMethod<T> method : methods ) { List<List<ParameterBinding>> parameterBindingPermutations = getCandidateParameterBindingPermutations( availableBindings, method.getMethod().getParameters() ); SelectedMethod<T> matchingMethod = getMatchingParameterBinding( targetType, mappingMethod, method, parameterBindingPermutations ); if ( matchingMethod != null ) { result.add( matchingMethod ); } } return result; }

Target:
public <T extends Method> List<SelectedMethod<T>> getMatchingMethods(Method mappingMethod, List<SelectedMethod<T>> methods, List<Type> sourceTypes, Type targetType, SelectionCriteria criteria) { if ( methods.isEmpty() ) { return methods; } List<SelectedMethod<T>> result = new ArrayList<>(); List<ParameterBinding> availableBindings; if ( sourceTypes.isEmpty() ) { availableBindings = getAvailableParameterBindingsFromMethod( mappingMethod, targetType, criteria.getSourceRHS() ); } else { availableBindings = getAvailableParameterBindingsFromSourceTypes( sourceTypes, targetType, mappingMethod ); } for ( SelectedMethod<T> method : methods ) { List<List<ParameterBinding>> parameterBindingPermutations = getCandidateParameterBindingPermutations( availableBindings, method.getMethod().getParameters() ); if ( parameterBindingPermutations != null ) { SelectedMethod<T> matchingMethod = getMatchingParameterBinding( targetType, mappingMethod, method, parameterBindingPermutations ); if ( matchingMethod != null ) { result.add( matchingMethod ); } } } return result; }
Source:
public List<SampleDTO> getSamples(final String plotId) { final List<SampleDTO> listSampleDto = new ArrayList<>(); final List<Sample> samples = this.sampleDao.getByPlotId(plotId); for (Sample sample : samples) { SampleDTO dto = new SampleDTO(); dto.setSampleName(sample.getSampleName()); dto.setSampleBusinessKey(sample.getSampleBusinessKey()); User takenBy = sample.getTakenBy(); if (takenBy != null) { Person person = takenBy.getPerson(); dto.setTakenBy(person.getFirstName() + " " + person.getLastName()); } dto.setSamplingDate(sample.getSamplingDate()); SampleList sampleList = sample.getSampleList(); if (sampleList != null) { dto.setSampleList(sampleList.getListName()); } Plant plant = sample.getPlant(); dto.setPlantNumber(plant.getPlantNumber()); dto.setPlantBusinessKey(plant.getPlantBusinessKey()); listSampleDto.add(dto); } return listSampleDto; }

Target:
public List<SampleDTO> getSamples(final String plotId) { final List<Sample> samples = this.sampleDao.getByPlotId(plotId); return mapSampleToSampleDTO(samples); }
Source:
private Set<SitemapEvent> constructSitemapEvents(Item item, List<Widget> widgets) { Set<SitemapEvent> events = new HashSet<>(); for (Widget w : widgets) { if (w instanceof Frame) { events.addAll(constructSitemapEvents(item, itemUIRegistry.getChildren((Frame) w))); } if ((w.getItem() != null && w.getItem().equals(item.getName())) || definesVisibility(w, item.getName())) { SitemapWidgetEvent event = new SitemapWidgetEvent(); event.sitemapName = sitemapName; event.pageId = pageId; event.label = itemUIRegistry.getLabel(w); event.labelcolor = itemUIRegistry.getLabelColor(w); event.valuecolor = itemUIRegistry.getValueColor(w); event.widgetId = itemUIRegistry.getWidgetId(w); event.visibility = itemUIRegistry.getVisiblity(w); event.item = EnrichedItemDTOMapper.map(item, false, null, null); String state = itemUIRegistry.getState(w).toFullString(); if (state.equals(event.item.state)) { event.state = "#item.state#"; } else { event.state = state; } events.add(event); } } return events; }

Target:
private Set<SitemapEvent> constructSitemapEvents(Item item, List<Widget> widgets) { Set<SitemapEvent> events = new HashSet<>(); for (Widget w : widgets) { if (w instanceof Frame) { events.addAll(constructSitemapEvents(item, itemUIRegistry.getChildren((Frame) w))); } if ((w.getItem() != null && w.getItem().equals(item.getName())) || definesVisibility(w, item.getName())) { SitemapWidgetEvent event = new SitemapWidgetEvent(); event.sitemapName = sitemapName; event.pageId = pageId; event.label = itemUIRegistry.getLabel(w); event.labelcolor = itemUIRegistry.getLabelColor(w); event.valuecolor = itemUIRegistry.getValueColor(w); event.widgetId = itemUIRegistry.getWidgetId(w); event.visibility = itemUIRegistry.getVisiblity(w); event.item = EnrichedItemDTOMapper.map(item, false, null, null); event.state = itemUIRegistry.getState(w).toFullString(); if (event.state != null && event.state.equals(event.item.state)) { event.state = null; } events.add(event); } } return events; }
Source:
private static TypeUrl doParse(String typeUrl) { final String[] parts = typeUrlSeparatorPattern.split(typeUrl); if (parts.length != 2) { throw malformedTypeUrl(typeUrl); } final String prefix = parts[0]; if (prefix.isEmpty()) { throw malformedTypeUrl(typeUrl); } final String typeName = parts[1]; if (typeName.isEmpty()) { throw malformedTypeUrl(typeUrl); } return create(prefix, typeName); }

Target:
private static TypeUrl doParse(String typeUrl) { final List<String> strings = splitter.splitToList(typeUrl); if (strings.size() != 2) { throw malformedTypeUrl(typeUrl); } final String prefix = strings.get(0); final String typeName = strings.get(1); return create(prefix, typeName); }
Source:
private static ConsumerConfig createConsumerConfig(String zookeeper, String groupId, String optionalConfigs) { try { Properties props = new Properties(); props.put(KafkaEventAdapterConstants.ADAPTOR_SUSCRIBER_ZOOKEEPER_CONNECT, zookeeper); props.put(KafkaEventAdapterConstants.ADAPTOR_SUSCRIBER_GROUP_ID, groupId); if (optionalConfigs != null) { String[] optionalProperties = optionalConfigs.split(","); if (optionalProperties != null && optionalProperties.length > 0) { for (String header : optionalProperties) { String[] configPropertyWithValue = header.split(":"); if (configPropertyWithValue.length == 2) { props.put(configPropertyWithValue[0], configPropertyWithValue[1]); } else { log.warn("Optional configuration property not defined in the correct format.\nRequired - property_name1:property_value1,property_name2:property_value2\nFound - " + optionalConfigs); } } } } return new ConsumerConfig(props); } catch (Throwable t) { throw new InputEventAdapterRuntimeException("Cannot access kafka context due to missing jars", t); } }

Target:
private static ConsumerConfig createConsumerConfig(String zookeeper, String groupId, String optionalConfigs) { try { Properties props = new Properties(); props.put(KafkaEventAdapterConstants.ADAPTOR_SUSCRIBER_ZOOKEEPER_CONNECT, zookeeper); props.put(KafkaEventAdapterConstants.ADAPTOR_SUSCRIBER_GROUP_ID, groupId); if (optionalConfigs != null) { String[] optionalProperties = optionalConfigs.split(","); if (optionalProperties != null && optionalProperties.length > 0) { for (String header : optionalProperties) { String[] configPropertyWithValue = header.split(":", 2); if (configPropertyWithValue.length == 2) { props.put(configPropertyWithValue[0], configPropertyWithValue[1]); } else { log.warn("Optional configuration property not defined in the correct format.\nRequired - property_name1:property_value1,property_name2:property_value2\nFound - " + optionalConfigs); } } } } return new ConsumerConfig(props); } catch (NoClassDefFoundError e) { throw new InputEventAdapterRuntimeException("Cannot access kafka context due to missing jars", e); } }
Source:
private void updateRequirements(IRepository parent, IReview review, ChangeDetailX detail, Map<String, IApprovalType> typeForName) { review.getRequirements().clear(); if (detail.getSubmitRecords() != null) { for (SubmitRecord record : detail.getSubmitRecords()) { for (Label label : record.getLabels()) { IApprovalType approvalType = typeForName.get(label.getLabel()); if (approvalType == null) { throw new RuntimeException("Internal Error, no approval type found for: " + label.getLabel()); } IRequirementEntry requirementEntry = IReviewsFactory.INSTANCE.createRequirementEntry(); if (label.getStatus().equals("OK")) { requirementEntry.setStatus(RequirementStatus.SATISFIED); } else if (label.getStatus().equals("NEED")) { requirementEntry.setStatus(RequirementStatus.NOT_SATISFIED); } else if (label.getStatus().equals("REJECT")) { requirementEntry.setStatus(RequirementStatus.REJECTED); } else if (label.getStatus().equals("MAY")) { requirementEntry.setStatus(RequirementStatus.OPTIONAL); } else if (label.getStatus().equals("IMPOSSIBLE")) { requirementEntry.setStatus(RequirementStatus.ERROR); } if (label.getAppliedBy() != null) { IUser approver = getGerritProvider().createUser(parent, detail.getAccounts(), label.getAppliedBy()); requirementEntry.setBy(approver); } review.getRequirements().put(approvalType, requirementEntry); } } } }

Target:
private void updateRequirements(IRepository parent, IReview review, ChangeDetailX detail, Map<String, IApprovalType> typeForName) { review.getRequirements().clear(); if (detail.getSubmitRecords() != null) { for (SubmitRecord record : detail.getSubmitRecords()) { for (Label label : record.getLabels()) { IApprovalType approvalType = typeForName.get(label.getLabel()); if (approvalType == null) { if (detail.getChange().getStatus() == Status.ABANDONED) { continue; } throw new RuntimeException("Internal Error, no approval type found for: " + label.getLabel()); } IRequirementEntry requirementEntry = IReviewsFactory.INSTANCE.createRequirementEntry(); if (label.getStatus().equals("OK")) { requirementEntry.setStatus(RequirementStatus.SATISFIED); } else if (label.getStatus().equals("NEED")) { requirementEntry.setStatus(RequirementStatus.NOT_SATISFIED); } else if (label.getStatus().equals("REJECT")) { requirementEntry.setStatus(RequirementStatus.REJECTED); } else if (label.getStatus().equals("MAY")) { requirementEntry.setStatus(RequirementStatus.OPTIONAL); } else if (label.getStatus().equals("IMPOSSIBLE")) { requirementEntry.setStatus(RequirementStatus.ERROR); } if (label.getAppliedBy() != null) { IUser approver = getGerritProvider().createUser(parent, detail.getAccounts(), label.getAppliedBy()); requirementEntry.setBy(approver); } review.getRequirements().put(approvalType, requirementEntry); } } } }
Source:
public void configure(final Map<String, ?> configs) { final AssignorConfiguration assignorConfiguration = new AssignorConfiguration(configs); logPrefix = assignorConfiguration.getLogPrefix(); log = new LogContext(logPrefix).logger(getClass()); usedSubscriptionMetadataVersion = assignorConfiguration .getConfiguredMetadataVersion(usedSubscriptionMetadataVersion); taskManager = assignorConfiguration.getTaskManager(); streamsMetadataState = assignorConfiguration.getStreamsMetadataState(); assignmentErrorCode = assignorConfiguration.getAssignmentErrorCode(); nextScheduledRebalanceMs = assignorConfiguration.getNextScheduledRebalanceMs(); time = assignorConfiguration.getTime(); assignmentConfigs = assignorConfiguration.getAssignmentConfigs(); partitionGrouper = assignorConfiguration.getPartitionGrouper(); userEndPoint = assignorConfiguration.getUserEndPoint(); adminClient = assignorConfiguration.getAdminClient(); adminClientTimeout = assignorConfiguration.getAdminClientTimeout(); internalTopicManager = assignorConfiguration.getInternalTopicManager(); copartitionedTopicsEnforcer = assignorConfiguration.getCopartitionedTopicsEnforcer(); rebalanceProtocol = assignorConfiguration.getRebalanceProtocol(); taskAssignorSupplier = assignorConfiguration::getTaskAssignor; assignmentListener = assignorConfiguration.getAssignmentListener(); }

Target:
public void configure(final Map<String, ?> configs) { final AssignorConfiguration assignorConfiguration = new AssignorConfiguration(configs); logPrefix = assignorConfiguration.logPrefix(); log = new LogContext(logPrefix).logger(getClass()); usedSubscriptionMetadataVersion = assignorConfiguration .configuredMetadataVersion(usedSubscriptionMetadataVersion); taskManager = assignorConfiguration.taskManager(); streamsMetadataState = assignorConfiguration.streamsMetadataState(); assignmentErrorCode = assignorConfiguration.assignmentErrorCode(); nextScheduledRebalanceMs = assignorConfiguration.nextScheduledRebalanceMs(); time = assignorConfiguration.time(); assignmentConfigs = assignorConfiguration.assignmentConfigs(); partitionGrouper = assignorConfiguration.partitionGrouper(); userEndPoint = assignorConfiguration.userEndPoint(); adminClient = assignorConfiguration.adminClient(); adminClientTimeout = assignorConfiguration.adminClientTimeout(); internalTopicManager = assignorConfiguration.internalTopicManager(); copartitionedTopicsEnforcer = assignorConfiguration.copartitionedTopicsEnforcer(); rebalanceProtocol = assignorConfiguration.rebalanceProtocol(); taskAssignorSupplier = assignorConfiguration::taskAssignor; assignmentListener = assignorConfiguration.assignmentListener(); }
Source:
public Object[][] invalidEncodingCharsData() { final char[] testCases = new char[] {'c', '\t', '\n', (char) -1, 'p', 'n', 'x' }; return IntStream.range(0, testCases.length) .mapToObj(i -> testCases[i]) .map(c -> new Object[] { c }) .toArray(Object[][]::new); }

Target:
public Object[][] invalidEncodingCharsData() { final Character[] testCases = new Character[] {(char) 0, 'c', '\t', '\n', (char) -1, 'p', 'n', 'x', '!'}; return Stream.of(testCases) .map(c -> new Object[] { c }) .toArray(Object[][]::new); }
Source:
public void initialize(DirectoryProviderInitializationContext context) { ConfigurationPropertySource propertySource = context.getConfigurationPropertySource(); this.directoryRoot = ROOT.get( propertySource ).toAbsolutePath(); FileSystemAccessStrategyName accessStrategyName = FILESYSTEM_ACCESS_STRATEGY.get( propertySource ); this.accessStrategy = FileSystemAccessStrategy.get( accessStrategyName ); this.lockFactory = context.createConfiguredLockFactory().orElseGet( () -> FSLockFactory::getDefault ).get(); try { FileSystemUtils.initializeWriteableDirectory( directoryRoot ); } catch (Exception e) { throw log.unableToInitializeRootDirectory( directoryRoot, e.getMessage(), e ); } }

Target:
public void initialize(DirectoryProviderInitializationContext context) { ConfigurationPropertySource propertySource = context.getConfigurationPropertySource(); this.directoryRoot = ROOT.get( propertySource ).toAbsolutePath(); FileSystemAccessStrategyName accessStrategyName = FILESYSTEM_ACCESS_STRATEGY.get( propertySource ); this.accessStrategy = FileSystemAccessStrategy.get( accessStrategyName ); this.lockFactorySupplier = context.createConfiguredLockFactorySupplier().orElseGet( () -> FSLockFactory::getDefault ); try { FileSystemUtils.initializeWriteableDirectory( directoryRoot ); } catch (Exception e) { throw log.unableToInitializeRootDirectory( directoryRoot, e.getMessage(), e ); } }
Source:
public void lookupDataSet(final Integer offset, final DataSetReadyCallback callback) { try { if (!allowMultipleColumnSorting) { if (lastOrderedColumn == null) { String defaultSortColumn = currentTableSetting.getTableDefaultSortColumnId(); if (!StringUtils.isBlank(defaultSortColumn)) { lastOrderedColumn = defaultSortColumn; lastSortOrder = currentTableSetting.getTableDefaultSortOrder(); } } if (lastOrderedColumn != null) { dataSetHandler.sort(lastOrderedColumn, lastSortOrder); } } dataSetHandler.limitDataSetRows(offset, currentTableSetting.getTablePageSize()); dataSetHandler.lookupDataSet( new DataSetReadyCallback() { public void callback(DataSet dataSet) { DataSetQueryHelper.this.dataSet = dataSet; callback.callback(dataSet); event.fire(new DataSetReadyEvent(currentTableSetting)); } public void notFound() { callback.notFound(); } @Override public boolean onError(final ClientRuntimeError error) { callback.onError(error); return false; } } ); } catch (Exception e) { callback.onError(new ClientRuntimeError(e.getMessage())); } }

Target:
public void lookupDataSet(final Integer offset, final DataSetReadyCallback callback) { try { if (lastOrderedColumn == null) { String defaultSortColumn = currentTableSetting.getTableDefaultSortColumnId(); if (!StringUtils.isBlank(defaultSortColumn)) { lastOrderedColumn = defaultSortColumn; lastSortOrder = currentTableSetting.getTableDefaultSortOrder(); } } if (lastOrderedColumn != null) { dataSetHandler.sort(lastOrderedColumn, lastSortOrder); } dataSetHandler.limitDataSetRows(offset, currentTableSetting.getTablePageSize()); dataSetHandler.lookupDataSet( new DataSetReadyCallback() { public void callback(DataSet dataSet) { DataSetQueryHelper.this.dataSet = dataSet; callback.callback(dataSet); event.fire(new DataSetReadyEvent(currentTableSetting)); } public void notFound() { callback.notFound(); } @Override public boolean onError(final ClientRuntimeError error) { callback.onError(error); return false; } } ); } catch (Exception e) { callback.onError(new ClientRuntimeError(e.getMessage())); } }
Source:
public void author() { TurboIssue issue = new TurboIssue(REPO, 1, "", "bob", null, false); assertEquals(true, matches("creator:BOB", issue)); assertEquals(true, matches("creator:bob", issue)); assertEquals(false, matches("creator:alice", issue)); assertEquals(true, matches("creator:o", issue)); assertEquals(false, matches("creator:lic", issue)); assertEquals(true, matches("author:BOB", issue)); assertEquals(true, matches("author:bob", issue)); assertEquals(false, matches("author:alice", issue)); assertEquals(true, matches("author:o", issue)); assertEquals(false, matches("author:lic", issue)); assertEquals(true, matches("au:BOB", issue)); assertEquals(true, matches("au:bob", issue)); assertEquals(false, matches("au:alice", issue)); assertEquals(true, matches("au:o", issue)); assertEquals(false, matches("au:lic", issue)); }

Target:
public void author() { testAuthorParsing("author"); }
Source:
public AnalyzedStatement analyze(SetStatement<Expression> node, ParamTypeHints typeHints, CoordinatorTxnCtx txnCtx) { boolean isPersistent = node.settingType().equals(SetStatement.SettingType.PERSISTENT); Map<String, List<Symbol>> settings = new HashMap<>(); var exprAnalyzer = new ExpressionAnalyzer( functions, txnCtx, typeHints, FieldProvider.FIELDS_AS_LITERAL, null ); SetStatement<Symbol> statement = node.map(x -> exprAnalyzer.convert(x, new ExpressionAnalysisContext())); switch (node.scope()) { case LICENSE: if (node.assignments().size() != AnalyzedSetLicenseStatement.LICENSE_TOKEN_NUM) { throw new IllegalArgumentException("Invalid number of arguments for SET LICENSE. " + "Please provide only the license key"); } return new AnalyzedSetLicenseStatement(statement.assignments().get(0).expression()); case GLOBAL: for (Assignment<Symbol> a : statement.assignments()) { String settingName = a.columnName().representation(); settings.put(settingName, ImmutableList.of(a.expression())); } break; default: Assignment<Symbol> assignment = statement.assignments().get(0); String settingName = assignment.columnName().representation(); List<String> nameParts = CrateSettings.settingNamesByPrefix(settingName); if (nameParts.size() != 0) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "GLOBAL Cluster setting '%s' cannot be used with SET SESSION / LOCAL", settingName)); } settings.put(settingName, assignment.expressions()); break; } return new AnalyzedSetStatement(node.scope(), settings, isPersistent); }

Target:
public AnalyzedStatement analyze(SetStatement<Expression> node, ParamTypeHints typeHints, CoordinatorTxnCtx txnCtx) { boolean isPersistent = node.settingType().equals(SetStatement.SettingType.PERSISTENT); var exprAnalyzer = new ExpressionAnalyzer( functions, txnCtx, typeHints, FieldProvider.FIELDS_AS_LITERAL, null ); SetStatement<Symbol> statement = node.map(x -> exprAnalyzer.convert(x, new ExpressionAnalysisContext())); if (node.scope() == SetStatement.Scope.LICENSE) { if (node.assignments().size() != AnalyzedSetLicenseStatement.LICENSE_TOKEN_NUM) { throw new IllegalArgumentException("Invalid number of arguments for SET LICENSE. " + "Please provide only the license key"); } return new AnalyzedSetLicenseStatement(statement.assignments().get(0).expression()); } return new AnalyzedSetStatement(node.scope(), statement.assignments(), isPersistent); }
Source:
public static String hashpw(String password, String salt) { BCrypt B; String real_salt; byte passwordb[], saltb[], hashed[]; char minor = (char) 0; int rounds, off = 0; StringBuffer rs = new StringBuffer(); if (salt.charAt(0) != '$' || salt.charAt(1) != '2') { throw new IllegalArgumentException("Invalid salt version"); } if (salt.charAt(2) == '$') { off = 3; } else { minor = salt.charAt(2); if (minor != 'a' || salt.charAt(3) != '$') { throw new IllegalArgumentException("Invalid salt revision"); } off = 4; } if (salt.charAt(off + 2) > '$') { throw new IllegalArgumentException("Missing salt rounds"); } rounds = Integer.parseInt(salt.substring(off, off + 2)); real_salt = salt.substring(off + 3, off + 25); try { passwordb = (password + (minor >= 'a' ? "\000" : "")).getBytes("UTF-8"); } catch (UnsupportedEncodingException uee) { throw new AssertionError("UTF-8 is not supported"); } saltb = decode_base64(real_salt, BCRYPT_SALT_LEN); B = new BCrypt(); hashed = B.crypt_raw(passwordb, saltb, rounds, (int[]) bf_crypt_ciphertext.clone()); rs.append("$2"); if (minor >= 'a') { rs.append(minor); } rs.append("$"); if (rounds < 10) { rs.append("0"); } if (rounds > 30) { throw new IllegalArgumentException( "rounds exceeds maximum (30)"); } rs.append(Integer.toString(rounds)) .append("$") .append(encode_base64(saltb, saltb.length)) .append(encode_base64(hashed, bf_crypt_ciphertext.length * 4 - 1)); return rs.toString(); }

Target:
public static String hashpw(String password, String salt) { BCrypt B; String real_salt; byte passwordb[], saltb[], hashed[]; char minor = (char) 0; int rounds, off = 0; StringBuffer rs = new StringBuffer(); if (salt.charAt(0) != '$' || salt.charAt(1) != '2') { throw new IllegalArgumentException("Invalid salt version"); } if (salt.charAt(2) == '$') { off = 3; } else { minor = salt.charAt(2); if (minor != 'a' || salt.charAt(3) != '$') { throw new IllegalArgumentException("Invalid salt revision"); } off = 4; } if (salt.charAt(off + 2) > '$') { throw new IllegalArgumentException("Missing salt rounds"); } rounds = Integer.parseInt(salt.substring(off, off + 2)); real_salt = salt.substring(off + 3, off + 25); try { passwordb = (password + (minor >= 'a' ? "\000" : "")).getBytes("UTF-8"); } catch (UnsupportedEncodingException uee) { throw new AssertionError("UTF-8 is not supported"); } saltb = decode_base64(real_salt, BCRYPT_SALT_LEN); B = new BCrypt(); hashed = B.crypt_raw(passwordb, saltb, rounds, (int[]) bf_crypt_ciphertext.clone()); rs.append("$2"); if (minor >= 'a') { rs.append(minor); } rs.append("$"); if (rounds < 10) { rs.append("0"); } if (rounds > 30) { throw new IllegalArgumentException( "rounds exceeds maximum (30)"); } rs.append(rounds) .append("$") .append(encode_base64(saltb, saltb.length)) .append(encode_base64(hashed, bf_crypt_ciphertext.length * 4 - 1)); return rs.toString(); }
Source:
static void registerTransformers_1_3_0(ResourceTransformationDescriptionBuilder parentBuilder) { final String defaultModuleName = ModuleName.PICKETBOX.getName(); ResourceTransformationDescriptionBuilder builder = parentBuilder.addChildResource(PATH_PROVIDER_MODULE); builder.getAttributeBuilder() .setDiscard(new DiscardAttributeChecker.DiscardAttributeValueChecker(false, false, new ModelNode( ), new ModelNode(defaultModuleName)), MODULE) .addRejectCheck(new RejectAttributeChecker.DefaultRejectAttributeChecker() { @Override public String getRejectionLogMessage(Map<String, ModelNode> attributes) { return SecurityLogger.ROOT_LOGGER.rejectAttributeMustBeUndefinedOrDefault(Constants.MODULE, defaultModuleName); } @Override protected boolean rejectAttribute(PathAddress address, String attributeName, ModelNode attributeValue, TransformationContext context) { return true; } }, MODULE).end(); }

Target:
static void registerTransformers_1_3_0(ResourceTransformationDescriptionBuilder parentBuilder) { ResourceTransformationDescriptionBuilder builder = parentBuilder.addChildResource(PATH_PROVIDER_MODULE); builder.getAttributeBuilder() .setDiscard(new DiscardAttributeChecker.DiscardAttributeValueChecker(false, true, new ModelNode(ModuleName.PICKETBOX.getName())), MODULE) .addRejectCheck(RejectAttributeChecker.DEFINED, MODULE).end(); }
Source:
private IntIterator newIterator() { if (!descending) { return bitmapIndex.iterator(); } if (bitmapIndex instanceof WrappedImmutableRoaringBitmap) { return ((WrappedImmutableRoaringBitmap) bitmapIndex).getBitmap().getReverseIntIterator(); } int i = bitmapIndex.size(); int[] back = new int[bitmapIndex.size()]; IntIterator iterator = bitmapIndex.iterator(); while (iterator.hasNext()) { back[--i] = iterator.next(); } return new ArrayIntIterator(back, 0); }

Target:
private IntIterator newIterator() { if (!descending) { return bitmapIndex.iterator(); } ImmutableBitmap roaringBitmap = bitmapIndex; if (!(bitmapIndex instanceof WrappedImmutableRoaringBitmap)) { final BitmapFactory factory = RoaringBitmapSerdeFactory.bitmapFactory; final MutableBitmap bitmap = factory.makeEmptyMutableBitmap(); final IntIterator iterator = bitmapIndex.iterator(); while (iterator.hasNext()) { bitmap.add(iterator.next()); } roaringBitmap = factory.makeImmutableBitmap(bitmap); } return ((WrappedImmutableRoaringBitmap) roaringBitmap).getBitmap().getReverseIntIterator(); }
Source:
private String getWindupHome() { int homeIndex = arguments.indexOf(toArg(IOptionKeys.HOME)) + 1; String home = arguments.get(homeIndex); System.out.println(home); return String.valueOf(home); }

Target:
private String getWindupHome() { int index = arguments.indexOf(toArg(IOptionKeys.HOME)) + 1; List<String> values = this.getValues(index); return values.size() == 1 ? values.get(0) : null; }
Source:
public ResteasyClient build() { final HttpClient client = createHttpClient(factoryCustomizers); client.setIdleTimeout(config.getIdleTimeout().toMillis()); client.setAddressResolutionTimeout(config.getConnectTimeout().toMillis()); client.setConnectTimeout(config.getConnectTimeout().toMillis()); client.setMaxConnectionsPerDestination(config.getHttpClientDefaultMaxPerRoute()); client.setRemoveIdleDestinations(true); client.setUserAgentField(new HttpField(HttpHeader.USER_AGENT, config.getUserAgent())); if(StringUtils.isNotBlank(config.getProxyHost()) && config.getProxyPort() != 0) { HttpProxy proxy = new HttpProxy(config.getProxyHost(), config.getProxyPort()); client.getProxyConfiguration().getProxies().add(proxy); } if (config.isCookieHandlingEnabled()) { client.setCookieStore(new HttpCookieStore()); } final ClientConfiguration cc = new ClientConfiguration(getProviderFactory()); properties.forEach(cc::property); return new ResteasyClient(new JettyClientEngine(client), asyncExecutor, true, scheduledExecutorService, cc); }

Target:
public ResteasyClient build() { final HttpClient client = createHttpClient(factoryCustomizers); client.setIdleTimeout(config.getIdleTimeout().toMillis()); client.setAddressResolutionTimeout(config.getConnectTimeout().toMillis()); client.setConnectTimeout(config.getConnectTimeout().toMillis()); client.setMaxConnectionsPerDestination(config.getHttpClientDefaultMaxPerRoute()); client.setRemoveIdleDestinations(true); LOG.info("Setting User-Agent for the HTTP client to {}", clientName, config.getUserAgent()); client.setUserAgentField(new HttpField(HttpHeader.USER_AGENT, config.getUserAgent())); if(StringUtils.isNotBlank(config.getProxyHost()) && config.getProxyPort() != 0) { HttpProxy proxy = new HttpProxy(config.getProxyHost(), config.getProxyPort()); client.getProxyConfiguration().getProxies().add(proxy); } if (config.isCookieHandlingEnabled()) { client.setCookieStore(new HttpCookieStore()); } final ClientConfiguration cc = new ClientConfiguration(getProviderFactory()); properties.forEach(cc::property); return new ResteasyClient(new JettyClientEngine(client), asyncExecutor, true, scheduledExecutorService, cc); }
Source:
protected boolean createAndOpenPapyrusModel(URI newURI, String diagramCategoryId) { if (newURI == null) { return false; } ServicesRegistry registry = createServicesRegistry(); if (registry == null) { return false; } try { ModelSet modelSet = registry.getService(ModelSet.class); createPapyrusModels(modelSet, newURI); initServicesRegistry(registry); initDomainModel(modelSet, newURI, diagramCategoryId); initDiagramModel(modelSet, diagramCategoryId); initProfile(modelSet); initTemplate(modelSet); openDiagram(newURI); } catch (ServiceException e) { Activator.log.error(e); return false; } finally { try { registry.disposeRegistry(); } catch (ServiceException ex) { } } return true; }

Target:
protected boolean createAndOpenPapyrusModel(URI newURI, String diagramCategoryId) { if (newURI == null) { return false; } ServicesRegistry registry = createServicesRegistry(); if (registry == null) { return false; } try { ModelSet modelSet = registry.getService(ModelSet.class); createPapyrusModels(modelSet, newURI); initServicesRegistry(registry); initDomainModel(modelSet, newURI, diagramCategoryId); initDiagramModel(modelSet, diagramCategoryId); initProfile(modelSet); initTemplate(modelSet); openDiagram(newURI); } catch (ServiceException e) { Activator.log.error(e); this.selectDiagramKindPage.setErrorMessage(e.getMessage()); return false; } finally { try { registry.disposeRegistry(); } catch (ServiceException ex) { } } return true; }
Source:
public JettyIoPoolManager(String name, Class<? extends Annotation> annotation) { this.name = name; this.annotation = annotation; }

Target:
public JettyIoPoolManager(String name, Class<? extends Annotation> annotation) { this.name = requireNonNull(name, "name is null");; this.annotation = requireNonNull(annotation, "annotation is null");; }
Source:
public S3AInputStream(S3ObjectAttributes s3Attributes, long contentLength, AmazonS3 client, FileSystem.Statistics stats, S3AInstrumentation instrumentation, long readahead, S3AInputPolicy inputPolicy) { Preconditions.checkArgument( StringUtils.isNotEmpty(s3Attributes.getBucket() ), "No Bucket"); Preconditions.checkArgument( StringUtils.isNotEmpty(s3Attributes.getKey() ), "No Key"); Preconditions.checkArgument(contentLength >= 0, "Negative content length"); this.bucket = s3Attributes.getBucket(); this.key = s3Attributes.getKey(); this.contentLength = contentLength; this.client = client; this.stats = stats; this.uri = "s3a://" + this.bucket + "/" + this.key; this.streamStatistics = instrumentation.newInputStreamStatistics(); this.serverSideEncryptionAlgorithm = s3Attributes.getServerSideEncryptionAlgorithm(); this.serverSideEncryptionKey = s3Attributes.getServerSideEncryptionKey(); this.inputPolicy = inputPolicy; setReadahead(readahead); }

Target:
public S3AInputStream(S3ObjectAttributes s3Attributes, long contentLength, AmazonS3 client, FileSystem.Statistics stats, S3AInstrumentation instrumentation, long readahead, S3AInputPolicy inputPolicy) { Preconditions.checkArgument(isNotEmpty(s3Attributes.getBucket()), "No Bucket"); Preconditions.checkArgument(isNotEmpty(s3Attributes.getKey()), "No Key"); Preconditions.checkArgument(contentLength >= 0, "Negative content length"); this.bucket = s3Attributes.getBucket(); this.key = s3Attributes.getKey(); this.contentLength = contentLength; this.client = client; this.stats = stats; this.uri = "s3a://" + this.bucket + "/" + this.key; this.streamStatistics = instrumentation.newInputStreamStatistics(); this.serverSideEncryptionAlgorithm = s3Attributes.getServerSideEncryptionAlgorithm(); this.serverSideEncryptionKey = s3Attributes.getServerSideEncryptionKey(); this.inputPolicy = inputPolicy; setReadahead(readahead); }
Source:
protected Control createDialogArea(Composite parent) { final Composite area = (Composite) super.createDialogArea(parent); final Composite container = new Composite(area, SWT.NONE); area.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); final GridLayout layout = new GridLayout(1, false); container.setLayout(layout); if (errors.isEmpty()) { final Label label = new Label(area, SWT.NONE); label.setText(Messages.ViewMigrationResultDialog_MigrationSuccess); } else { final TreeViewer diagnosticView = ValidationTreeViewerFactory.createValidationViewer(area); diagnosticView.setInput(errors); } return parent; }

Target:
protected Control createDialogArea(Composite parent) { final Composite area = (Composite) super.createDialogArea(parent); area.setLayout(new GridLayout(1, true)); final Composite container = new Composite(area, SWT.NONE); container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); final GridLayout layout = new GridLayout(1, false); container.setLayout(layout); if (errors.isEmpty()) { final Label label = new Label(container, SWT.NONE); label.setText(Messages.ViewMigrationResultDialog_MigrationSuccess); label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); } else { final TreeViewer diagnosticView = ValidationTreeViewerFactory.createValidationViewer(container); diagnosticView.setInput(errors); diagnosticView.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); } return parent; }
Source:
private static double computeSphericalExcess(LineString lineString) { if (lineString.getNumPoints() < 3) { throw new RuntimeException("Polygon is not valid: a loop contains less then 3 vertices."); } SphericalExcessCalculator calculator = new SphericalExcessCalculator(lineString.getEndPoint()); int start = lineString.getStartPoint().equals(lineString.getEndPoint()) ? 1 : 0; for (int i = start; i < lineString.getNumPoints(); i++) { calculator.add(lineString.getPointN(i)); } return calculator.computeSphericalExcess(); }

Target:
private static double computeSphericalExcess(LineString lineString) { if (lineString.getNumPoints() < 3) { throw new RuntimeException("Polygon is not valid: a loop contains less then 3 vertices."); } SphericalExcessCalculator calculator = new SphericalExcessCalculator(lineString.getEndPoint()); for (int i = 1; i < lineString.getNumPoints(); i++) { calculator.add(lineString.getPointN(i)); } return calculator.computeSphericalExcess(); }
Source:
private void updateGitInformation(Log log) { try { Repository repo = new Git().getRepo(); if (repo != null) { this.repo = repo.getConfig().getString("remote", "origin", "url"); final ObjectId head = repo.resolve("HEAD"); if (head != null && isNullOrEmpty(head.getName())) { this.commit = head.getName(); } } } catch (IOException e) { log.error("Failed to read Git information", e); } }

Target:
private void updateGitInformation(Log log) { try { Repository repo = new Git().getRepo(); if (repo != null) { this.repo = repo.getConfig().getString("remote", "origin", "url"); final ObjectId head = repo.resolve("HEAD"); if (head != null && !isNullOrEmpty(head.getName())) { this.commit = head.getName(); } } } catch (IOException e) { log.error("Failed to read Git information", e); } }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_request_detail); User user = User.getCurrentUser(); actionBar = new DynamicActionBar(this, getResources().getColor(R.color.black)); actionBar.setXMarkVisibility(View.VISIBLE, new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); actionBar.setCheckMarkVisibility(View.VISIBLE, new View.OnClickListener() { @Override public void onClick(View v) { Log.d("debug", "Setting Request to Active"); request.setState(Request.State.ACTIVE); request.setVendor(User.getCurrentUser()); request.saveEventually(new SaveCallback() { @Override public void done(ParseException e) { if (e == null) { try { RequestUpdateChannel.publish(RequestDetailActivity.this, request); } catch (JSONException e1) { onError(e); } Intent i = new Intent( RequestDetailActivity.this, RequestActiveVendorActivity.class ); i.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); startActivity(i); } else { onError(e); } } }); } }); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_request_detail); User user = User.getCurrentUser(); actionBar = new DynamicActionBar(this, getResources().getColor(R.color.black)); actionBar.setXMarkVisibility(View.VISIBLE, new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); actionBar.setCheckMarkVisibility(View.VISIBLE, new View.OnClickListener() { @Override public void onClick(View v) { Log.d("debug", "Setting Request to Active"); request.setState(Request.State.ACTIVE); request.setVendor(User.getCurrentUser()); request.saveEventually(new SaveCallback() { @Override public void done(ParseException e) { if (e == null) { try { RequestUpdateChannel.publish(RequestDetailActivity.this, request); } catch (JSONException e1) { onError(e1); } Intent i = new Intent( RequestDetailActivity.this, RequestActiveVendorActivity.class ); i.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); startActivity(i); } else { onError(e); } } }); } }); }
Source:
public static void assertNumInstances(Set<PackingPlan.ContainerPlan> containerPlans, String component, int numInstances) { int instancesFound = 0; for (PackingPlan.ContainerPlan containerPlan : containerPlans) { for (PackingPlan.InstancePlan instancePlan : containerPlan.getInstances()) { if (instancePlan.getComponentName().equals(component)) { instancesFound++; } } } Assert.assertEquals("Components " + component + " found in the container plans: ", instancesFound, numInstances); }

Target:
public static void assertNumInstances(Set<PackingPlan.ContainerPlan> containerPlans, String component, int numInstances) { int instancesFound = 0; for (PackingPlan.ContainerPlan containerPlan : containerPlans) { for (PackingPlan.InstancePlan instancePlan : containerPlan.getInstances()) { if (instancePlan.getComponentName().equals(component)) { instancesFound++; } } } Assert.assertEquals(numInstances, instancesFound); }
Source:
public void updateInterestFilter(final boolean on, StructuredViewer viewer) { if (viewer != null) { if (on) { if (showEmptyViewMessage && viewer instanceof TreeViewer) { Tree tree = ((TreeViewer) viewer).getTree(); Listener drawingListener = viewerToDrawerMap.get(viewer); if (drawingListener == null) { EmptyContextDrawer drawer = new EmptyContextDrawer(tree); viewerToDrawerMap.put(viewer, drawer); tree.addListener(SWT.Paint, drawer); } } installInterestFilter(viewer); ContextUiPlugin.getViewerManager().addFilteredViewer(viewer, this); } else { if (showEmptyViewMessage && viewer instanceof TreeViewer) { Tree tree = ((TreeViewer) viewer).getTree(); EmptyContextDrawer drawer = viewerToDrawerMap.remove(viewer); if (drawer != null && !tree.isDisposed()) { tree.removeListener(SWT.Paint, drawer); } } ContextUiPlugin.getViewerManager().removeFilteredViewer(viewer); uninstallInterestFilter(viewer); } } }

Target:
public void updateInterestFilter(final boolean on, StructuredViewer viewer) { if (viewer != null) { if (on) { if (showEmptyViewMessage && viewer instanceof TreeViewer) { Tree tree = ((TreeViewer) viewer).getTree(); Listener drawingListener = viewerToDrawerMap.get(viewer); if (drawingListener == null && !tree.isDisposed()) { EmptyContextDrawer drawer = new EmptyContextDrawer(tree); viewerToDrawerMap.put(viewer, drawer); tree.addListener(SWT.Paint, drawer); } } installInterestFilter(viewer); ContextUiPlugin.getViewerManager().addFilteredViewer(viewer, this); } else { if (showEmptyViewMessage && viewer instanceof TreeViewer) { Tree tree = ((TreeViewer) viewer).getTree(); EmptyContextDrawer drawer = viewerToDrawerMap.remove(viewer); if (drawer != null && !tree.isDisposed()) { tree.removeListener(SWT.Paint, drawer); } } ContextUiPlugin.getViewerManager().removeFilteredViewer(viewer); uninstallInterestFilter(viewer); } } }
Source:
protected int compareTo(Object c1, Object c2) { Object cc1 = c1; Object cc2 = c2; Class<?> clazz1 = c1 == null ? Null.class : c1.getClass(); Class<?> clazz2 = c2 == null ? Null.class : c2.getClass(); if (!clazz1.equals(clazz2) || !(cc1 instanceof Comparable)) { if (cc1 instanceof Number) { if (cc2 instanceof Number) { cc1 = ((Number) cc1).doubleValue(); cc2 = ((Number) cc2).doubleValue(); } else { return cc2 instanceof MinKey ? 1 : -1; } } else if (cc2 instanceof Number && !(cc1 instanceof MinKey) && !(cc1 instanceof MaxKey)) { return 1; } else { Integer type1 = CLASS_TO_WEIGHT.get(clazz1); Integer type2 = CLASS_TO_WEIGHT.get(clazz2); if (type1 != null && type2 != null) { cc1 = type1; cc2 = type2; } else { } } } return ((Comparable) cc1).compareTo(cc2); }

Target:
protected int compareTo(Object c1, Object c2) { Object cc1 = c1; Object cc2 = c2; Class<?> clazz1 = c1 == null ? Null.class : c1.getClass(); Class<?> clazz2 = c2 == null ? Null.class : c2.getClass(); if (!clazz1.equals(clazz2) || !(cc1 instanceof Comparable)) { boolean checkTypes = true; if (cc1 instanceof Number) { if (cc2 instanceof Number) { cc1 = new BigDecimal(cc1.toString()); cc2 = new BigDecimal(cc2.toString()); checkTypes = false; } } if (checkTypes) { Integer type1 = CLASS_TO_WEIGHT.get(clazz1); Integer type2 = CLASS_TO_WEIGHT.get(clazz2); if (type1 != null && type2 != null) { cc1 = type1; cc2 = type2; } else { throw new FongoException("Don't know how to compare " + cc1.getClass() + " and " + cc2.getClass() + " values are : " + c1 + " vs " + c2); } } } return ((Comparable) cc1).compareTo(cc2); }
Source:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + Arrays.hashCode(children); result = prime * result + ((groupName == null) ? 0 : groupName.hashCode()); return result; }

Target:
public int hashCode() { return Objects.hashCode(groupName); }
Source:
CompositeT commonAncestor(CompositeT object1, CompositeT object2) { if (object1 == object2) { return object1; } else if (isDescendant(object1, object2)) { return object1; } else if (isDescendant(object2, object1)) { return object2; } Stack<CompositeT> stack1 = new Stack<>(); Stack<CompositeT> stack2 = new Stack<>(); for (CompositeT c : ancestorsFrom(object1)) { stack1.push(c); } for (CompositeT c : ancestorsFrom(object2)) { stack2.push(c); } if (stack1.isEmpty() || stack2.isEmpty()) { return null; } else { do { CompositeT pop1 = stack1.pop(); CompositeT pop2 = stack2.pop(); if (pop1 != pop2) { return pop1.getParent(); } } while (!stack1.isEmpty() && !stack2.isEmpty()); return null; } }

Target:
CompositeT commonAncestor(CompositeT object1, CompositeT object2) { if (object1 == object2) { return object1; } else if (isDescendant(object1, object2)) { return object1; } else if (isDescendant(object2, object1)) { return object2; } ArrayDeque<CompositeT> stack1 = new ArrayDeque<>(); ArrayDeque<CompositeT> stack2 = new ArrayDeque<>(); for (CompositeT c : ancestorsFrom(object1)) { stack1.push(c); } for (CompositeT c : ancestorsFrom(object2)) { stack2.push(c); } if (stack1.isEmpty() || stack2.isEmpty()) { return null; } else { do { CompositeT pop1 = stack1.pop(); CompositeT pop2 = stack2.pop(); if (pop1 != pop2) { return pop1.getParent(); } } while (!stack1.isEmpty() && !stack2.isEmpty()); return null; } }