auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void onNext(Observable<? extends T> t) { if (t == null) { return; } <START> if (fastMode) { <END> if (t.getClass() == ScalarSynchronousObservable.class) { T v = ((ScalarSynchronousObservable<? extends T>)t).get(); fastEmitNext(v); if (maxConcurrent != Integer.MAX_VALUE) { request(1); } } else { FastInnerSubscriber<T> fastInner = new FastInnerSubscriber<T>(this); getOrCreateComposite().add(fastInner); FAST_WIP.getAndIncrement(this); t.unsafeSubscribe(fastInner); } } else { if (t.getClass() == ScalarSynchronousObservable.class) { tryEmitScalar(((ScalarSynchronousObservable<? extends T>)t).get()); } else { InnerSubscriber<T> inner = new InnerSubscriber<T>(this, uniqueId++); addInner(inner); t.unsafeSubscribe(inner); emit(); } } }</code><technical_language>This volatile read single onNext for a decision beginning. I figured out a though, wish option. preferable if 2 subclasses of MergeSubscriber for paths, instantiation time use. I considered volatile piggybacking, I other volatiles guaranteed read time onNext is invoked. concern is number of volatiles invoked for onNext hot path metrics testing shown impede performance</technical_language>

Target:
public void onNext(Observable<? extends T> t) { if (t == null) { return; } if (t instanceof ScalarSynchronousObservable) { tryEmit(((ScalarSynchronousObservable<? extends T>)t).get()); } else { InnerSubscriber<T> inner = new InnerSubscriber<T>(this, uniqueId++); addInner(inner); t.unsafeSubscribe(inner); emit(); } }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTurnScreenOn(true); <START> final CountDownLatch latch = new CountDownLatch(1); <END> KeyguardManager keyguardManager = getSystemService(KeyguardManager.class); keyguardManager.requestDismissKeyguard(this, new KeyguardManager.KeyguardDismissCallback() { @Override public void onDismissSucceeded() { latch.countDown(); } }); try { latch.await(500, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { Log.w("WebViewTestActivity", "Failed to dismiss keyguard"); } mWebView = new WebView(this); setContentView(mWebView); }</code><technical_language>a Future<Void> WebkitUtils, for clearer more consistent timeouts</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTurnScreenOn(true); dismissKeyguard(); mWebView = new WebView(this); setContentView(mWebView); }
Source:
<code>protected ContentObserver getContentObserver() { return new ContentObserver(createHandler(getClass().getSimpleName())) { @Override public void onChange(boolean selfChange, Uri uri) { super.onChange(selfChange, uri); queryOne(uri) <START> .doOnNext(item -> Log.v(TAG, "onChange(" + uri + ')')) <END> .map(it -> new StoreItem<>(uri, it)) .subscribe(subjectCache::onNext, error -> Log.e(TAG, "Cannot retrieve the item: " + uri, error)); } }; }</code><technical_language>a big deal, a fan of combining " '. consistent</technical_language>

Target:
protected ContentObserver getContentObserver() { return new ContentObserver(createHandler(getClass().getSimpleName())) { @Override public void onChange(boolean selfChange, Uri uri) { super.onChange(selfChange, uri); queryOne(uri) .doOnNext(item -> Log.v(TAG, format("onChange(%1s)", uri))) .map(it -> new StoreItem<>(uri, it)) .subscribe(subjectCache::onNext, error -> Log.e(TAG, "Cannot retrieve the item: " + uri, error)); } }; }
Source:
<code>private Context startTracingSpan(Method method, Context context) { <START> String spanName = String.format("%s/%s", interfaceParser.getServiceName(), method.getName()); <END> context = TracerProxy.setSpanName(spanName, context); return TracerProxy.start(spanName, context); }</code><technical_language>for sake of naming format other Azure SDKs, '.' a separator everywhere? E.g. 'Appconfig.getKey' 'Appconfig/getKey'</technical_language>

Target:
private Context startTracingSpan(Method method, Context context) { String spanName = String.format("%s.%s", interfaceParser.getServiceName(), method.getName()); context = TracerProxy.setSpanName(spanName, context); return TracerProxy.start(spanName, context); }
Source:
<code>public void refresh() { String name = vdsManager.getVdsName(); log.debug("refreshing host {}", name); VdsDynamic vdsDynamic = getDynamicInfo(name); vdsManager.updateDynamicData(vdsDynamic); <START> PrometheusClient promClient = getPrometheusClient(); <END> if (vdsManager.isTimeToRefreshStatistics()) { VdsStatistics stat = new VdsStatistics(); stat.setId(vdsManager.getVdsId()); stat.setUsageMemPercent(promClient.getNodeMemUsage(name)); stat.setMemAvailable(promClient.getNodeMemAvailable(name)); stat.setMemFree(promClient.getNodeMemFree(name)); stat.setMemShared(promClient.getNodeMemShared(name)); stat.setSwapTotal(promClient.getNodeSwapTotalMb(name)); stat.setSwapFree(promClient.getNodeSwapFreeMb(name)); stat.setAnonymousHugePages(promClient.getNodeAnonHugePages(name)); stat.setHugePages( promClient.getNodeHugePages(name).stream() .map(k -> new HugePage(k.getFirst(), k.getSecond())) .collect(Collectors.toList()) ); stat.setBootTime(promClient.getNodeBootTime(name)); stat.setCpuIdle(promClient.getNodeCpuIdle(name)); stat.setCpuSys(promClient.getNodeCpuSystem(name)); stat.setCpuUser(promClient.getNodeCpuUser(name)); stat.setCpuLoad(promClient.getNodeCpuLoad(name)); stat.setUsageCpuPercent(promClient.getNodeCpuUsage(name)); vdsManager.updateStatisticsData(stat); } vdsManager.afterRefreshTreatment(true); }</code><technical_language>move this if statement. need create client if refresh required</technical_language>

Target:
public void refresh() { String name = vdsManager.getVdsName(); log.debug("refreshing host {}", name); VdsDynamic vdsDynamic = getDynamicInfo(name); vdsManager.updateDynamicData(vdsDynamic); PrometheusClient promClient = getPrometheusClient(); if (vdsManager.isTimeToRefreshStatistics() && promClient != null) { VdsStatistics stat = new VdsStatistics(); stat.setId(vdsManager.getVdsId()); stat.setUsageMemPercent(promClient.getNodeMemUsage(name)); stat.setMemAvailable(promClient.getNodeMemAvailable(name)); stat.setMemFree(promClient.getNodeMemFree(name)); stat.setMemShared(promClient.getNodeMemShared(name)); stat.setSwapTotal(promClient.getNodeSwapTotalMb(name)); stat.setSwapFree(promClient.getNodeSwapFreeMb(name)); stat.setAnonymousHugePages(promClient.getNodeAnonHugePages(name)); stat.setHugePages( promClient.getNodeHugePages(name).stream() .map(k -> new HugePage(k.getFirst(), k.getSecond())) .collect(Collectors.toList()) ); stat.setBootTime(promClient.getNodeBootTime(name)); stat.setCpuIdle(promClient.getNodeCpuIdle(name)); stat.setCpuSys(promClient.getNodeCpuSystem(name)); stat.setCpuUser(promClient.getNodeCpuUser(name)); stat.setCpuLoad(promClient.getNodeCpuLoad(name)); stat.setUsageCpuPercent(promClient.getNodeCpuUsage(name)); vdsManager.updateStatisticsData(stat); } vdsManager.afterRefreshTreatment(true); }
Source:
<code>public void showWindow() { final Project project = appContext.getRootProject(); checkState(project != null); switchView.showWindow(); switchView.setSwitchButtonEnabled(false); invalidateLoadedData(); performOperationWithCredentialsRequestIfNeeded(new RemoteSubversionOperation<InfoResponse>() { @Override public Promise<InfoResponse> perform(Credentials credentials) { return service.info(appContext.getRootProject().getLocation(), ".", "HEAD", false, credentials); } }, null).then(new Operation<InfoResponse>() { @Override public void apply(InfoResponse response) throws OperationException { if (!response.getItems().isEmpty()) { SubversionItem subversionItem = response.getItems().get(0); projectUri = subversionItem.getProjectUri(); } defaultViewInitialization(); handleSwitchButton(); } }).catchError(new Operation<PromiseError>() { @Override public void apply(PromiseError error) throws OperationException { <START> notificationManager.notify("Error retrieving svn info", error.getMessage(), FAIL, EMERGE_MODE); <END> defaultViewInitialization(); handleSwitchButton(); } }); }</code><technical_language>Please move messages locale constants</technical_language>

Target:
public void showWindow() { final Project project = appContext.getRootProject(); checkState(project != null); switchView.showWindow(); switchView.setSwitchButtonEnabled(false); invalidateLoadedData(); performOperationWithCredentialsRequestIfNeeded(new RemoteSubversionOperation<InfoResponse>() { @Override public Promise<InfoResponse> perform(Credentials credentials) { return service.info(appContext.getRootProject().getLocation(), ".", "HEAD", false, credentials); } }, null).then(new Operation<InfoResponse>() { @Override public void apply(InfoResponse response) throws OperationException { if (!response.getItems().isEmpty()) { SubversionItem subversionItem = response.getItems().get(0); projectUri = subversionItem.getProjectUri(); } defaultViewInitialization(); handleSwitchButton(); } }).catchError(new Operation<PromiseError>() { @Override public void apply(PromiseError error) throws OperationException { projectUri = "^"; Path location = appContext.getRootProject().getLocation(); notificationManager.notify(constants.infoRequestError(location.toString()), error.getMessage(), FAIL, EMERGE_MODE); defaultViewInitialization(); handleSwitchButton(); } }); }
Source:
<code>protected void commonAddColumn(final int index, final GridColumn<?> column) { checkSimulation(); SimulationDescriptor simulationDescriptor = simulation.getSimulationDescriptor(); ScenarioHeaderMetaData scenarioHeaderMetaData = (ScenarioHeaderMetaData) column.getHeaderMetaData().get(1); String title = scenarioHeaderMetaData.getTitle(); String group = scenarioHeaderMetaData.getColumnGroup(); String columnId = scenarioHeaderMetaData.getColumnId(); FactIdentifier factIdentifier = FactIdentifier.create(columnId, String.class.getCanonicalName()); ExpressionIdentifier ei = ExpressionIdentifier.create(columnId, FactMappingType.valueOf(group)); final int columnIndex = index == -1 ? getColumnCount() : index; try { simulationDescriptor.addFactMapping(columnIndex, title, factIdentifier, ei); if (index == -1) { super.appendColumn(column); } else { super.insertColumn(index, column); } } catch (Throwable t) { eventBus.fireEvent(new ScenarioGridReloadEvent()); return; } final List<Scenario> scenarios = simulation.getUnmodifiableScenarios(); IntStream.range(0, scenarios.size()) .forEach(rowIndex -> { <START> String value = title + "-" + Random.nextInt(); <END> setNewCell(rowIndex, columnIndex, () -> new ScenarioGridCell(new ScenarioGridCellValue(value))); }); }</code><technical_language>here, move a single placeholderGenerator</technical_language>

Target:
protected void commonAddColumn(final int index, final GridColumn<?> column) { checkSimulation(); SimulationDescriptor simulationDescriptor = simulation.getSimulationDescriptor(); ScenarioHeaderMetaData scenarioHeaderMetaData = (ScenarioHeaderMetaData) column.getHeaderMetaData().get(1); String title = scenarioHeaderMetaData.getTitle(); String group = scenarioHeaderMetaData.getColumnGroup(); String columnId = scenarioHeaderMetaData.getColumnId(); FactIdentifier factIdentifier = FactIdentifier.create(columnId, String.class.getCanonicalName()); ExpressionIdentifier ei = ExpressionIdentifier.create(columnId, FactMappingType.valueOf(group)); final int columnIndex = index == -1 ? getColumnCount() : index; try { simulationDescriptor.addFactMapping(columnIndex, title, factIdentifier, ei); if (index == -1) { super.appendColumn(column); } else { super.insertColumn(index, column); } } catch (Throwable t) { eventBus.fireEvent(new ScenarioGridReloadEvent()); return; } final List<Scenario> scenarios = simulation.getUnmodifiableScenarios(); IntStream.range(0, scenarios.size()) .forEach(rowIndex -> { String value = FactMappingValue.getPlaceHolder(rowIndex, columnIndex); setNewCell(rowIndex, columnIndex, () -> new ScenarioGridCell(new ScenarioGridCellValue(value))); }); }
Source:
<code>public void refreshRoutingData(String namespace) { if (_routingZkAddressMap == null || _realmToShardingKeysMap == null || _routingDataReaderMap == null || _routingDataWriterMap == null) { LOG.warn( "refreshRoutingData callback called before ZKMetadataStoreDirectory was fully initialized. Skipping refresh!"); return; } if (!_routingZkAddressMap.containsKey(namespace)) { LOG.error( "Failed to refresh internally-cached routing data! Namespace not found: " + namespace); return; } Map<String, List<String>> rawRoutingData; <START> _realmToShardingKeysMap.remove(namespace); <END> try { rawRoutingData = _routingDataReaderMap.get(namespace).getRoutingData(); _realmToShardingKeysMap.put(namespace, rawRoutingData); } catch (InvalidRoutingDataException e) { _routingDataMap.remove(namespace); LOG.error("Failed to refresh cached routing data for namespace {}", namespace, e); return; } _routingDataMap.remove(namespace); try { _routingDataMap.put(namespace, new TrieRoutingData(rawRoutingData)); } catch (InvalidRoutingDataException e) { LOG.warn("TrieRoutingData is not created for namespace {}", namespace, e); } }</code><technical_language>I need worry case describing. MSD assumption root path exists</technical_language>

Target:
public void refreshRoutingData(String namespace) { if (_routingZkAddressMap == null || _realmToShardingKeysMap == null || _routingDataReaderMap == null || _routingDataWriterMap == null) { LOG.warn( "refreshRoutingData callback called before ZKMetadataStoreDirectory was fully initialized. Skipping refresh!"); return; } if (!_routingZkAddressMap.containsKey(namespace)) { LOG.error( "Failed to refresh internally-cached routing data! Namespace not found: " + namespace); return; } _realmToShardingKeysMap.remove(namespace); _routingDataMap.remove(namespace); Map<String, List<String>> rawRoutingData; try { rawRoutingData = _routingDataReaderMap.get(namespace).getRoutingData(); _realmToShardingKeysMap.put(namespace, rawRoutingData); } catch (InvalidRoutingDataException e) { LOG.error("Failed to refresh cached routing data for namespace {}", namespace, e); return; } try { _routingDataMap.put(namespace, new TrieRoutingData(rawRoutingData)); } catch (InvalidRoutingDataException e) { LOG.warn("TrieRoutingData is not created for namespace {}", namespace, e); } }
Source:
<code>public long getSystemMemoryUsage() { <START> return 0; <END> }</code><technical_language>delegate.getSystemMemoryUsage()</technical_language>

Target:
public long getSystemMemoryUsage() { return delegate.getSystemMemoryUsage(); }
Source:
<code>public ModelAndView structure() { ModelAndView modelAndView = new ModelAndView("/membership-structure"); String loginName = LoginUserInfo.getLoginName(); if (loginName != null) { AccountModel accountModel = accountService.findByLoginName(loginName); MembershipModel membershipModel = userMembershipEvaluator.evaluate(loginName); UserMembershipModel userMembershipModel = userMembershipEvaluator.evaluateUserMembership(loginName, new Date()); <START> if(userMembershipModel.getType() == UserMembershipType.GIVEN || userMembershipModel.getType() == UserMembershipType.PURCHASED) <END> { modelAndView.addObject("membershipLevel", "5"); } else{ modelAndView.addObject("membershipLevel", membershipModel != null ? membershipModel.getLevel() : ""); } modelAndView.addObject("membershipPoint", accountModel != null ? accountModel.getMembershipPoint() : ""); } modelAndView.addObject("loginName", loginName); return modelAndView; }</code><technical_language>userMembershipModel != null</technical_language>

Target:
public ModelAndView structure() { ModelAndView modelAndView = new ModelAndView("/membership-structure"); String loginName = LoginUserInfo.getLoginName(); if (loginName != null) { AccountModel accountModel = accountService.findByLoginName(loginName); MembershipModel membershipModel = userMembershipEvaluator.evaluate(loginName); UserMembershipModel userMembershipModel = userMembershipEvaluator.evaluateUserMembership(loginName, new Date()); if(userMembershipModel != null && (userMembershipModel.getType() == UserMembershipType.GIVEN || userMembershipModel.getType() == UserMembershipType.PURCHASED)) { modelAndView.addObject("membershipLevel", MembershipLevel.V5.getLevel()); } else{ modelAndView.addObject("membershipLevel", membershipModel != null ? membershipModel.getLevel() : ""); } modelAndView.addObject("membershipPoint", accountModel != null ? accountModel.getMembershipPoint() : ""); } modelAndView.addObject("loginName", loginName); return modelAndView; }
Source:
<code>public List<ItemStack> doApply(List<ItemStack> generatedLoot, LootContext context) { ItemStack ctxTool = context.get(LootParameters.TOOL); ItemStack fakeTool = ctxTool.copy(); fakeTool.addEnchantment(Enchantments.SILK_TOUCH, 1); <START> if(ItemStack.areItemsEqual(ctxTool, fakeTool) && EnchantmentHelper.getEnchantments(ctxTool).containsKey(Enchantments.SILK_TOUCH)) return generatedLoot; <END> LootContext.Builder builder = new LootContext.Builder(context.getWorld()) .withParameter(LootParameters.BLOCK_STATE, context.get(LootParameters.BLOCK_STATE)) .withRandom(context.getWorld().rand) .withParameter(LootParameters.POSITION, context.get(LootParameters.POSITION)) .withParameter(LootParameters.TOOL, fakeTool) .withNullableParameter(LootParameters.BLOCK_ENTITY, context.get(LootParameters.BLOCK_ENTITY)); if(context.has(LootParameters.THIS_ENTITY)) { builder.withParameter(LootParameters.THIS_ENTITY, context.get(LootParameters.THIS_ENTITY)); } LootContext ctx = builder.build(LootParameterSets.BLOCK); LootTable loottable = context.getWorld().getServer().getLootTableManager().getLootTableFromLocation(context.get(LootParameters.BLOCK_STATE).getBlock().getLootTable()); return loottable.generate(ctx); }</code><technical_language>is point of this</technical_language>

Target:
public List<ItemStack> doApply(List<ItemStack> generatedLoot, LootContext context) { ItemStack ctxTool = context.get(LootParameters.TOOL); if(EnchantmentHelper.getEnchantments(ctxTool).containsKey(Enchantments.SILK_TOUCH)) return generatedLoot; ItemStack fakeTool = ctxTool.copy(); fakeTool.addEnchantment(Enchantments.SILK_TOUCH, 1); LootContext.Builder builder = new LootContext.Builder(context); builder.withParameter(LootParameters.TOOL, fakeTool); LootContext ctx = builder.build(LootParameterSets.BLOCK); LootTable loottable = context.getWorld().getServer().getLootTableManager().getLootTableFromLocation(context.get(LootParameters.BLOCK_STATE).getBlock().getLootTable()); return loottable.generate(ctx); }
Source:
<code>protected <T> Invoker<T> doSelect(List<Invoker<T>> invokers, URL url, Invocation invocation) { String key = invokers.get(0).getUrl().getServiceKey() + "." + invocation.getMethodName(); int length = invokers.size(); int maxWeight = 0; int minWeight = Integer.MAX_VALUE; <START> final List<Invoker<T>> invokerToWeightList = new ArrayList<>(); <END> for (int i = 0; i < length; i++) { int weight = getWeight(invokers.get(i), invocation); maxWeight = Math.max(maxWeight, weight); minWeight = Math.min(minWeight, weight); if (weight > 0) { invokerToWeightList.add(invokers.get(i)); } } AtomicPositiveInteger sequence = sequences.get(key); if (sequence == null) { sequences.putIfAbsent(key, new AtomicPositiveInteger()); sequence = sequences.get(key); } if (maxWeight > 0 && minWeight < maxWeight) { AtomicPositiveInteger indexSeq = indexSeqs.get(key); if (indexSeq == null) { indexSeqs.putIfAbsent(key, new AtomicPositiveInteger(-1)); indexSeq = indexSeqs.get(key); } length = invokerToWeightList.size(); while (true) { int index = indexSeq.incrementAndGet() % length; int currentWeight; if (index == 0) { currentWeight = sequence.incrementAndGet() % maxWeight; }else { currentWeight = sequence.get() % maxWeight; } if (getWeight(invokerToWeightList.get(index), invocation) > currentWeight) { return invokerToWeightList.get(index); } } } return invokers.get(sequence.getAndIncrement() % length); }</code><technical_language>name invokerToWeightList improved. I weightedInvokerList nonZeroWeightedInvokers better. :)</technical_language>

Target:
protected <T> Invoker<T> doSelect(List<Invoker<T>> invokers, URL url, Invocation invocation) { String key = invokers.get(0).getUrl().getServiceKey() + "." + invocation.getMethodName(); int length = invokers.size(); int maxWeight = 0; int minWeight = Integer.MAX_VALUE; final List<Invoker<T>> nonZeroWeightedInvokers = new ArrayList<>(); for (int i = 0; i < length; i++) { int weight = getWeight(invokers.get(i), invocation); maxWeight = Math.max(maxWeight, weight); minWeight = Math.min(minWeight, weight); if (weight > 0) { nonZeroWeightedInvokers.add(invokers.get(i)); } } AtomicPositiveInteger sequence = sequences.get(key); if (sequence == null) { sequences.putIfAbsent(key, new AtomicPositiveInteger()); sequence = sequences.get(key); } if (maxWeight > 0 && minWeight < maxWeight) { AtomicPositiveInteger indexSeq = indexSeqs.get(key); if (indexSeq == null) { indexSeqs.putIfAbsent(key, new AtomicPositiveInteger(-1)); indexSeq = indexSeqs.get(key); } length = nonZeroWeightedInvokers.size(); while (true) { int index = indexSeq.incrementAndGet() % length; int currentWeight; if (index == 0) { currentWeight = sequence.incrementAndGet() % maxWeight; } else { currentWeight = sequence.get() % maxWeight; } if (getWeight(nonZeroWeightedInvokers.get(index), invocation) > currentWeight) { return nonZeroWeightedInvokers.get(index); } } } return invokers.get(sequence.getAndIncrement() % length); }
Source:
<code>public MotionDisplayer(Storage motionData, Model model) { <START> String saved = "10"; <END> String currentSize =TheApp.getCurrentVersionPreferences().get("Visualizer: Experimental Marker Radius (mm)", saved); TheApp.getCurrentVersionPreferences().put("Visualizer: Experimental Marker Radius (mm)", currentSize); DEFAULT_MARKER_SIZE = Double.parseDouble(currentSize); this.experimentalForceScaleFactor = 1.0; this.experimentalMarkerScaleFactor = 1.0; this.model = model; dContext= OpenSimDB.getInstance().getContext(model); simmMotionData = motionData; currentForceShape = DEFAULT_FORCE_SHAPE; modelVisJson = ViewDB.getInstance().getModelVisualizationJson(model); colNames = simmMotionData.getColumnLabels(); int numColumnsIncludingTime = colNames.getSize(); interpolatedStates = new ArrayDouble(0.0, numColumnsIncludingTime-1); modelVisJson.addMotionDisplayer(this); if (model instanceof ModelForExperimentalData) return; }</code><technical_language>Please rename variable is supposed represent, e.g. defaultMarkerRadius</technical_language>

Target:
public MotionDisplayer(Storage motionData, Model model) { String defaultMarkerRadiusString = "10"; String currentSize =TheApp.getCurrentVersionPreferences().get("Visualizer: Experimental Marker Radius (mm)", defaultMarkerRadiusString); TheApp.getCurrentVersionPreferences().put("Visualizer: Experimental Marker Radius (mm)", currentSize); this.experimentalForceScaleFactor = 1.0; this.experimentalMarkerRadius = Double.parseDouble(currentSize); this.model = model; dContext= OpenSimDB.getInstance().getContext(model); simmMotionData = motionData; currentForceShape = DEFAULT_FORCE_SHAPE; modelVisJson = ViewDB.getInstance().getModelVisualizationJson(model); colNames = simmMotionData.getColumnLabels(); int numColumnsIncludingTime = colNames.getSize(); interpolatedStates = new ArrayDouble(0.0, numColumnsIncludingTime-1); modelVisJson.addMotionDisplayer(this); if (model instanceof ModelForExperimentalData) return; }
Source:
<code>public Optional<Function<JsonValue, Stream<ValidationError>>> create(ValidationContext model) { final JsonValue type = model.getSchema().get("type"); <START> if (JsonString.class.isInstance(type) && "integer".equals(JsonString.class.cast(type).getString())) { <END> return Optional.of(new Impl(model.toPointer(), model.getValueProvider())); } return Optional.empty(); }</code><technical_language>type.getValueType() == STRING ;)</technical_language>

Target:
public Optional<Function<JsonValue, Stream<ValidationError>>> create(ValidationContext model) { final JsonValue type = model.getSchema().get("type"); if (type.getValueType().equals(ValueType.STRING) && "integer".equals(JsonString.class.cast(type).getString())) { return Optional.of(new MultipleOfValidation.Impl(model.toPointer(), model.getValueProvider(), 1)); } return Optional.empty(); }
Source:
<code>public INDArray loadFeaturesFromString(String reviewContents, int maxLength){ <START> List<String> tokens = tokenizerFactory.create(reviewContents).getTokens(); <END> List<String> tokensFiltered = new ArrayList<>(); for(String t : tokens ){ if(wordVectors.hasWord(t)) tokensFiltered.add(t); } int outputLength = Math.max(maxLength,tokensFiltered.size()); INDArray features = Nd4j.create(1, vectorSize, outputLength); for( int j=0; j<tokens.size() && j<maxLength; j++ ){ String token = tokens.get(j); INDArray vector = wordVectors.getWordVectorMatrix(token); features.put(new INDArrayIndex[]{NDArrayIndex.point(0), NDArrayIndex.all(), NDArrayIndex.point(j)}, vector); } return features; }</code><technical_language>Spacing</technical_language>

Target:
public INDArray loadFeaturesFromString(String reviewContents, int maxLength) { List<String> tokens = tokenizerFactory.create(reviewContents).getTokens(); List<String> tokensFiltered = new ArrayList<>(); for (String t : tokens) { if (wordVectors.hasWord(t)) tokensFiltered.add(t); } int outputLength = Math.max(maxLength, tokensFiltered.size()); INDArray features = Nd4j.create(1, vectorSize, outputLength); for (int j = 0; j < tokens.size() && j < maxLength; j++) { String token = tokens.get(j); INDArray vector = wordVectors.getWordVectorMatrix(token); features.put(new INDArrayIndex[]{point(0), all(), point(j)}, vector); } return features; }
Source:
<code>private void insert(Map<String, String> partitionSpec, Iterable<HCatRecord> rows) { WriteEntity entity = new WriteEntity.Builder() .withDatabase(databaseName) .withTable(tableName) .withPartition(partitionSpec) .build(); try { WriterContext context = DataTransferFactory.getHCatWriter(entity, config).prepareWrite(); HCatWriter writer = DataTransferFactory.getHCatWriter(context); try { writer.write(rows.iterator()); } catch (HCatException e) { <START> writer.abort(context); <END> throw e; } writer.commit(context); } catch (HCatException e) { throw new RuntimeException(e); } }</code><technical_language>a unit test perspective abort sense therefor removed. If write is successful unit test terminate</technical_language>

Target:
private void insert(Map<String, String> partitionSpec, Iterable<HCatRecord> rows) { WriteEntity entity = new WriteEntity.Builder() .withDatabase(databaseName) .withTable(tableName) .withPartition(partitionSpec) .build(); try { HCatWriter master = DataTransferFactory.getHCatWriter(entity, config); WriterContext context = master.prepareWrite(); HCatWriter writer = DataTransferFactory.getHCatWriter(context); writer.write(rows.iterator()); master.commit(context); } catch (HCatException e) { throw new RuntimeException("An error occurred while inserting data to " + databaseName + "." + tableName, e); } }
Source:
<code>public String getId(TransactionContext txnCtx, Functions functions, Row params, SubQueryResults subQueryResults) { return idFunction.apply( <START> Lists2.map( <END> key.subList(0, width), s -> DataTypes.STRING.value(SymbolEvaluator.evaluate(txnCtx, functions, s, params, subQueryResults)) )); }</code><technical_language>for cases this list is consumed sense add a mapLazy is based this: java static class LazyMapList<I, O> extends AbstractList<O> { private final List<I> list; private final Function<? super I, ? extends O> mapper; public LazyMapList(List<I> list, Function<? super I, ? extends O> mapper) { this.list = list; this.mapper = mapper; } @Override public O get(int index) { return mapper.apply(list.get(index)); } @Override public int size() { return list.size(); } }</technical_language>

Target:
public String getId(TransactionContext txnCtx, Functions functions, Row params, SubQueryResults subQueryResults) { return idFunction.apply( LazyMapList.of( key.subList(0, width), s -> DataTypes.STRING.value(SymbolEvaluator.evaluate(txnCtx, functions, s, params, subQueryResults)) ) ); }
Source:
<code>private void deliver(MessageBatch batch, Retryer<MessageSendingResult> retryer) { try (Timer.Context timer = hermesMetrics.subscriptionLatencyTimer(subscription).time()) { MessageSendingResult result = retryer.call(() -> sender.send(batch, subscription.getEndpoint(), subscription.getBatchSubscriptionPolicy().getRequestTimeout())); monitoring.markSendingResult(batch, subscription, result); } catch (Exception e) { <START> logger.error(format("[batch_id=%s, subscription=%s] Batch was rejected.", batch.getId(), subscription.toSubscriptionName()), e); <END> monitoring.markDiscarded(batch, subscription, e.getMessage()); } }</code><technical_language>another log format? compatible existing? (or change existing)</technical_language>

Target:
private void deliver(MessageBatch batch, Retryer<MessageSendingResult> retryer) { try (Timer.Context timer = hermesMetrics.subscriptionLatencyTimer(subscription).time()) { MessageSendingResult result = retryer.call(() -> sender.send(batch, subscription.getEndpoint(), subscription.getBatchSubscriptionPolicy().getRequestTimeout())); monitoring.markSendingResult(batch, subscription, result); } catch (Exception e) { logger.error("Batch was rejected [batch_id={}, subscription={}].", batch.getId(), subscription.toSubscriptionName(), e); monitoring.markDiscarded(batch, subscription, e.getMessage()); } }
Source:
<code><START> public String formatNameLatexFree(final String nameToFormat) { <END> if (nameToFormat == null) { return null; } if (namesAsIs) { return nameToFormat; } else if (namesNatbib) { return AuthorList.fixAuthorNatbibLatexFree(nameToFormat); } else if (namesLastOnly) { return AuthorList.fixAuthorLastNameOnlyCommasLatexFree(nameToFormat, false); } else if (namesFf) { return AuthorList.fixAuthorFirstNameFirstCommasLatexFree(nameToFormat, abbrAuthorNames, false); } else { return AuthorList.fixAuthorLastNameFirstCommasLatexFree(nameToFormat, abbrAuthorNames, false); } }</code><technical_language>formatName method is used</technical_language>

Target:
public String formatNameLatexFree(final String nameToFormat) { if (nameToFormat == null) { return null; } AuthorList authors = AuthorList.parse(nameToFormat); if (namesAsIs) { return nameToFormat; } else if (namesNatbib) { return authors.getAsNatbibLatexFree(); } else if (namesLastOnly) { return authors.getAsLastNamesLatexFree(false); } else if (namesFf) { return authors.getAsFirstLastNamesLatexFree(abbrAuthorNames, false); } else { return authors.getAsLastFirstNamesLatexFree(abbrAuthorNames, false); } }
Source:
<code>private PersistentVolumeClaim getClaimCheWorkspace() { PersistentVolumeClaimList pvcList = openShiftClient.persistentVolumeClaims().list(); for(PersistentVolumeClaim pvc:pvcList.getItems()) { if (persistentVolumeClaim.equals(pvc.getMetadata().getName())) { return pvc; } } Map<String, Quantity> requests = new HashMap<>(); <START> requests.put("storage", new Quantity("10Gi")); <END> PersistentVolumeClaim pvc = new PersistentVolumeClaimBuilder() .withNewMetadata() .withName(persistentVolumeClaim) .endMetadata() .withNewSpec() .withAccessModes("ReadWriteOnce") .withNewResources() .withRequests(requests) .endResources() .endSpec() .build(); return pvc; }</code><technical_language>extract "10Gi" a constant. if a new che property for configurable</technical_language>

Target:
private PersistentVolumeClaim getClaimCheWorkspace() { PersistentVolumeClaimList pvcList = openShiftClient.persistentVolumeClaims().inNamespace(openShiftCheProjectName).list(); for(PersistentVolumeClaim pvc:pvcList.getItems()) { if (workspacesPersistentVolumeClaim.equals(pvc.getMetadata().getName())) { return pvc; } } Map<String, Quantity> requests = new HashMap<>(); requests.put("storage", new Quantity(workspacesPvcQuantity)); Map<String, String> annotations = Collections.singletonMap(OPENSHIFT_VOLUME_STORAGE_CLASS, OPENSHIFT_VOLUME_STORAGE_CLASS_NAME); PersistentVolumeClaim pvc = new PersistentVolumeClaimBuilder() .withNewMetadata() .withName(workspacesPersistentVolumeClaim) .withAnnotations(annotations) .endMetadata() .withNewSpec() .withAccessModes("ReadWriteMany") .withNewResources() .withRequests(requests) .endResources() .endSpec() .build(); pvc = openShiftClient.persistentVolumeClaims().inNamespace(openShiftCheProjectName).create(pvc); LOG.info("Creating OpenShift PVC {}", pvc.getMetadata().getName()); return pvc; }
Source:
<code>protected Map<String, Object> addSection(ParameterParser params, SessionState state) { String message; String errorMessage = null; Map<String, Object> results = new HashMap<String, Object>(); try { int locationId = params.getInt("locationId"); CitationCollectionOrder.SectionType sectionType = CitationCollectionOrder.SectionType.valueOf(params.getString("sectionType")); CitationCollection collection = getCitationCollection(state, false); CitationCollectionOrder citationCollectionOrder = new CitationCollectionOrder(collection.getId(), locationId, sectionType, rb.getString("nested.section.title.text")); errorMessage = getCitationValidator().getAddSectionErrorMessage(citationCollectionOrder, collection); if (errorMessage==null){ getCitationService().saveSection(citationCollectionOrder); message = rb.getString("resource.updated"); <START> logger.info("Reading list successfully updated."); <END> } else { message = errorMessage; logger.warn("Invalid citation list in addSection(). " + errorMessage); } state.setAttribute(STATE_CITATION_COLLECTION, null); } catch (Exception e){ message = e.getMessage(); logger.warn("Exception in addSection() " + e); } if(errorMessage==null && message != null && ! message.trim().equals("")) { results.put("message", message); } else { results.put("Error: ", new String[]{errorMessage}); } return results; }</code><technical_language>Debug level? include ID of item updated</technical_language>

Target:
protected Map<String, Object> addSection(ParameterParser params, SessionState state) { String message; String errorMessage = null; Map<String, Object> results = new HashMap<String, Object>(); try { int locationId = params.getInt("locationId"); CitationCollectionOrder.SectionType sectionType = CitationCollectionOrder.SectionType.valueOf(params.getString("sectionType")); CitationCollection collection = getCitationCollection(state, false); CitationCollectionOrder citationCollectionOrder = new CitationCollectionOrder(collection.getId(), locationId, sectionType, rb.getString("nested.section.title.text")); errorMessage = getCitationValidator().getAddSectionErrorMessage(citationCollectionOrder, collection); if (errorMessage==null){ getCitationService().saveSection(citationCollectionOrder); message = rb.getString("resource.updated"); logger.debug("Reading list with collection id: " + collection.getId() + " successfully updated. H1 section added at location: " + locationId); } else { message = errorMessage; logger.warn("Invalid citation list with collection id: " + collection.getId() + " in addSection(). " + errorMessage); } state.setAttribute(STATE_CITATION_COLLECTION, null); } catch (Exception e){ message = e.getMessage(); logger.warn("Exception in addSection() " + e); } if(errorMessage==null && message != null && ! message.trim().equals("")) { results.put("message", message); } else { results.put("Error: ", new String[]{errorMessage}); } return results; }
Source:
<code>protected void configureMessaging() { String provider = this.config.getString(ConfigProperties.CPM_PROVIDER); <START> if ("artemis".equalsIgnoreCase(provider)) { <END> bind(CPMContextListener.class).to(ArtemisContextListener.class).asEagerSingleton(); bind(CPMSessionFactory.class).to(ArtemisSessionFactory.class).asEagerSingleton(); } else { bind(CPMContextListener.class).to(NoopContextListener.class).asEagerSingleton(); bind(CPMSessionFactory.class).to(NoopSessionFactory.class).asEagerSingleton(); } }</code><technical_language>This ArtemisUtil.PROVIDER instead of magic string</technical_language>

Target:
protected void configureMessaging() { String provider = this.config.getString(ConfigProperties.CPM_PROVIDER); if (ArtemisUtil.PROVIDER.equalsIgnoreCase(provider)) { bind(CPMContextListener.class).to(ArtemisContextListener.class).asEagerSingleton(); bind(CPMSessionFactory.class).to(ArtemisSessionFactory.class).asEagerSingleton(); } else { bind(CPMContextListener.class).to(NoopContextListener.class).asEagerSingleton(); bind(CPMSessionFactory.class).to(NoopSessionFactory.class).asEagerSingleton(); } }
Source:
<code>public Dialog onCreateDialog(Bundle savedInstanceState) { ((HasComponent<ActivityComponent>) getActivity()).getComponent().inject(this); LayoutInflater inflater = parentActivity.getLayoutInflater(); View view = inflater.inflate(R.layout.tos_view, null); String apologyText = parentActivity.getString(R.string.language_apology_text); Spanned formattedApologyText = Html.fromHtml(apologyText); TextView apologyTextView = (TextView) view.findViewById(R.id.language_apology_box_text); apologyTextView.setText(formattedApologyText, TextView.BufferType.SPANNABLE); <START> String eulaText = String.format(parentActivity.getString(R.string.eula_text) + <END> getVersionName()); Spanned formattedEulaText = Html.fromHtml(eulaText); TextView eulaTextView = (TextView) view.findViewById(R.id.eula_box_text); eulaTextView.setText(formattedEulaText, TextView.BufferType.SPANNABLE); AlertDialog.Builder tosDialogBuilder = new AlertDialog.Builder(parentActivity) .setTitle(R.string.menu_tos) .setView(view); if (resultListener != null) { tosDialogBuilder .setPositiveButton(R.string.dialog_accept, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { acceptEula(dialog); } }) .setNegativeButton(R.string.dialog_decline, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { rejectEula(dialog); } }); } return tosDialogBuilder.create(); }</code><technical_language>This right. version number is supposed interpolated text. said....due refactorings of text longer a placeholder for in EULA text. end of world, remove String.format getVersionName altogether</technical_language>

Target:
public Dialog onCreateDialog(Bundle savedInstanceState) { ((HasComponent<ActivityComponent>) getActivity()).getComponent().inject(this); LayoutInflater inflater = parentActivity.getLayoutInflater(); View view = inflater.inflate(R.layout.tos_view, null); String apologyText = parentActivity.getString(R.string.language_apology_text); Spanned formattedApologyText = Html.fromHtml(apologyText); TextView apologyTextView = (TextView) view.findViewById(R.id.language_apology_box_text); apologyTextView.setText(formattedApologyText, TextView.BufferType.SPANNABLE); String eulaText = parentActivity.getString(R.string.eula_text); Spanned formattedEulaText = Html.fromHtml(eulaText); TextView eulaTextView = (TextView) view.findViewById(R.id.eula_box_text); eulaTextView.setText(formattedEulaText, TextView.BufferType.SPANNABLE); AlertDialog.Builder tosDialogBuilder = new AlertDialog.Builder(parentActivity) .setTitle(R.string.menu_tos) .setView(view); if (resultListener != null) { tosDialogBuilder .setPositiveButton(R.string.dialog_accept, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { acceptEula(dialog); } }) .setNegativeButton(R.string.dialog_decline, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { rejectEula(dialog); } }); } return tosDialogBuilder.create(); }
Source:
<code>private static boolean isLessThan2048(PyExpressionTree expression) { <START> return expression.is(Kind.NUMERIC_LITERAL) && ((PyNumericLiteralTree) expression).valueAsLong() < 2048; <END> }</code><technical_language>triggers a java.lang.NumberFormatException for dsa.generate_private_key(key_size=2048L)</technical_language>

Target:
private static boolean isLessThan2048(PyExpressionTree expression) { try { return expression.is(Kind.NUMERIC_LITERAL) && ((PyNumericLiteralTree) expression).valueAsLong() < 2048; } catch (NumberFormatException nfe) { return false; } }
Source:
<code>public void testLoginChoosingAuthenticationServiceFails() throws Exception { <START> securedLoginServiceImpl = new SecuredLoginServiceImpl(authenticationService, sessionService, sessionAccessor, identityService, logger); <END> final Map<String, Serializable> credentials = new HashMap<String, Serializable>(); final String login = "julien"; final String password = "julien"; credentials.put(AuthenticationConstants.BASIC_USERNAME, login); credentials.put(AuthenticationConstants.BASIC_PASSWORD, password); when(authenticationService.checkUserCredentials(login, password)).thenReturn(false); final String result = securedLoginServiceImpl.loginChoosingAppropriateAuthenticationService(credentials); verify(authenticationService, times(1)).checkUserCredentials(login, password); assertThat(result).isNull(); }</code><technical_language>duplicated code</technical_language>

Target:
public void testLoginChoosingAuthenticationServiceFails() throws Exception { securedLoginServiceImpl = instantiateLoginServiceWithAuthenticationService(); final Map<String, Serializable> credentials = new HashMap<String, Serializable>(); final String login = "julien"; final String password = "julien"; credentials.put(AuthenticationConstants.BASIC_USERNAME, login); credentials.put(AuthenticationConstants.BASIC_PASSWORD, password); when(authenticationService.checkUserCredentials(login, password)).thenReturn(false); final String result = securedLoginServiceImpl.loginChoosingAppropriateAuthenticationService(credentials); verify(authenticationService, times(1)).checkUserCredentials(login, password); assertThat(result).isNull(); }
Source:
<code>public void updateActivity(final boolean broadcast) { if (isAfk()) { setAfk(false); if (broadcast && !isHidden()) { setDisplayNick(); final String msg = tl("userIsNotAway", getDisplayName()); final String selfmsg = tl("userIsNotAwaySelf"); <START> if (!msg.isEmpty()) { <END> if (ess.getSettings().broadcastAfkMessage()) { ess.broadcastMessage(this, msg, Collections.singleton(this)); this.sendMessage(selfmsg); } else { this.sendMessage(selfmsg); } } } } lastActivity = System.currentTimeMillis(); }</code><technical_language>pretend reading message I wrote msg.isEmpty first.... yeah this confirms suspicion - if message is emptied, message broadcast. some more consistent behavior - currently if msg is empty, selfmsg if defined broadcastAfkMessage is false (as owner, I expect selfmsg user)</technical_language>

Target:
public void updateActivity(final boolean broadcast) { updateActivity(broadcast, AfkStatusChangeEvent.Cause.UNKNOWN); }
Source:
<code>protected void runTask() { ContentListingProgress progress = getProgress(); onStart(progress); <START> List<String> contentUris = contentLister.listContentUris(listingCriteria(progress)); <END> log.info("Running equiv on all content from {}", progress.getPublisher()); if (executor == null) { runSynchronously(contentUris); } else { runAsynchronously(contentUris); } }</code><technical_language>Iterator<String> is converted List<String></technical_language>

Target:
protected void runTask() { ContentListingProgress progress = getProgress(); onStart(progress); Iterator<String> uriIterator = contentLister.listContentUris(listingCriteria(progress)); Queue<String> contentUris = new LinkedList<>(); uriIterator.forEachRemaining(contentUris::add); log.info("Running equiv on all content from {}", progress.getPublisher()); if (executor == null) { runSynchronously(contentUris); } else { runAsynchronously(contentUris); } }
Source:
<code>public void start() { log.info("Starting spider..."); <START> this.timeStarted = new Date(); <END> fetchFilterSeeds(); if (seedList == null || seedList.isEmpty()) { log.warn("No seeds available for the Spider. Cancelling scan..."); notifyListenersSpiderComplete(false); notifyListenersSpiderProgress(100, 0, 0); return; } if (scanUser != null) log.info("Scan will be performed from the point of view of User: " + scanUser.getName()); this.controller.init(); this.stopped = false; this.paused = false; this.initialized = false; this.threadPool = Executors.newFixedThreadPool(spiderParam.getThreadCount()); httpSender = new HttpSender(connectionParam, true, HttpSender.SPIDER_INITIATOR); httpSender.setFollowRedirect(false); for (URI uri : seedList) { if (log.isDebugEnabled()) { log.debug("Adding seed for spider: " + uri); } controller.addSeed(uri, HttpRequestHeader.GET); } initialized = true; }</code><technical_language>If changed long, System.currentTimeMillis() instead of new Date()</technical_language>

Target:
public void start() { log.info("Starting spider..."); this.timeStarted = System.currentTimeMillis(); fetchFilterSeeds(); if (seedList == null || seedList.isEmpty()) { log.warn("No seeds available for the Spider. Cancelling scan..."); notifyListenersSpiderComplete(false); notifyListenersSpiderProgress(100, 0, 0); return; } if (scanUser != null) log.info("Scan will be performed from the point of view of User: " + scanUser.getName()); this.controller.init(); this.stopped = false; this.paused = false; this.initialized = false; this.threadPool = Executors.newFixedThreadPool(spiderParam.getThreadCount()); httpSender = new HttpSender(connectionParam, true, HttpSender.SPIDER_INITIATOR); httpSender.setFollowRedirect(false); for (URI uri : seedList) { if (log.isDebugEnabled()) { log.debug("Adding seed for spider: " + uri); } controller.addSeed(uri, HttpRequestHeader.GET); } initialized = true; }
Source:
<code>public void setJpegQuality(RCTCameraView view, int jpegQuality) { <START> view.setTorchMode(jpegQuality); <END> }</code><technical_language>This appears a mistake... a side note, is necessary proxy of methods java classes? I rationale original implementation</technical_language>

Target:
public void setJpegQuality(RCTCameraView view, int jpegQuality) { view.setJpegQuality(jpegQuality); }
Source:
<code>private void attemptToAssignToForce(Unit unit, int sourceForceID, Campaign sourceCampaign, Campaign destinationCampaign) { Force sourceForce = sourceCampaign.getForce(sourceForceID); <START> if(sourceForce == null) { <END> return; } if(sourceForce.getParentForce() == null) { destinationCampaign.getForces().addUnit(unit.getId()); } Force destForce = findForce(sourceForce.getFullName(), destinationCampaign.getForces()); if(destForce != null) { destForce.addUnit(unit.getId()); } else { List<Force> parentForces = getForceAndParents(sourceForce); Force currentDestinationForce = destinationCampaign.getForces(); for(int x = parentForces.size() - 1; x >= 0; x--) { Force nextSourceForce = parentForces.get(x); Force nextDestinationForce = findForce(nextSourceForce.getFullName(), currentDestinationForce); if(nextDestinationForce == null) { Force forceCopy = new Force(nextSourceForce.getName()); destinationCampaign.addForce(forceCopy, currentDestinationForce); currentDestinationForce = forceCopy; } else { currentDestinationForce = nextDestinationForce; } } currentDestinationForce.addUnit(unit.getId()); } }</code><technical_language>suggestion if (sourceForce == null) {</technical_language>

Target:
private void attemptToAssignToForce(Unit unit, int sourceForceID, Campaign sourceCampaign, Campaign destinationCampaign) { Force sourceForce = sourceCampaign.getForce(sourceForceID); if (sourceForce == null) { return; } if (sourceForce.getParentForce() == null) { destinationCampaign.getForces().addUnit(unit.getId()); } String sourceForceFullName = getDestinationFullName(sourceForce, sourceCampaign, destinationCampaign); Force destForce = findForce(sourceForceFullName, destinationCampaign.getForces()); if (destForce != null) { destForce.addUnit(unit.getId()); } else { List<Force> parentForces = getForceAndParents(sourceForce); Force currentDestinationForce = destinationCampaign.getForces(); for (int x = parentForces.size() - 1; x >= 0; x--) { Force nextSourceForce = parentForces.get(x); String nextSourceForceFullName = getDestinationFullName(nextSourceForce, sourceCampaign, destinationCampaign); Force nextDestinationForce = findForce(nextSourceForceFullName, currentDestinationForce); if (nextDestinationForce == null) { Force forceCopy = new Force(nextSourceForce.getName()); destinationCampaign.addForce(forceCopy, currentDestinationForce); currentDestinationForce = forceCopy; } else { currentDestinationForce = nextDestinationForce; } } currentDestinationForce.addUnit(unit.getId()); } }