auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void reflogSeek() throws IOException { PersonIdent who = new PersonIdent("Log", "Ger", 1500079709, -8 * 60); String msg = "test"; ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ReftableWriter writer = new ReftableWriter() .setMinUpdateIndex(1) .setMaxUpdateIndex(1) .begin(buffer); writer.writeLog(MASTER, 1, who, ObjectId.zeroId(), id(1), msg); writer.writeLog(NEXT, 1, who, ObjectId.zeroId(), id(2), <START> msg); <END> writer.finish(); byte[] table = buffer.toByteArray(); ReftableReader t = read(table); try (LogCursor c = t.seekLog(MASTER, Long.MAX_VALUE)) { assertTrue(c.next()); assertEquals(c.getReflogEntry().getComment(), msg); } try (LogCursor c = t.seekLog(MASTER, 0)) { assertFalse(c.next()); } try (LogCursor c = t.seekLog(MASTER, 1)) { assertTrue(c.next()); assertEquals(c.getUpdateIndex(), 1); } try (LogCursor c = t.seekLog(NEXT, Long.MAX_VALUE)) { assertTrue(c.next()); assertEquals(c.getReflogEntry().getComment(), msg); } try (LogCursor c = t.seekLog(NEXT, 0)) { assertFalse(c.next()); } try (LogCursor c = t.seekLog(NEXT, 1)) { assertTrue(c.next()); assertEquals(c.getUpdateIndex(), 1); } }</code><technical_language>a msg for NEXT, distinguish in test assertions</technical_language>

Target:
public void reflogSeek() throws IOException { PersonIdent who = new PersonIdent("Log", "Ger", 1500079709, -8 * 60); String msg = "test"; String msgNext = "test next"; ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ReftableWriter writer = new ReftableWriter() .setMinUpdateIndex(1) .setMaxUpdateIndex(1) .begin(buffer); writer.writeLog(MASTER, 1, who, ObjectId.zeroId(), id(1), msg); writer.writeLog(NEXT, 1, who, ObjectId.zeroId(), id(2), msgNext); writer.finish(); byte[] table = buffer.toByteArray(); ReftableReader t = read(table); try (LogCursor c = t.seekLog(MASTER, Long.MAX_VALUE)) { assertTrue(c.next()); assertEquals(c.getReflogEntry().getComment(), msg); } try (LogCursor c = t.seekLog(MASTER, 0)) { assertFalse(c.next()); } try (LogCursor c = t.seekLog(MASTER, 1)) { assertTrue(c.next()); assertEquals(c.getUpdateIndex(), 1); assertEquals(c.getReflogEntry().getComment(), msg); } try (LogCursor c = t.seekLog(NEXT, Long.MAX_VALUE)) { assertTrue(c.next()); assertEquals(c.getReflogEntry().getComment(), msgNext); } try (LogCursor c = t.seekLog(NEXT, 0)) { assertFalse(c.next()); } try (LogCursor c = t.seekLog(NEXT, 1)) { assertTrue(c.next()); assertEquals(c.getUpdateIndex(), 1); assertEquals(c.getReflogEntry().getComment(), msgNext); } }
Source:
<code>public Response createFromYaml(String yaml) { URI uri; try { uri = new URI(yaml); } catch (URISyntaxException e) { uri = null; } if (uri != null) { log.debug("Input to createFromYaml might be a URL: " + uri); <START> DefaultHttpClient httpClient = new DefaultHttpClient(); <END> HttpGet request = new HttpGet(uri); HttpResponse response = null; try { response = httpClient.execute(request); if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); response.getEntity().writeTo(byteArrayOutputStream); yaml = byteArrayOutputStream.toString(); log.debug("Continuing using the contents of the URL: {}", yaml); } } catch (IOException e) { log.debug("Could not retrieve from URL due to exception, proceeding to treat as YAML", e); } } log.debug("Creating app from yaml"); Reader input = new StringReader(yaml); AssemblyTemplate at = camp().pdp().registerDeploymentPlan(input); return launch(at); }</code><technical_language>do yaml = ResourceUtils.create(mgmt()).getResourceAsString(uri.toString());. This handles some "special" URLs classpath:// etc. Annoying change uri a String first</technical_language>

Target:
public Response createFromYaml(String yaml) { URI uri; try { uri = new URI(yaml); } catch (URISyntaxException e) { uri = null; } if (uri != null) { log.debug("Input to createFromYaml might be a URL: " + uri); yaml = ResourceUtils.create(mgmt()).getResourceAsString(uri.toString()); log.debug("Continuing using the contents of the URL: {}", yaml); } log.debug("Creating app from yaml"); Reader input = new StringReader(yaml); AssemblyTemplate at = camp().pdp().registerDeploymentPlan(input); return launch(at); }
Source:
<code>protected <T> Observable buildUseCaseObservable(Map<String, T> parameters) { return surveyRepository.getUsers() .concatMap(new Function<List<User>, Observable<Pair<User, List<User>>>>() { @Override public Observable<Pair<User, List<User>>> apply(final List<User> users) { return userRepository.getSelectedUser() .map(new Function<Long, Pair<User, List<User>>>() { @Override public Pair<User, List<User>> apply(final Long selectedUserId) { User currentUser = null; for (User u : users) { <START> if (selectedUserId == u.getId()) { <END> currentUser = u; break; } } if (currentUser != null) { users.remove(currentUser); } return new Pair<>(currentUser, users); } }); } }); }</code><technical_language>Ditto .equals() comparison</technical_language>

Target:
protected <T> Observable buildUseCaseObservable(Map<String, T> parameters) { return surveyRepository.getUsers() .concatMap(new Function<List<User>, Observable<Pair<User, List<User>>>>() { @Override public Observable<Pair<User, List<User>>> apply(final List<User> users) { return userRepository.getSelectedUser() .map(new Function<Long, Pair<User, List<User>>>() { @Override public Pair<User, List<User>> apply(final Long selectedUserId) { User currentUser = null; for (User u : users) { if (selectedUserId.equals(u.getId())) { currentUser = u; break; } } if (currentUser != null) { users.remove(currentUser); } return new Pair<>(currentUser, users); } }); } }); }
Source:
<code>public List getEmulatedMachinesList() { List resultList = lst(); resultList.add("vdsmfake"); <START> resultList.add("host25-rack06.scale.openstack.engineering.redhat.com"); <END> resultList.add("pc-0.12"); resultList.add("pc-0.13"); resultList.add("pc-0.14"); resultList.add("pc-0.15"); resultList.add("pc-1.0"); resultList.add("pc-1.0"); resultList.add("rhel6.4.0"); resultList.add("pc"); resultList.add("isapc"); return resultList; }</code><technical_language>please remove this</technical_language>

Target:
public List getEmulatedMachinesList() { List resultList = lst(); resultList.add("vdsmfake"); resultList.add("pc-0.12"); resultList.add("pc-0.13"); resultList.add("pc-0.14"); resultList.add("pc-0.15"); resultList.add("pc-1.0"); resultList.add("pc-1.0"); resultList.add("rhel6.4.0"); resultList.add("pc"); resultList.add("isapc"); return resultList; }
Source:
<code>public String toString() { <START> if (this.hashtag != null){ <END> return "Host with Hashtag [hostname=" + hostname + ", ipAddress=" + ipAddress + ", port=" + port + ", rack: " + rack + ", datacenter: " + datacenter + ", status: " + status.name() + ", hashtag=" + hashtag + "]"; } return "Host [hostname=" + hostname + ", ipAddress=" + ipAddress + ", port=" + port + ", rack: " + rack + ", datacenter: " + datacenter + ", status: " + status.name() + "]"; }</code><technical_language>Try combining returns. do require a if else here</technical_language>

Target:
public String toString() { return "Host [hostname=" + hostname + ", ipAddress=" + ipAddress + ", port=" + port + ", rack: " + rack + ", datacenter: " + datacenter + ", status: " + status.name() + ", hashtag=" + hashtag + "]"; }
Source:
<code>public void start() throws IOException { for (final FireDepartment fireDepartment : fireDepartments) { DataSchema schema = fireDepartment.getDataSchema(); final FireChief chief = new FireChief(fireDepartment); <START> List<FireChief> chiefsOfDataSource = chiefs.get(schema.getDataSource()); <END> if (chiefsOfDataSource == null){ chiefsOfDataSource = new ArrayList<RealtimeManager.FireChief>(); chiefs.put(schema.getDataSource(), chiefsOfDataSource); } chiefsOfDataSource.add(chief); chief.setName(String.format("chief-%s", schema.getDataSource())); chief.setDaemon(true); chief.init(); chief.start(); } }</code><technical_language>call this chiefs</technical_language>

Target:
public void start() throws IOException { for (final FireDepartment fireDepartment : fireDepartments) { DataSchema schema = fireDepartment.getDataSchema(); final FireChief chief = new FireChief(fireDepartment); List<FireChief> chiefs = this.chiefs.get(schema.getDataSource()); if (chiefs == null) { chiefs = new ArrayList<RealtimeManager.FireChief>(); this.chiefs.put(schema.getDataSource(), chiefs); } chiefs.add(chief); chief.setName(String.format("chief-%s", schema.getDataSource())); chief.setDaemon(true); chief.init(); chief.start(); } }
Source:
<code>protected void doInit() throws Exception { super.doInit(); <START> <END> resolvedTemplate = SqlHelper.resolveQuery(getEndpoint().getCamelContext(), getEndpoint().getTemplate(), null); }</code><technical_language>This doStart SqlHelper.resolveQuery potentially load SQL template file system. SQL docs</technical_language>

Target:
protected void doInit() throws Exception { super.doInit(); String template = getEndpoint().getTemplate(); if (ResourceHelper.isClasspathUri(template)) { resolvedTemplate = SqlHelper.resolveQuery(getEndpoint().getCamelContext(), template, null); } }
Source:
<code>public static boolean isChimeric(final SAMRecord rec, final int maxInsertSize, final Set<PairOrientation> expectedOrientations) { <START> return (Math.abs(rec.getInferredInsertSize()) > maxInsertSize || <END> !rec.getReferenceIndex().equals(rec.getMateReferenceIndex()) || expectedOrientations.contains(SamPairUtil.getPairOrientation(rec)) || rec.getAttribute("SA") != null); }</code><technical_language>I this method either: 1. start if (rec.getReadUnmappedFlag() || !rec.getReadPairedFlag() || rec.getMateUnmappedFlag()) return false 2. explicit in javaodoc legitimate call this method a read is paired mate mapped</technical_language>

Target:
public static boolean isChimeric(final SAMRecord rec, final int maxInsertSize, final Set<PairOrientation> expectedOrientations) { return !(rec.getReadUnmappedFlag() || !rec.getReadPairedFlag() || rec.getMateUnmappedFlag()) && (Math.abs(rec.getInferredInsertSize()) > maxInsertSize || !rec.getReferenceIndex().equals(rec.getMateReferenceIndex()) || expectedOrientations.contains(SamPairUtil.getPairOrientation(rec)) || rec.getAttribute("SA") != null); }
Source:
<code>public void onBackPressed() { <START> androidx.fragment.app.Fragment fragment = getSupportFragmentManager() <END> .findFragmentByTag(ImageSettingsDialogFragment.IMAGE_SETTINGS_DIALOG_TAG); if (fragment != null && fragment.isVisible()) { ((ImageSettingsDialogFragment) fragment).dismissFragment(); } else { super.onBackPressed(); } }</code><technical_language>I is need for a full package path import top of file</technical_language>

Target:
public void onBackPressed() { Fragment fragment = getSupportFragmentManager().findFragmentByTag(ImageSettingsDialogFragment.IMAGE_SETTINGS_DIALOG_TAG); if (fragment != null && fragment.isVisible()) { ((ImageSettingsDialogFragment) fragment).dismissFragment(); } else { super.onBackPressed(); } }
Source:
<code>public void channelActive(ChannelHandlerContext ctx) throws RestServiceException { this.ctx = ctx; try { messageHandler = requestDelegator.getMessageHandler(); responseHandler = new NettyResponseHandler(ctx, nettyMetrics); } catch (Exception e) { logger.error("Unable to obtain message/response handlers - " + e); nettyMetrics.channelActiveTasksFailureCount.inc(); throw new RestServiceException("Unable to obtain message/response handlers - " + e, RestServiceErrorCode.ChannelActiveTasksFailure); } }</code><technical_language>dont want java docs here</technical_language>

Target:
public void channelActive(ChannelHandlerContext ctx) throws RestServiceException { this.ctx = ctx; requestHandler = requestHandlerController.getRequestHandler(); responseHandler = new NettyResponseHandler(ctx, nettyMetrics); if (requestHandler == null || responseHandler == null) { nettyMetrics.channelActiveTasksFailureCount.inc(); String msg = requestHandler == null ? "RestRequestHandler received was null" : "RestResponseHandler received was null"; logger.error(msg); throw new RestServiceException(msg, RestServiceErrorCode.ChannelActiveTasksFailure); } }
Source:
<code>public void dispose() { synchronized(PhoneProxy.lockForRadioTechnologyChange) { mIsRadioTechnologyChangeOngoing = true; mRuimRecords.unregisterForRecordsLoaded(h); mCM.unregisterForAvailable(h); mCM.unregisterForOffOrNotAvailable(h); mCM.unregisterForOn(h); mCM.unregisterForNVReady(h); mSST.unregisterForNetworkAttach(h); mCM.unSetOnSuppServiceNotification(h); mCM.unSetOnCallRing(h); <START> h.removeCallbacksAndMessages(null); <END> mCT.dispose(); mDataConnection.dispose(); mSST.dispose(); mSMS.dispose(); ((RuimFileHandler) mIccFileHandler).dispose(); mRuimRecords.dispose(); mRuimCard.dispose(); mRuimPhoneBookInterfaceManager.dispose(); mRuimSmsInterfaceManager.dispose(); mSubInfo.dispose(); this.mCM = null; this.mNvLoadedRegistrants = null; this.mCT = null; this.mDataConnection = null; this.mPostDialHandler = null; this.mRuimCard = null; this.mRuimPhoneBookInterfaceManager = null; this.mRuimRecords = null; this.mRuimSmsInterfaceManager = null; this.mSMS = null; this.mSST = null; this.mSubInfo = null; this.mIccFileHandler = null; this.h = null; } }</code><technical_language>h.removeCallbacksAndMessages(null) instead. Done in Patch set 2</technical_language>

Target:
public void dispose() { synchronized(PhoneProxy.lockForRadioTechnologyChange) { mRuimRecords.unregisterForRecordsLoaded(h); mCM.unregisterForAvailable(h); mCM.unregisterForOffOrNotAvailable(h); mCM.unregisterForOn(h); mCM.unregisterForNVReady(h); mSST.unregisterForNetworkAttach(h); mCM.unSetOnSuppServiceNotification(h); mCM.unSetOnCallRing(h); mCT.dispose(); mDataConnection.dispose(); mSST.dispose(); mSMS.dispose(); mIccFileHandler.dispose(); mRuimRecords.dispose(); mRuimCard.dispose(); mRuimPhoneBookInterfaceManager.dispose(); mRuimSmsInterfaceManager.dispose(); mSubInfo.dispose(); } }
Source:
<code><START> public synchronized void onPartitionsAssigned(@NotNull final Collection<TopicPartition> topicPartitions) { <END> final Instant assignmentTime = Instant.now(); for (final TopicPartition topicPartition : topicPartitions) { @NotNull final KafkaPositionKey key = new KafkaPositionKey(topicPartition.topic(), topicPartition.partition(), _brooklinInstance, _brooklinTaskId, _taskStartTime); _ownedKeys.put(topicPartition, key); _needingInit.add(topicPartition); @NotNull final KafkaPositionValue value = (KafkaPositionValue) _positions.computeIfAbsent(key, s -> new KafkaPositionValue()); value.setAssignmentTime(assignmentTime); } }</code><technical_language>I understand emphasize connection methods, calling this onPartitionsAssigned feels a confusing in this class; ConsumerRebalanceListener is intended convey some subscription/notification semantics do apply here. applies onPartitionsRevoked onRecordsReceived</technical_language>

Target:
public synchronized void onPartitionsAssigned(@NotNull final Collection<TopicPartition> topicPartitions) { final Instant assignmentTime = Instant.now(); for (final TopicPartition topicPartition : topicPartitions) { final KafkaPositionKey key = new KafkaPositionKey(topicPartition.topic(), topicPartition.partition(), BrooklinInstanceInfo.getInstanceName(), _datastreamTaskPrefix, _datastreamTaskName, _connectorTaskStartTime); _ownedKeys.put(topicPartition, key); _needingInit.add(topicPartition); final KafkaPositionValue value = (KafkaPositionValue) _positions.computeIfAbsent(key, s -> new KafkaPositionValue()); value.setAssignmentTime(assignmentTime); } }
Source:
<code><START> public void checkAttributeValue(PerunSessionImpl perunSession, Resource resource, Group group, Attribute attribute) throws InternalErrorException, WrongAttributeValueException, WrongReferenceAttributeValueException, WrongAttributeAssignmentException, GroupResourceMismatchException { <END> }</code><technical_language>Please remove GroupResourceMismatchException MemberResourceMismatchException member-resource group-resource attribute modules (api, abstract). If passed entities mismatch, programmers fault. want exceptions in outer api (Api Entry, in Bl/BlImpl). please catch exceptions in modules implementation wrap InternalErrorException. This result in lowering exceptions usages in normal methods AttributesManager in normal managers</technical_language>

Target:
public void checkAttributeValue(PerunSessionImpl perunSession, Resource resource, Group group, Attribute attribute) throws InternalErrorException, WrongAttributeValueException, WrongReferenceAttributeValueException, WrongAttributeAssignmentException { }
Source:
<code>public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit unit = phaseContext.getDeploymentUnit(); final DeploymentUnit top = unit.getParent() == null ? unit : unit.getParent(); final ModuleLoader moduleLoader = Module.getBootModuleLoader(); final ModuleSpecification moduleSpec = unit.getAttachment(Attachments.MODULE_SPECIFICATION); <START> moduleSpec.addSystemDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.fromString("jakarta.security.enterprise.api"), false, false, true, false)); <END> Boolean securityPresent = top.getAttachment(EESecurityAnnotationProcessor.SECURITY_PRESENT); if(securityPresent != null && securityPresent) { moduleSpec.addSystemDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.fromString("org.glassfish.soteria"), false, false, true, false)); } }</code><technical_language>Please leave module name unchanged. This module provides classes in javax.security.enterprise package. necessary change module name</technical_language>

Target:
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit unit = phaseContext.getDeploymentUnit(); final DeploymentUnit top = unit.getParent() == null ? unit : unit.getParent(); final ModuleLoader moduleLoader = Module.getBootModuleLoader(); final ModuleSpecification moduleSpec = unit.getAttachment(Attachments.MODULE_SPECIFICATION); moduleSpec.addSystemDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.fromString("javax.security.enterprise.api"), false, false, true, false)); Boolean securityPresent = top.getAttachment(EESecurityAnnotationProcessor.SECURITY_PRESENT); if(securityPresent != null && securityPresent) { moduleSpec.addSystemDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.fromString("org.glassfish.soteria"), false, false, true, false)); } }
Source:
<code>public boolean skipToKeyframeBefore(long timeUs) { <START> long nextOffset = infoQueue.skipToKeyframeBefore(timeUs, false); <END> if (nextOffset == C.POSITION_UNSET) { return false; } dropDownstreamTo(nextOffset); return true; }</code><technical_language>replace body of this method just: return skipToKeyframeBefore(timeUs, false)</technical_language>

Target:
public boolean skipToKeyframeBefore(long timeUs) { return infoQueue.skipToKeyframeBefore(timeUs, false); }
Source:
<code>protected boolean mergeRecursive(int callDepth, RevCommit h1, RevCommit h2, List<RevCommit> commonAncestors) throws IOException { <START> boolean clean = false; <END> List<RevCommit> mergedCommonAncestors = new ArrayList<RevCommit>(); RevCommit firstCommonAncestor = null; if (commonAncestors == null) commonAncestors = new ArrayList<RevCommit>(); if (commonAncestors.isEmpty()) commonAncestors.addAll(reverseCommitList(getMergeBases(h1, h2))); if (!commonAncestors.isEmpty()) { firstCommonAncestor = commonAncestors.remove(0); mergedCommonAncestors.add(firstCommonAncestor); } if (commonAncestors.isEmpty()) { resultTree = (firstCommonAncestor == null ? null : firstCommonAncestor.getTree().getId()); } else { for (RevCommit commonAncestor : commonAncestors) { resultTree = null; RevCommit saved_b1; RevCommit saved_b2; callDepth++; dircache.clear(); saved_b1 = h1; saved_b2 = h2; mergeRecursive(callDepth, firstCommonAncestor, commonAncestor, null); if (resultTree == null) { throw new IOException(MessageFormat.format( JGitText.get().mergeRecursiveReturnedNoCommit, callDepth, (firstCommonAncestor == null ? "null" : firstCommonAncestor.name()), commonAncestor.name())); } mergedCommonAncestors.add(commonAncestor); h1 = saved_b1; h2 = saved_b2; callDepth--; } } clean = mergeTrees(openTree(resultTree), h1.getTree(), h2.getTree()); return clean; }</code><technical_language>need clean. I remove this variable in end simply call "return mergeTrees(..."</technical_language>

Target:
protected boolean mergeRecursive(int callDepth, RevCommit h1, RevCommit h2, List<RevCommit> commonAncestors) throws IOException { RevCommit firstCommonAncestor = null; if (commonAncestors == null) commonAncestors = new ArrayList<RevCommit>(); if (commonAncestors.isEmpty()) commonAncestors.addAll(reverseCommitList(getMergeBases(h1, h2))); if (!commonAncestors.isEmpty()) { firstCommonAncestor = commonAncestors.remove(0); } if (commonAncestors.isEmpty()) { resultTree = (firstCommonAncestor == null ? null : firstCommonAncestor.getTree().getId()); } else { for (RevCommit commonAncestor : commonAncestors) { resultTree = null; if (!mergeRecursive(callDepth + 1, firstCommonAncestor, commonAncestor, null)) { return false; } if (resultTree == null) { throw new IOException(MessageFormat.format( JGitText.get().mergeRecursiveReturnedNoCommit, callDepth + 1, (firstCommonAncestor == null ? "null" : firstCommonAncestor.name()), commonAncestor.name())); } } } return mergeTrees(openTree(resultTree), h1.getTree(), h2.getTree()); }
Source:
<code>private String getOtherIdFromDTO(DatasetVersionDTO datasetVersionDTO) { List<String> otherIds = new ArrayList<>(); for (Map.Entry<String, MetadataBlockDTO> entry : datasetVersionDTO.getMetadataBlocks().entrySet()) { String key = entry.getKey(); MetadataBlockDTO value = entry.getValue(); if ("citation".equals(key)) { for (FieldDTO fieldDTO : value.getFields()) { if (DatasetFieldConstant.otherId.equals(fieldDTO.getTypeName())) { for (HashSet<FieldDTO> foo : fieldDTO.getMultipleCompound()) { for (FieldDTO next : foo) { if (DatasetFieldConstant.otherIdValue.equals(next.getTypeName())) { otherIds.add(next.getSinglePrimitive()); } } } } } } } if (!otherIds.isEmpty()) { for (String otherId : otherIds) { <START> if (otherId.contains(GlobalId.DOI_PROTOCOL) || otherId.contains(GlobalId.HDL_PROTOCOL)) { <END> return otherId; } } for (String otherId : otherIds) { try { HandleResolver hr = new HandleResolver(); hr.resolveHandle(otherId); return GlobalId.HDL_PROTOCOL + ":" + otherId; } catch (HandleException e) { logger.fine("Not a valid handle: " + e.toString()); } } } return null; }</code><technical_language>this if (otherId.startsWith(GlobalId.DOI_PROTOCOL) ... instead? if (otherId.toLowerCase().startsWith(GlobalId.DOI_PROTOCOL) ...</technical_language>

Target:
private String getOtherIdFromDTO(DatasetVersionDTO datasetVersionDTO) { List<String> otherIds = new ArrayList<>(); for (Map.Entry<String, MetadataBlockDTO> entry : datasetVersionDTO.getMetadataBlocks().entrySet()) { String key = entry.getKey(); MetadataBlockDTO value = entry.getValue(); if ("citation".equals(key)) { for (FieldDTO fieldDTO : value.getFields()) { if (DatasetFieldConstant.otherId.equals(fieldDTO.getTypeName())) { for (HashSet<FieldDTO> foo : fieldDTO.getMultipleCompound()) { for (FieldDTO next : foo) { if (DatasetFieldConstant.otherIdValue.equals(next.getTypeName())) { otherIds.add(next.getSinglePrimitive()); } } } } } } } if (!otherIds.isEmpty()) { for (String otherId : otherIds) { if (otherId.startsWith(GlobalId.DOI_PROTOCOL) || otherId.startsWith(GlobalId.HDL_PROTOCOL) || otherId.startsWith(GlobalId.DOI_RESOLVER_URL) || otherId.startsWith(GlobalId.HDL_RESOLVER_URL)) { return otherId; } } for (String otherId : otherIds) { try { HandleResolver hr = new HandleResolver(); hr.resolveHandle(otherId); return GlobalId.HDL_PROTOCOL + ":" + otherId; } catch (HandleException e) { logger.fine("Not a valid handle: " + e.toString()); } } } return null; }
Source:
<code>public void afterChunk(ChunkContext context) { int estimatedTotalNumberOfLines = (int)context.getStepContext().getStepExecutionContext() .get(JobParametersNames.NUMBER_OF_LINES); int read = context.getStepContext().getStepExecution().getReadCount(); int write = context.getStepContext().getStepExecution().getWriteCount(); int skip = context.getStepContext().getStepExecution().getReadSkipCount() + context.getStepContext().getStepExecution().getProcessSkipCount() + context.getStepContext().getStepExecution().getWriteSkipCount(); String chunkStatisticsMessage = "Chunk stats: Items read count " + read + ", items write count " + write + " items skip count " + skip; if (estimatedTotalNumberOfLines != 0) { int percent = (read * 100 / estimatedTotalNumberOfLines); <START> logger.info( <END> percent + "% " + chunkStatisticsMessage); } else { logger.info(chunkStatisticsMessage); } }</code><technical_language>legacy line break</technical_language>

Target:
public void afterChunk(ChunkContext context) { long estimatedTotalNumberOfLines = (long)context.getStepContext().getStepExecutionContext() .get(ExecutionContextParametersNames.NUMBER_OF_LINES); long read = context.getStepContext().getStepExecution().getReadCount(); long write = context.getStepContext().getStepExecution().getWriteCount(); long skip = context.getStepContext().getStepExecution().getReadSkipCount() + context.getStepContext().getStepExecution().getProcessSkipCount() + context.getStepContext().getStepExecution().getWriteSkipCount(); String chunkStatisticsMessage = "Items read =" + read + ", items written = " + write + ", items skipped = " + skip; if (estimatedTotalNumberOfLines != 0) { int percent = (int) ((read * 100) / estimatedTotalNumberOfLines); logger.info(percent + "% complete: " + chunkStatisticsMessage); } else { logger.info(chunkStatisticsMessage); } }
Source:
<code>protected void endWithFailure() { if (commandCoordinatorUtil.getCommandExecutionStatus(getCommandId()) != CommandExecutionStatus.EXECUTED) { changeStorageDomainStatusInTransaction(loadStoragePoolIsoMap(), StorageDomainStatus.Unknown); auditLogDirector.log(this, AuditLogType.USER_DEACTIVATE_STORAGE_DOMAIN_OVF_UPDATE_INCOMPLETE); getReturnValue().setEndActionTryAgain(false); setSucceeded(false); } else if (getParameters().isForceMaintenance()) { executeDeactivateCommand(); <START> setSucceeded(true); <END> } else { StoragePoolIsoMap map = loadStoragePoolIsoMap(); changeDomainStatusWithCompensation(map, StorageDomainStatus.Unknown, StorageDomainStatus.Active, getCompensationContext()); getReturnValue().setEndActionTryAgain(false); setSucceeded(false); } }</code><technical_language>discussed I simply add audit log done in line 133</technical_language>

Target:
protected void endWithFailure() { if (commandCoordinatorUtil.getCommandExecutionStatus(getCommandId()) != CommandExecutionStatus.EXECUTED) { changeStorageDomainStatusInTransaction(loadStoragePoolIsoMap(), StorageDomainStatus.Unknown); auditLogDirector.log(this, AuditLogType.USER_DEACTIVATE_STORAGE_DOMAIN_OVF_UPDATE_INCOMPLETE); } else if (getParameters().isForceMaintenance()) { executeDeactivateCommand(); } else { changeStorageDomainStatusInTransaction(loadStoragePoolIsoMap(), StorageDomainStatus.Active); auditLogDirector.log(this, AuditLogType.USER_DEACTIVATE_STORAGE_DOMAIN_FAILED); } setSucceeded(true); }
Source:
<code>public void codeMarkdownInMessages() throws Exception { final String alias = "rokit"; final Aliases aliases = new DyBase().user(new URN("urn:test:75065")).aliases(); aliases.add(alias); final Inbox inbox = aliases.iterate().iterator().next().inbox(); final Bout bout = inbox.bout(inbox.start()); <START> final String before = " 4 leading spaces retained "; <END> final String after = " 4 leading spaces retained"; bout.messages().post(before); final Iterator<Message> result = bout.messages().search(after).iterator(); MatcherAssert.assertThat( "no matching result found", result.hasNext() ); MatcherAssert.assertThat( result.next().text(), Matchers.equalTo(after) ); }</code><technical_language>@kitsook variable inline</technical_language>

Target:
public void codeMarkdownInMessages() throws Exception { final String alias = "rokit"; final Aliases aliases = new DyBase().user(new URN("urn:test:75065")).aliases(); aliases.add(alias); final Inbox inbox = aliases.iterate().iterator().next().inbox(); final Bout bout = inbox.bout(inbox.start()); bout.messages().post(" 4 leading spaces retained "); final Iterator<Message> result = bout.messages().iterate().iterator(); MatcherAssert.assertThat( "expected message not found", result.hasNext() ); MatcherAssert.assertThat( result.next().text(), Matchers.equalTo(" 4 leading spaces retained") ); }
Source:
<code>public static <K, V> WriteOnlyManyEntriesCommand<K, V> copy(WriteOnlyManyEntriesCommand<K, V> command, Collection<Object> keys) { <START> WriteOnlyManyEntriesCommand<K, V> copy = new WriteOnlyManyEntriesCommand<>(command); <END> copy.setEntries(filterEntries(command.getEntries(), keys)); return copy; }</code><technical_language>duplicates WriteOnlyManyEntriesCommand.withEntries, for other copy</technical_language>

Target:
public static <K, V> WriteOnlyManyEntriesCommand<K, V> copy(WriteOnlyManyEntriesCommand<K, V> command, Collection<Object> keys) { return new WriteOnlyManyEntriesCommand<>(command).withEntries(filterEntries(command.getEntries(), keys)); }
Source:
<code><START> public BitmapDescriptor getCachedMarkerImage(String url, double scale) { <END> Map<Double, BitmapDescriptor> bitmaps = mMarkerImagesCache.get(url); BitmapDescriptor bitmapDescriptor = null; if (bitmaps != null) { bitmapDescriptor = bitmaps.get(scale); } if (bitmapDescriptor == null) { Bitmap bitmap = mBitmapCache.get(url); if (bitmap != null) { bitmapDescriptor = scaleIcon(bitmap, scale); putMarkerImagesCache(url, scale, bitmapDescriptor); } } return bitmapDescriptor; }</code><technical_language>expect a cached image pretty fast this method name. However, this method perform image scaling, is time consuming, good add a note this is case</technical_language>

Target:
protected BitmapDescriptor getCachedMarkerImage(String url, double scale) { String scaleString = sScaleFormat.format(scale); Map<String, BitmapDescriptor> bitmaps = mImagesCache.markerImagesCache.get(url); BitmapDescriptor bitmapDescriptor = null; if (bitmaps != null) { bitmapDescriptor = bitmaps.get(scaleString); } if (bitmapDescriptor == null) { Bitmap bitmap = mImagesCache.bitmapCache.get(url); if (bitmap != null) { bitmapDescriptor = scaleIcon(bitmap, scale); putMarkerImagesCache(url, scaleString, bitmapDescriptor); } } return bitmapDescriptor; }
Source:
<code>public String getServerApiVersion() throws DockerAccessException { try { String url = urlBuilder.version(); <START> log.verbose(Logger.LogVerboseCategory.API,"GETing %s", url); <END> String response = delegate.get(url, 200); JsonObject info = JsonFactory.newJsonObject(response); return info.get("ApiVersion").getAsString(); } catch (Exception e) { throw new DockerAccessException(e, "Cannot extract API version from server %s", urlBuilder.getBaseUrl()); } }</code><technical_language>suggestion log.verbose(Logger.LogVerboseCategory.API,"GET %s", url);</technical_language>

Target:
public String getServerApiVersion() throws DockerAccessException { try { String url = urlBuilder.version(); log.verbose(Logger.LogVerboseCategory.API,"GET %s", url); String response = delegate.get(url, 200); JsonObject info = JsonFactory.newJsonObject(response); return info.get("ApiVersion").getAsString(); } catch (Exception e) { throw new DockerAccessException(e, "Cannot extract API version from server %s", urlBuilder.getBaseUrl()); } }
Source:
<code>public void progress_of_a_not_started_job_should_be_zero() { <START> view = JobView.of(a(job()), config); <END> assertThat(view.progress(), is(0)); }</code><technical_language>I agree config injected, injection hidden in helper method of(..) because: - config spy in test; ie. asserting - accentuating fact config object is injected improve readability of test case</technical_language>

Target:
public void progress_of_a_not_started_job_should_be_zero() { view = a(jobView().of(a(job()))); assertThat(view.progress(), is(0)); }
Source:
<code>public Observable<List<String>> getProductTags(final int page) { if (page < 1) { throw new IllegalArgumentException("page is a 1-based index, value cannot be less than 1"); } return retrofitService .getProductTagPage(appId, page, pageSize) .retryWhen(networkRetryPolicyProvider.provide()) .doOnNext(new RetrofitSuccessHttpStatusCodeHandler<>()) .compose(new UnwrapRetrofitBodyTransformer<ProductTagsWrapper, List<ProductTag>>()) .map(new Func1<List<ProductTag>, List<String>>() { @Override public List<String> call(final List<ProductTag> productTags) { if (productTags == null) { return null; } else { <START> final List<String> tags = new ArrayList<>(); <END> for (ProductTag productTag : productTags) { if (!TextUtils.isEmpty(productTag.getHandle())) { tags.add(productTag.getHandle()); } } return tags; } } }) .onErrorResumeNext(new BuyClientExceptionHandler<List<String>>()) .observeOn(callbackScheduler); }</code><technical_language>I trivial, nicer if this mapping extracted a separate function</technical_language>

Target:
public Observable<List<String>> getProductTags(final int page) { if (page < 1) { throw new IllegalArgumentException("page is a 1-based index, value cannot be less than 1"); } return retrofitService .getProductTagPage(appId, page, pageSize) .retryWhen(networkRetryPolicyProvider.provide()) .doOnNext(new RetrofitSuccessHttpStatusCodeHandler<>()) .compose(new UnwrapRetrofitBodyTransformer<ProductTagsWrapper, List<ProductTag>>()) .map(unwrapProductTags()) .onErrorResumeNext(new BuyClientExceptionHandler<List<String>>()) .observeOn(callbackScheduler); }
Source:
<code>private Encounter saveRadiologyOrderEncounter(Patient patient, Provider provider, Date encounterDateTime) throws IllegalStateException { try { EncounterTransaction encounterTransaction = setUpEncounterTransaction(patient, encounterDateTime, radiologyProperties.getRadiologyVisitType(), radiologyProperties.getRadiologyOrderEncounterType(), provider, radiologyProperties.getOrderingProviderEncounterRole()); encounterTransaction = emrEncounterService.save(encounterTransaction); return encounterService.saveEncounter(encounterService.getEncounterByUuid(encounterTransaction .getEncounterUuid())); } <START> catch (Exception e) { <END> log.error(e.getMessage(), e); log.error("Unable to save radiology order encounter"); throw new IllegalStateException("Unable to save radiology order encounter"); } }</code><technical_language>@bgeVam dont catch exceptions, care</technical_language>

Target:
private Encounter saveRadiologyOrderEncounter(Patient patient, Provider provider, Date encounterDateTime) { final EncounterTransaction encounterTransaction = new EncounterTransaction(); encounterTransaction.setPatientUuid(patient.getUuid()); final EncounterTransaction.Provider encounterProvider = new EncounterTransaction.Provider(); encounterProvider.setEncounterRoleUuid(radiologyProperties.getRadiologyOrderingProviderEncounterRole() .getUuid()); encounterProvider.setUuid(provider.getUuid()); final Set<EncounterTransaction.Provider> encounterProviderSet = new HashSet<EncounterTransaction.Provider>(); encounterProviderSet.add(encounterProvider); encounterTransaction.setProviders(encounterProviderSet); encounterTransaction.setEncounterDateTime(encounterDateTime); encounterTransaction.setVisitTypeUuid(this.radiologyProperties.getRadiologyVisitType() .getUuid()); encounterTransaction.setEncounterTypeUuid(this.radiologyProperties.getRadiologyOrderEncounterType() .getUuid()); return this.encounterService.getEncounterByUuid(this.emrEncounterService.save(encounterTransaction) .getEncounterUuid()); }
Source:
<code>public double isApplicable(VElement vElement, ViewModelContext viewModelContext) { double highestPriority = Double.MIN_VALUE; EMFFormsDIRendererService<VElement> bestRendererService = null; for (final EMFFormsDIRendererService<VElement> rendererService : diRendererServices) <START> { <END> final double isCurrentApplicable = rendererService.isApplicable(vElement, viewModelContext); if (!Double.isNaN(isCurrentApplicable) && isCurrentApplicable > highestPriority) { highestPriority = isCurrentApplicable; bestRendererService = rendererService; } } if (bestRendererService != null) { return highestPriority; } return NOT_APPLICABLE; }</code><technical_language>If osgi de-/registers a EMFFormsDIRendererService iteration end exception. iterate a copy</technical_language>

Target:
public double isApplicable(VElement vElement, ViewModelContext viewModelContext) { double highestPriority = Double.MIN_VALUE; EMFFormsDIRendererService<VElement> bestRendererService = null; final Set<EMFFormsDIRendererService<VElement>> rendererServicesCopy = new LinkedHashSet<EMFFormsDIRendererService<VElement>>( diRendererServices); for (final EMFFormsDIRendererService<VElement> rendererService : rendererServicesCopy) { final double isCurrentApplicable = rendererService.isApplicable(vElement, viewModelContext); if (!Double.isNaN(isCurrentApplicable) && isCurrentApplicable > highestPriority) { highestPriority = isCurrentApplicable; bestRendererService = rendererService; } } if (bestRendererService != null) { return highestPriority; } return NOT_APPLICABLE; }
Source:
<code>public TimestampSelectiveStreamReader( StreamDescriptor streamDescriptor, Optional<TupleDomainFilter> filter, DateTimeZone hiveStorageTimeZone, boolean outputRequired, LocalMemoryContext systemMemoryContext) { this.streamDescriptor = requireNonNull(streamDescriptor, "streamDescriptor is null"); this.filter = filter.orElse(null); this.outputRequired = outputRequired; this.systemMemoryContext = requireNonNull(systemMemoryContext, "systemMemoryContext is null"); this.nullsAllowed = this.filter == null || this.filter.testNull(); this.baseTimestampInSeconds = new DateTime( <START> 2015, <END> 1, 1, 0, 0, requireNonNull(hiveStorageTimeZone, "hiveStorageTimeZone is null")).getMillis() / 1000; }</code><technical_language>put arguments line</technical_language>

Target:
public TimestampSelectiveStreamReader( StreamDescriptor streamDescriptor, Optional<TupleDomainFilter> filter, DateTimeZone hiveStorageTimeZone, boolean outputRequired, LocalMemoryContext systemMemoryContext) { this.streamDescriptor = requireNonNull(streamDescriptor, "streamDescriptor is null"); this.filter = filter.orElse(null); this.outputRequired = outputRequired; this.systemMemoryContext = requireNonNull(systemMemoryContext, "systemMemoryContext is null"); this.nonDeterministicFilter = this.filter != null && !this.filter.isDeterministic(); this.nullsAllowed = this.filter == null || nonDeterministicFilter || this.filter.testNull(); this.baseTimestampInSeconds = new DateTime(2015, 1, 1, 0, 0, requireNonNull(hiveStorageTimeZone, "hiveStorageTimeZone is null")).getMillis() / 1000; }
Source:
<code><START> protected String getJavaCallDeclaration() { <END> return "if (!window.callJava) {\n" + " window.callJava = function callJava(index, token, args) {\n" + " return external.callJava(index,token,args);\n" + " }\n" + "};\n"; }</code><technical_language>expose API. is open level prevent crashes/deadlocks</technical_language>

Target:
String getJavaCallDeclaration() { return "if (!window.callJava) {\n" + " window.callJava = function callJava(index, token, args) {\n" + " return external.callJava(index,token,args);\n" + " }\n" + "};\n"; }
Source:
<code>private SidebarGroup<CheckBox> createFilterGroup() { <START> final CheckBox testingCheck = createCheckBox(tr("Testing"), tr("Also show apps in testing state")); <END> getControl().containTestingApplicationsProperty().bind(testingCheck.selectedProperty()); final CheckBox requiresPatchCheck = createCheckBox(tr("Patch required"), tr("Also show apps, where CD patch is necessary")); getControl().containRequiresPatchApplicationsProperty().bind(requiresPatchCheck.selectedProperty()); final CheckBox commercialCheck = createCheckBox(tr("Commercial"), tr("Also show apps not free of costs")); commercialCheck.setSelected(true); getControl().containCommercialApplicationsProperty().bind(commercialCheck.selectedProperty()); final CheckBox operatingSystemCheck = createCheckBox(tr("All Operating Systems"), tr("Also show apps tested on different OS")); getControl().containAllOSCompatibleApplicationsProperty().bind(operatingSystemCheck.selectedProperty()); return new SidebarGroup<>(tr("Filters"), FXCollections.observableArrayList( testingCheck, requiresPatchCheck, commercialCheck, operatingSystemCheck)); }</code><technical_language>for assignIcon</technical_language>

Target:
private SidebarGroup<CheckBox> createFilterGroup() { final CheckBox testingCheck = createCheckBox(tr("Testing")); testingCheck.setTooltip(new Tooltip(tr("Also show apps in testing state"))); getControl().containTestingApplicationsProperty().bind(testingCheck.selectedProperty()); final CheckBox requiresPatchCheck = createCheckBox(tr("Patch required")); requiresPatchCheck.setTooltip(new Tooltip(tr("Also show apps, where CD patch is necessary"))); getControl().containRequiresPatchApplicationsProperty().bind(requiresPatchCheck.selectedProperty()); final CheckBox commercialCheck = createCheckBox(tr("Commercial")); commercialCheck.setTooltip(new Tooltip(tr("Also show apps not free of costs"))); commercialCheck.setSelected(true); getControl().containCommercialApplicationsProperty().bind(commercialCheck.selectedProperty()); final CheckBox operatingSystemCheck = createCheckBox(tr("All Operating Systems")); operatingSystemCheck.setTooltip(new Tooltip(tr("Also show apps tested on different OS"))); getControl().containAllOSCompatibleApplicationsProperty().bind(operatingSystemCheck.selectedProperty()); return new SidebarGroup<>(tr("Filters"), FXCollections.observableArrayList( testingCheck, requiresPatchCheck, commercialCheck, operatingSystemCheck)); }
Source:
<code>public PianoView(Context context, AttributeSet attributeSet) { <START> super(context, attributeSet); margin = getResources().getDimensionPixelSize(R.dimen.pocketmusic_trackrow_margin); int correspondingMidiValue = NoteName.DEFAULT_NOTE_NAME.getMidi(); for (int i = 0; i < WHITE_KEY_COUNT; i++) { while (NoteName.getNoteNameFromMidiValue(correspondingMidiValue).isSigned()) { correspondingMidiValue++; } TextView whiteButton = new TextView(context); whiteButton.setBackgroundColor(ContextCompat.getColor(context, R.color.solid_white)); whiteButton.setTag(correspondingMidiValue); whiteButton.setText(NoteName.getNoteNameFromMidiValue(correspondingMidiValue).name()); whiteButton.setTextColor(ContextCompat.getColor(context, R.color.solid_black)); whitePianoKeys.add(whiteButton); addView(whiteButton); correspondingMidiValue++; } correspondingMidiValue = NoteName.DEFAULT_NOTE_NAME.getMidi(); for (int i = 0; i < BLACK_KEY_COUNT; i++) { while (!NoteName.getNoteNameFromMidiValue(correspondingMidiValue).isSigned()) { correspondingMidiValue++; } TextView blackButton = new TextView(context); blackButton.setBackgroundColor(ContextCompat.getColor(context, R.color.solid_black)); <END> blackButton.setTag(correspondingMidiValue); blackButton.setText(NoteName.getNoteNameFromMidiValue(correspondingMidiValue).name()); blackButton.setTextColor(ContextCompat.getColor(context, R.color.solid_white)); blackPianoKeys.add(blackButton); addView(blackButton); correspondingMidiValue++; } currentHeight = 0; }</code><technical_language>I prefer this in a function reduce code duplication</technical_language>

Target:
public PianoView(Context context, AttributeSet attributeSet) { super(context, attributeSet); margin = getResources().getDimensionPixelSize(R.dimen.pocketmusic_trackrow_margin); initializePianoKeys(context); }
Source:
<code>public static FastaSequenceIndex buildFromFasta(final Path fastaFile) throws IOException { try(final AsciiLineReader in = new AsciiLineReader(IOUtil.openFileForReading(fastaFile))) { String previous = in.readLine(); if (previous == null) { throw new SAMException("Cannot index empty file: " + fastaFile); } else if (previous.charAt(0) != '>') { throw new SAMException("Wrong sequence header: " + previous); } int sequenceIndex = -1; long location = in.getPosition(); final FastaSequenceIndex index = new FastaSequenceIndex(); FaiEntryBuilder entry = null; for (String line = in.readLine(); previous != null; line = in.readLine()) { if (previous.charAt(0) == '>') { if (entry != null) { index.add(entry.build()); } <START> sequenceIndex++; <END> entry = new FaiEntryBuilder(sequenceIndex, previous, line, location); } else if (line != null && line.charAt(0) == '>') { location = in.getPosition(); } else if (line != null && !line.isEmpty()) { entry.updateWithSequence(line); } previous = line; } index.add(entry.build()); return index; } }</code><technical_language>replace this line adding ++ sequenceIndex line below</technical_language>

Target:
public static FastaSequenceIndex buildFromFasta(final Path fastaFile) throws IOException { try(final AsciiLineReader in = new AsciiLineReader(IOUtil.openFileForReading(fastaFile))) { String previous = in.readLine(); if (previous == null) { throw new SAMException("Cannot index empty file: " + fastaFile); } else if (previous.charAt(0) != '>') { throw new SAMException("Wrong sequence header: " + previous); } int sequenceIndex = -1; long location = in.getPosition(); final FastaSequenceIndex index = new FastaSequenceIndex(); FaiEntryBuilder entry = null; for (String line = in.readLine(); previous != null; line = in.readLine()) { if (previous.charAt(0) == '>') { if (entry != null) index.add(entry.build()); entry = new FaiEntryBuilder(sequenceIndex++, previous, line, in.getLineTerminatorLength(), location); } else if (line != null && line.charAt(0) == '>') { location = in.getPosition(); } else if (line != null && !line.isEmpty()) { entry.updateWithSequence(line, in.getLineTerminatorLength()); } previous = line; } index.add(entry.build()); return index; } }
Source:
<code>private AuthorizationFramework() { String path = RuntimeEnvironment.getInstance() .getPluginDirectory(); plugins = new ArrayList<>(); <START> this.directory = path == null ? null : new File(path); <END> reload(); }</code><technical_language>setDirectory()</technical_language>

Target:
private AuthorizationFramework() { String path = RuntimeEnvironment.getInstance() .getPluginDirectory(); plugins = new ArrayList<>(); setPluginDirectory(path); reload(); }
Source:
<code>private boolean looksLikeChannel(int tp) { if (tokenStream.get(tp).getKind() == TokenKind.IDENTIFIER) { String prefix = tokenStream.get(tp).data; <START> if (prefix.equals("queue") || prefix.equals("tap") || prefix.equals("topic")) { <END> if (tokenStream.get(tp + 1).getKind() == TokenKind.COLON) { return true; } } } return false; }</code><technical_language>relate hardcoded strings enum above</technical_language>

Target:
private boolean looksLikeChannel(int tp) { if (tokenStream.get(tp).getKind() == TokenKind.IDENTIFIER) { String prefix = tokenStream.get(tp).data; if (isLegalChannelPrefix(prefix)) { if (tokenStream.get(tp + 1).getKind() == TokenKind.COLON) { return true; } } } return false; }
Source:
<code>public ImmutableValue<Entity> vehicle() { <START> return new ImmutableSpongeValue<Entity>(Keys.VEHICLE, vehicle); <END> }</code><technical_language>Pretty I created [ImmutableSpongeEntityValue](<LINK_0> for this specifically</technical_language>

Target:
public ImmutableValue<Entity> vehicle() { return new ImmutableSpongeEntityValue(Keys.VEHICLE, vehicle.get()); }
Source:
<code>OperationSelector(Object[] operations) { <START> this.random = new Random(); <END> this.operations = operations; }</code><technical_language>Personal flavour; do like. If object initialized in class constructor, I do that. normal constructor cleaner shorter. Especially some initialization logic in normal constructor, this a good get rid of there</technical_language>

Target:
OperationSelector(Object[] operations) { this.operations = operations; }
Source:
<code>public DetectFuture addListener(DetectFutureListener<DetectFuture> listener) { try { DetectResults detectResults = future.get(); setServiceDetected(detectResults.isServiceDetected()); <START> } catch (InterruptedException e) { <END> setServiceDetected(false); setException(e); } catch (ExecutionException e) { setServiceDetected(false); setException(e); } listener.operationComplete(this); return this; }</code><technical_language>suggestion } catch (InterruptedException | ExecutionException e) {</technical_language>

Target:
public DetectFuture addListener(DetectFutureListener<DetectFuture> listener) { try { DetectResults detectResults = future.get(); setServiceDetected(detectResults.isServiceDetected()); } catch (InterruptedException | ExecutionException e) { setServiceDetected(false); setException(e); } listener.operationComplete(this); return this; }