auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
static synchronized <E extends BaseRealm> E createRealmOrGetFromCache(RealmConfiguration configuration, Class<E> realmClass) { boolean isCacheInMap = true; RealmCache cache = cachesMap.get(configuration.getPath()); if (cache == null) { cache = new RealmCache(configuration); isCacheInMap = false; } else { cache.validateConfiguration(configuration); } RefAndCount refAndCount = cache.refAndCountMap.get(RealmCacheType.valueOf(realmClass)); if (refAndCount.localRealm.get() == null) { BaseRealm realm; if (realmClass == Realm.class) { if (configuration.getDurability() != SharedGroup.Durability.MEM_ONLY) { copyAssetFile(configuration); } realm = Realm.createInstance(configuration, cache.typedColumnIndices); } else if (realmClass == DynamicRealm.class) { realm = DynamicRealm.createInstance(configuration); } else { throw new IllegalArgumentException(WRONG_REALM_CLASS_MESSAGE); } if (!isCacheInMap) { cachesMap.put(configuration.getPath(), cache); } refAndCount.localRealm.set(realm); refAndCount.localCount.set(0); } Integer refCount = refAndCount.localCount.get(); if (refCount == 0) { if (realmClass == Realm.class && refAndCount.globalCount == 0) { cache.typedColumnIndices = refAndCount.localRealm.get().schema.columnIndices; } refAndCount.globalCount++; } refAndCount.localCount.set(refCount + 1); @SuppressWarnings("unchecked") E realm = (E) refAndCount.localRealm.get(); return realm; }

Target:
static synchronized <E extends BaseRealm> E createRealmOrGetFromCache(RealmConfiguration configuration, Class<E> realmClass) { boolean isCacheInMap = true; RealmCache cache = cachesMap.get(configuration.getPath()); if (cache == null) { cache = new RealmCache(configuration); isCacheInMap = false; copyAssetFileIfNeeded(configuration); } else { cache.validateConfiguration(configuration); } RefAndCount refAndCount = cache.refAndCountMap.get(RealmCacheType.valueOf(realmClass)); if (refAndCount.localRealm.get() == null) { BaseRealm realm; if (realmClass == Realm.class) { realm = Realm.createInstance(configuration, cache.typedColumnIndices); } else if (realmClass == DynamicRealm.class) { realm = DynamicRealm.createInstance(configuration); } else { throw new IllegalArgumentException(WRONG_REALM_CLASS_MESSAGE); } if (!isCacheInMap) { cachesMap.put(configuration.getPath(), cache); } refAndCount.localRealm.set(realm); refAndCount.localCount.set(0); } Integer refCount = refAndCount.localCount.get(); if (refCount == 0) { if (realmClass == Realm.class && refAndCount.globalCount == 0) { cache.typedColumnIndices = refAndCount.localRealm.get().schema.columnIndices; } refAndCount.globalCount++; } refAndCount.localCount.set(refCount + 1); @SuppressWarnings("unchecked") E realm = (E) refAndCount.localRealm.get(); return realm; }
Source:
private static boolean authorized(PerunSession sess, String policyDefinition, List<PerunBean> objects) throws PolicyNotExistsException { if (!sess.getPerunPrincipal().isAuthzInitialized()) { refreshAuthz(sess); } if (sess.getPerunPrincipal().getRoles() == null) { return false; } List<JsonNode> allPolicies = fetchPolicyWithAllIncludedPolicies(policyDefinition); List<JsonNode> policyRoles = new ArrayList<>(); for (JsonNode policy : allPolicies) policyRoles.addAll(fetchPolicyRoles(policy)); List<PerunBean> allReliableObjects = fetchAllReliableObjects(objects); Map <String, List<PerunBean>> mapOfBeans = new HashMap<>(); for (PerunBean object: allReliableObjects) { if (!mapOfBeans.containsKey(object.getBeanName())) { List<PerunBean> listOfbeans = new ArrayList<>(); listOfbeans.add(object); mapOfBeans.put(object.getBeanName(), listOfbeans); } else mapOfBeans.get(object.getBeanName()).add(object); } return resolveAuthorization(sess, policyRoles, mapOfBeans); }

Target:
public static boolean authorized(PerunSession sess, String policyDefinition, List<PerunBean> objects) throws PolicyNotExistsException { if (!sess.getPerunPrincipal().isAuthzInitialized()) { refreshAuthz(sess); } if (sess.getPerunPrincipal().getRoles() == null) { return false; } List<PerunPolicy> allPolicies = AuthzResolverImpl.fetchPolicyWithAllIncludedPolicies(policyDefinition); List<Map<String, String>> policyRoles = new ArrayList<>(); for (PerunPolicy policy : allPolicies) policyRoles.addAll(policy.getPerunRoles()); Map <String, Set<Integer>> mapOfBeans = fetchAllRelatedObjects(objects); return resolveAuthorization(sess, policyRoles, mapOfBeans); }
Source:
private void runAllParagraphs(NotebookSocket conn, Message fromMessage) throws IOException { final String noteId = (String) fromMessage.get("noteId"); List<Map<String, Object>> paragraphs = gson.fromJson(String.valueOf(fromMessage.data.get("paragraphs")), new TypeToken<List<Map<String, Object>>>() { }.getType()); Note note = notebook().getNote(noteId); try { note.setRunning(true); getNotebookService().runAllParagraphs(noteId, paragraphs, getServiceContext(fromMessage), new WebSocketServiceCallback<Paragraph>(conn)); } finally { note.setRunning(false); } }

Target:
private void runAllParagraphs(NotebookSocket conn, Message fromMessage) throws IOException { final String noteId = (String) fromMessage.get("noteId"); List<Map<String, Object>> paragraphs = gson.fromJson(String.valueOf(fromMessage.data.get("paragraphs")), new TypeToken<List<Map<String, Object>>>() { }.getType()); getNotebookService().runAllParagraphs(noteId, paragraphs, getServiceContext(fromMessage), new WebSocketServiceCallback<Paragraph>(conn)); }
Source:
protected void addAllocationColumn() { ArrayList<String> allocationTypes = new ArrayList<>(); allocationTypes.add(constants.thinAllocation()); allocationTypes.add(constants.preallocatedAllocation()); customSelectionCellFormatType = new CustomSelectionCell(allocationTypes); customSelectionCellFormatType.setStyle(""); AbstractColumn<DiskImage, String> allocationColumn = new AbstractColumn<DiskImage, String>( customSelectionCellFormatType) { @Override public String getValue(DiskImage disk) { ImportDiskData importData = importModel.getDiskImportData(disk.getId()); if (importData == null) { return ""; } return new EnumRenderer<VolumeType>().render(VolumeType.forValue(importData.getSelectedVolumeType() .getValue())); } @Override public SafeHtml getTooltip(DiskImage object) { return SafeHtmlUtils.fromSafeConstant(constants.importAllocationModifiedCollapse()); } }; allocationColumn.setFieldUpdater(new FieldUpdater<DiskImage, String>() { @Override public void update(int index, DiskImage disk, String value) { VolumeType tempVolumeType = VolumeType.Sparse; if (value.equals(constants.thinAllocation())) { tempVolumeType = VolumeType.Sparse; } else if (value.equals(constants.preallocatedAllocation())) { tempVolumeType = VolumeType.Preallocated; } ImportDiskData importData = importModel.getDiskImportData(disk.getId()); if (importData != null) { importData.setSelectedVolumeType(tempVolumeType); } } }); diskTable.addColumn(allocationColumn, constants.allocationDisk(), "150px"); }

Target:
protected void addAllocationColumn() { ArrayList<String> allocationTypes = new ArrayList<>(); allocationTypes.add(constants.thinAllocation()); allocationTypes.add(constants.preallocatedAllocation()); customSelectionCellFormatType = new CustomSelectionCell(allocationTypes); customSelectionCellFormatType.setStyle(EMPTY_STYLE); AbstractColumn<DiskImage, String> allocationColumn = new AbstractColumn<DiskImage, String>( customSelectionCellFormatType) { @Override public String getValue(DiskImage disk) { ImportDiskData importData = importModel.getDiskImportData(disk.getId()); if (importData == null) { return ""; } return new EnumRenderer<VolumeType>().render(VolumeType.forValue(importData.getSelectedVolumeType() .getValue())); } @Override public SafeHtml getTooltip(DiskImage object) { return SafeHtmlUtils.fromSafeConstant(constants.importAllocationModifiedCollapse()); } }; allocationColumn.setFieldUpdater(new FieldUpdater<DiskImage, String>() { @Override public void update(int index, DiskImage disk, String value) { VolumeType tempVolumeType = VolumeType.Sparse; if (value.equals(constants.thinAllocation())) { tempVolumeType = VolumeType.Sparse; } else if (value.equals(constants.preallocatedAllocation())) { tempVolumeType = VolumeType.Preallocated; } ImportDiskData importData = importModel.getDiskImportData(disk.getId()); if (importData != null) { importData.setSelectedVolumeType(tempVolumeType); } } }); diskTable.addColumn(allocationColumn, constants.allocationDisk(), "150px"); }
Source:
public static void refreshBundles(BundleContext bundleContext, Set<Bundle> bundles) { bundleContext.getBundle(0).adapt(FrameworkWiring.class).refreshBundles(bundles); }

Target:
public static void refreshBundles(BundleContext bundleContext, Set<Bundle> bundles) { bundleContext.getBundle(SYSTEM_BUNDLE_LOCATION).adapt(FrameworkWiring.class).refreshBundles(bundles); }
Source:
public MetaDataMutationResult dropIndex(List<Mutation> tableMetadata, String tableName) throws SQLException { throw new UnsupportedOperationException(); }

Target:
public MetaDataMutationResult dropIndex(List<Mutation> tableMetadata, String tableName) throws SQLException { return new MetaDataMutationResult(MutationCode.TABLE_ALREADY_EXISTS, 0, null); }
Source:
private void onCRUD(Item item, String action) { try { final boolean emitSystemEvents = DatadogUtilities.getDatadogGlobalDescriptor().isEmitSystemEvents(); if (!emitSystemEvents) { return; } logger.fine("Start DatadogItemListener#on" + action); DatadogClient client = DatadogUtilities.getDatadogClient(); Map<String, Set<String>> tags = DatadogUtilities.getDatadogGlobalDescriptor().getGlobalTags(); DatadogEvent event = new ItemCRUDEventImpl(item, action, tags); client.sendEvent(event.createPayload()); String hostname = DatadogUtilities.getHostname("null"); client.incrementCounter("jenkins.item." + action.toLowerCase(), hostname, tags); logger.fine("End DatadogItemListener#on" + action); } catch (Exception e) { logger.warning("Unexpected exception occurred - " + e.getMessage()); } }

Target:
private void onCRUD(Item item, String action) { try { final boolean emitSystemEvents = DatadogUtilities.getDatadogGlobalDescriptor().isEmitSystemEvents(); if (!emitSystemEvents) { return; } logger.fine("Start DatadogItemListener#on" + action); DatadogClient client = DatadogUtilities.getDatadogClient(); Map<String, Set<String>> tags = DatadogUtilities.getTagsFromGlobalTags(); DatadogEvent event = new ItemCRUDEventImpl(item, action, tags); client.sendEvent(event.createPayload()); String hostname = DatadogUtilities.getHostname("null"); client.incrementCounter("jenkins.item." + action.toLowerCase(), hostname, tags); logger.fine("End DatadogItemListener#on" + action); } catch (Exception e) { logger.warning("Unexpected exception occurred - " + e.getMessage()); } }
Source:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getTemplateType() != VmEntityType.INSTANCE_TYPE) { validate(getVirtioRngValidator().canAddRngDevice(getVdsGroup(), getParameters().getRngDevice())); } if (getRngDevices().isEmpty()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_RNG_NOT_FOUND); } return true; }

Target:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getTemplateType() != VmEntityType.INSTANCE_TYPE) { if (!validate(getVirtioRngValidator().canAddRngDevice(getVdsGroup(), getParameters().getRngDevice()))) { return false; } } if (getRngDevices().isEmpty()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_RNG_NOT_FOUND); } return true; }
Source:
public void onGetEndUserIdSuccess(long endUserId) { endUser.setId(endUserId); if(this.endUser.hasProperties() || this.endUser.getExternalId() != null || this.endUser.getPhoneNumber() != null) { sendUpdateEndUserRequest(); } showSurvey(); }

Target:
public void onGetEndUserIdSuccess(long endUserId) { endUser.setId(endUserId); if(this.endUser.hasProperties() || this.endUser.hasExternalId() || this.endUser.hasPhoneNumber()) { sendUpdateEndUserRequest(); } showSurvey(); }
Source:
private static void putDocumentWithRetry(String indexName, final Document document) throws TeammatesException, MaximumRetriesExceededException { final Index index = getIndex(indexName); RM.runUntilSuccessful(new RetryableTaskReturnsThrows<OperationResult, TeammatesException>("Put document") { @Override public OperationResult run() { try { PutResponse response = index.put(document); return response.getResults().get(0); } catch (PutException e) { return e.getOperationResult(); } } public boolean isSuccessful(OperationResult result) throws TeammatesException { finalMessage = result.getMessage(); if (StatusCode.OK.equals(result.getCode())) { return true; } else if (StatusCode.TRANSIENT_ERROR.equals(result.getCode())) { return false; } else { throw new TeammatesException(finalMessage); } } }); }

Target:
private static void putDocumentWithRetry(String indexName, final Document document) throws PutException, MaximumRetriesExceededException { final Index index = getIndex(indexName); RM.runUntilSuccessful(new RetryableTaskThrows<PutException>("Put document") { private OperationResult lastResult; @Override public void run() { try { PutResponse response = index.put(document); lastResult = response.getResults().get(0); } catch (PutException e) { lastResult = e.getOperationResult(); } } @Override public boolean isSuccessful() throws PutException { finalMessage = lastResult.getMessage(); if (StatusCode.OK.equals(lastResult.getCode())) { return true; } else if (StatusCode.TRANSIENT_ERROR.equals(lastResult.getCode())) { return false; } else { throw new PutException(lastResult); } } }); }
Source:
protected List<String> getPropertiesToHide(ScenarioGridColumn selectedColumn, ScenarioGridModel scenarioGridModel) { List<String> toReturn = new ArrayList<>(); if (selectedColumn != null && !selectedColumn.isPropertyAssigned()) { scenarioGridModel.getSimulation().ifPresent(simulation -> { final SimulationDescriptor simulationDescriptor = simulation.getSimulationDescriptor(); List<ScenarioGridColumn> instanceColumns = scenarioGridModel.getInstanceScenarioGridColumns(selectedColumn); toReturn.addAll(instanceColumns.stream() .filter(ScenarioGridColumn::isPropertyAssigned) .map(instanceColumn -> scenarioGridModel.getColumns().indexOf(instanceColumn)) .map(columnIndex -> { String propertyString = String.join(".", simulationDescriptor.getFactMappingByIndex(columnIndex).getExpressionElementsWithoutClass() .stream() .map(ExpressionElement::getStep) .collect(Collectors.toList())); propertyString = propertyString.isEmpty() ? "value" : propertyString; return propertyString; }) .collect(Collectors.toList())); }); } return toReturn; }

Target:
protected List<String> getPropertiesToHide(ScenarioGridColumn selectedColumn, ScenarioGridModel scenarioGridModel) { List<String> toReturn = new ArrayList<>(); if (!selectedColumn.isPropertyAssigned()) { scenarioGridModel.getSimulation().ifPresent(simulation -> { final SimulationDescriptor simulationDescriptor = simulation.getSimulationDescriptor(); List<ScenarioGridColumn> instanceColumns = scenarioGridModel.getInstanceScenarioGridColumns(selectedColumn); toReturn.addAll(instanceColumns.stream() .filter(ScenarioGridColumn::isPropertyAssigned) .map(instanceColumn -> scenarioGridModel.getColumns().indexOf(instanceColumn)) .map(columnIndex -> { String propertyString = String.join(".", simulationDescriptor.getFactMappingByIndex(columnIndex).getExpressionElementsWithoutClass() .stream() .map(ExpressionElement::getStep) .collect(Collectors.toList())); propertyString = propertyString.isEmpty() ? "value" : propertyString; return propertyString; }) .collect(Collectors.toList())); }); } return toReturn; }
Source:
public static void enrichDiskByJsonDescription(String jsonDiskDescription, Disk disk) throws IOException { Map<String, Object> diskDescriptionMap = JsonHelper.jsonToMap(jsonDiskDescription); disk.setDiskAlias((String) diskDescriptionMap.get(DISK_ALIAS)); disk.setDiskDescription((String) diskDescriptionMap.get(DISK_DESCRIPTION)); }

Target:
public static void enrichDiskByJsonDescription(String jsonDiskDescription, Disk disk) throws IOException { Map<String, Object> diskDescriptionMap = JsonHelper.jsonToMap(jsonDiskDescription); disk.setDiskAlias(diskDescriptionMap.get(DISK_ALIAS).toString()); disk.setDiskDescription(diskDescriptionMap.get(DISK_DESCRIPTION).toString()); }
Source:
public TwigAssetCompletionContributor() { extend(CompletionType.BASIC, TwigHelper.getAutocompletableAssetPattern(), new AssetCompletionProvider().setAssetParser( new AssetDirectoryReader() )); extend(CompletionType.BASIC, TwigHelper.getAutocompletableAssetTag("stylesheets"), new AssetCompletionProvider().setAssetParser( new AssetDirectoryReader().setFilterExtension("css").setIncludeBundleDir(true) )); extend(CompletionType.BASIC, TwigHelper.getAutocompletableAssetTag("javascripts"), new AssetCompletionProvider().setAssetParser( new AssetDirectoryReader().setFilterExtension("js").setIncludeBundleDir(true) )); }

Target:
public TwigAssetCompletionContributor() { extend(CompletionType.BASIC, TwigHelper.getAutocompletableAssetPattern(), new AssetCompletionProvider().setAssetParser( new AssetDirectoryReader() )); extend(CompletionType.BASIC, TwigHelper.getAutocompletableAssetTag("stylesheets"), new AssetCompletionProvider().setAssetParser( new AssetDirectoryReader().setFilterExtension("css", "less", "sass").setIncludeBundleDir(true) )); extend(CompletionType.BASIC, TwigHelper.getAutocompletableAssetTag("javascripts"), new AssetCompletionProvider().setAssetParser( new AssetDirectoryReader().setFilterExtension("js", "dart", "coffee").setIncludeBundleDir(true) )); }
Source:
public void testTimestampRangeFilterWithMaxVal() throws IOException { int numCols = Integer.MAX_VALUE; Long start = (long) (Integer.MAX_VALUE - 2); String goodValue = "includeThisValue"; Table table = getDefaultTable(); byte[] rowKey = dataHelper.randomData("testRow-TimestampRange-"); Put put = new Put(rowKey); for (Long i = start; i < numCols; ++i) { put.addColumn(COLUMN_FAMILY, dataHelper.randomData(""), i, Bytes.toBytes(goodValue)); } table.put(put); FilterList filter = new FilterList(FilterList.Operator.MUST_PASS_ALL, new TimestampRangeFilter(start, Integer.MAX_VALUE), new FamilyFilter(CompareOp.EQUAL, new BinaryComparator(Bytes.toBytes("test_family")))); Get get = new Get(rowKey).setFilter(filter); Result result = table.get(get); Cell[] cells = result.rawCells(); Assert.assertEquals("Should have all cells.", 2, cells.length); long[] timestamps = new long[] { cells[0].getTimestamp(), cells[1].getTimestamp() }; Arrays.sort(timestamps); Assert.assertArrayEquals(new long[] { start, Integer.MAX_VALUE-1 }, timestamps); table.close(); }

Target:
public void testTimestampRangeFilterWithMaxVal() throws IOException { long numCols = Integer.MAX_VALUE; long start = Integer.MAX_VALUE - 2; String goodValue = "includeThisValue"; Table table = getDefaultTable(); byte[] rowKey = dataHelper.randomData("testRow-TimestampRange-"); Put put = new Put(rowKey); for (long i = start; i < numCols; ++i) { put.addColumn(COLUMN_FAMILY, dataHelper.randomData(""), i, Bytes.toBytes(goodValue)); } table.put(put); Filter filter = new TimestampRangeFilter(start, Integer.MAX_VALUE); Get get = new Get(rowKey).setFilter(filter); Result result = table.get(get); Cell[] cells = result.rawCells(); Assert.assertEquals("Should have all cells.", 2, cells.length); long[] timestamps = new long[] { cells[0].getTimestamp(), cells[1].getTimestamp() }; Arrays.sort(timestamps); Assert.assertArrayEquals(new long[] { start, Integer.MAX_VALUE-1 }, timestamps); table.close(); }
Source:
public String getSelectedSite(final List<Host> siteList, final String siteInSession, User user) { String selectedSite = UtilMethods.isSet(siteInSession) ? siteInSession : StringUtils.EMPTY; boolean siteFound = false; if (siteList != null && !siteList.isEmpty()) { Host host = null; try { host = this.hostAPI.find(siteInSession, user, Boolean.FALSE); } catch (DotDataException e) { } catch (DotSecurityException e) { } if (null != host && UtilMethods.isSet(host.getIdentifier())) { siteFound = true; if(!siteList.contains(host)){ siteList.add(host); } } if (!siteFound) { selectedSite = siteList.get(0).getIdentifier(); } } return selectedSite; }

Target:
public String getSelectedSite(final List<Host> siteList, final String siteInSession, User user) { String selectedSite = UtilMethods.isSet(siteInSession) ? siteInSession : StringUtils.EMPTY; boolean siteFound = false; if (siteList != null && !siteList.isEmpty()) { Host host = null; try { host = this.hostAPI.find(siteInSession, user, Boolean.FALSE); } catch (DotDataException | DotSecurityException e) { debug(SiteHelper.class, "User doesn't have permission to see host ["+siteInSession+"}. error"+e.getMessage()); } if (null != host && UtilMethods.isSet(host.getIdentifier())) { siteFound = true; if(!siteList.contains(host)){ siteList.add(host); } } if (!siteFound) { selectedSite = siteList.get(0).getIdentifier(); } } return selectedSite; }
Source:
public JsonNode set(String name, JsonNode jsonNode) { return JsonNodeUtils.fromJacksonNode(objectNode.replace(name, JsonNodeUtils.toJacksonNode(jsonNode))); }

Target:
public JsonNode set(String name, JsonNode jsonNode) { com.fasterxml.jackson.databind.JsonNode oldValue = objectNode.replace(name, JsonNodeUtils.toJacksonNode(jsonNode)); return (oldValue == null) ? null : JsonNodeUtils.fromJacksonNode(oldValue); }
Source:
public static Booleans copyOrUpdate(Realm realm, Booleans object, boolean update, Map<RealmObject,RealmObjectProxy> cache) { if (((RealmObject) object).realm != null && ((RealmObject) object).realm.threadId != realm.threadId) { throw new IllegalArgumentException( "Objects belonging to Realm instances in other threads cannot be copied into this Realm instance."); } if (((RealmObject) object).realm != null && ((RealmObject) object).realm.getPath().equals(realm.getPath())) { return object; } return copy(realm, object, update, cache); }

Target:
public static Booleans copyOrUpdate(Realm realm, Booleans object, boolean update, Map<RealmObject,RealmObjectProxy> cache) { if (((RealmObject) object).realm != null && ((RealmObject) object).realm.threadId != realm.threadId) { throw new IllegalArgumentException( "Objects which belong to Realm instances in other threads cannot be copied into this Realm instance."); } if (((RealmObject) object).realm != null && ((RealmObject) object).realm.getPath().equals(realm.getPath())) { return object; } return copy(realm, object, update, cache); }
Source:
public SnomedRefSetSearchRequestBuilder filterByMapTargetComponentType(String mapTargetComponentType) { if (Strings.isNullOrEmpty(mapTargetComponentType)) { return getSelf(); } if (TerminologyRegistry.UNSPECIFIED.equals(mapTargetComponentType)) { return getSelf(); } final int referencedComponentTypeAsInt = TerminologyRegistry.INSTANCE.getTerminologyComponentById(mapTargetComponentType).shortId(); return filterByMapTargetComponentType(referencedComponentTypeAsInt); }

Target:
public SnomedRefSetSearchRequestBuilder filterByMapTargetComponentType(String mapTargetComponentType) { if (Strings.isNullOrEmpty(mapTargetComponentType)) { return getSelf(); } final int referencedComponentTypeAsInt = TerminologyRegistry.INSTANCE.getTerminologyComponentById(mapTargetComponentType).shortId(); return filterByMapTargetComponentType(referencedComponentTypeAsInt); }
Source:
void registerCommandOnce() { if (this.commandRegistered.compareAndSet(false, true)) { Sponge.getGame().getCommandDispatcher().register(Sponge.getPlugin(), CommandSpec.builder() .description(t("Helper command for paginations occurring")) .arguments(new ActivePaginationCommandElement(t("pagination-id")), integer(t("page"))) .executor(new CommandExecutor() { @Override public CommandResult execute(CommandSource src, CommandContext args) throws CommandException { args.<ActivePagination>getOne("pagination-id").get().sendPage(args.<Integer>getOne("page").get()); return CommandResult.success(); } }).build(), "pagination", "page"); } }

Target:
void registerCommandOnce() { if (this.commandRegistered.compareAndSet(false, true)) { Sponge.getGame().getCommandDispatcher().register(Sponge.getPlugin(), CommandSpec.builder() .description(t("Helper command for paginations occurring")) .arguments(new ActivePaginationCommandElement(t("pagination-id"))) .child(CommandSpec.builder() .description(t("Go to the next page")) .executor(new CommandExecutor() { @Override public CommandResult execute(CommandSource src, CommandContext args) throws CommandException { args.<ActivePagination>getOne("pagination-id").get().nextPage(); return CommandResult.success(); } }).build(), "next", "n") .child(CommandSpec.builder() .description(t("Go to the previous page")) .executor(new CommandExecutor() { @Override public CommandResult execute(CommandSource src, CommandContext args) throws CommandException { args.<ActivePagination>getOne("pagination-id").get().previousPage(); return CommandResult.success(); } }).build(), "previous", "prev", "p") .child(CommandSpec.builder() .description(t("Go to a specific page")) .arguments(integer(t("page"))) .executor(new CommandExecutor() { @Override public CommandResult execute(CommandSource src, CommandContext args) throws CommandException { args.<ActivePagination>getOne("pagination-id").get().specificPage(args.<Integer>getOne("page").get()); return CommandResult.success(); } }).build(), "page") .build(), "pagination", "page"); } }
Source:
public void testConfigurePipelineSchemaValidation() throws Exception { MockTestConfigurer mockConfigurer = new MockTestConfigurer(Schema.of(Schema.Type.BYTES)); S3_TRANSFORM.configurePipeline(mockConfigurer); Assert.assertEquals(LOG_SCHEMA, mockConfigurer.getOutputSchema()); mockConfigurer = new MockTestConfigurer(Schema.of(Schema.Type.STRING)); S3_TRANSFORM.configurePipeline(mockConfigurer); Assert.assertEquals(LOG_SCHEMA, mockConfigurer.getOutputSchema()); }

Target:
public void testConfigurePipelineSchemaValidation() throws Exception { Schema inputSchemaString = Schema.recordOf( "event", Schema.Field.of("CLF", Schema.of(Schema.Type.STRING)), Schema.Field.of("body", Schema.of(Schema.Type.STRING))); MockPipelineConfigurer mockConfigurer = new MockPipelineConfigurer(inputSchemaString); S3_TRANSFORM.configurePipeline(mockConfigurer); Assert.assertEquals(LOG_SCHEMA, mockConfigurer.getOutputSchema()); Schema inputSchemaBytes = Schema.recordOf( "event", Schema.Field.of("CLF", Schema.of(Schema.Type.STRING)), Schema.Field.of("body", Schema.of(Schema.Type.BYTES))); mockConfigurer = new MockPipelineConfigurer(inputSchemaBytes); CLF_TRANSFORM.configurePipeline(mockConfigurer); Assert.assertEquals(LOG_SCHEMA, mockConfigurer.getOutputSchema()); }
Source:
private AlarmType getAlarmType(final Map<String, String> parameters, final int index) { final String key = PlatformSmartmeteringKeys.ALARM_TYPE + "_" + index; if (parameters.containsKey(key)) { return AlarmType.fromValue(parameters.get(key)); } return DEFAULT_ALARM_TYPE; }

Target:
private AlarmType getAlarmType(final Map<String, String> parameters, final int index) { final String key = SettingsHelper.makeKey(PlatformSmartmeteringKeys.ALARM_TYPE, index); return Helpers.getEnum(parameters, key, AlarmType.class, DEFAULT_ALARM_TYPE); }
Source:
private AmplifyStateTracker( @NonNull final Context context, @NonNull final ILogger logger) { this.applicationContext = context.getApplicationContext(); this.logger = logger; this.lastEventTimePredicates = new LastTimeMap(logger, applicationContext); this.firstEventTimePredicates = new FirstTimeMap(logger, applicationContext); this.lastEventVersionPredicates = new LastVersionMap(logger, applicationContext); this.totalEventCountPredicates = new TotalCountMap(logger, applicationContext); }

Target:
private AmplifyStateTracker( @NonNull final Context context, @NonNull final ILogger logger) { this.applicationContext = context.getApplicationContext(); this.logger = logger; this.lastTimePredicate = new LastTimePredicate(logger, applicationContext); this.firstTimePredicate = new FirstTimePredicate(logger, applicationContext); this.lastVersionPredicate = new LastVersionPredicate(logger, applicationContext); this.totalCountPredicate = new TotalCountPredicate(logger, applicationContext); }
Source:
<K, V> void pipeRecord(final String topic, final TestRecord<K, V> record, final Serializer<K> keySerializer, final Serializer<V> valueSerializer, final Instant time) { final byte[] serializedKey = keySerializer.serialize(topic, record.headers(), record.key()); final byte[] serializedValue = valueSerializer.serialize(topic, record.headers(), record.value()); long timestamp = 0; if (time != null) timestamp = time.toEpochMilli(); else if (record.timestamp() != null) timestamp = record.timestamp(); pipeRecord(topic, timestamp, serializedKey, serializedValue, record.headers()); }

Target:
<K, V> void pipeRecord(final String topic, final TestRecord<K, V> record, final Serializer<K> keySerializer, final Serializer<V> valueSerializer, final Instant time) { final byte[] serializedKey = keySerializer.serialize(topic, record.headers(), record.key()); final byte[] serializedValue = valueSerializer.serialize(topic, record.headers(), record.value()); long timestamp = 0; if (time != null) { timestamp = time.toEpochMilli(); } else if (record.timestamp() != null) { timestamp = record.timestamp(); } pipeRecord(topic, timestamp, serializedKey, serializedValue, record.headers()); }
Source:
public StatusOnlyReturnForXmlRpc glusterVolumeStart(String volumeName, Boolean force) { try { return new StatusOnlyReturnForXmlRpc(vdsServer.glusterVolumeStart(volumeName, force.toString())); } catch (UndeclaredThrowableException ute) { throw new XmlRpcRunTimeException(ute); } }

Target:
public StatusOnlyReturnForXmlRpc glusterVolumeStart(String volumeName, Boolean force) { try { return new StatusOnlyReturnForXmlRpc(vdsServer.glusterVolumeStart(volumeName, force)); } catch (UndeclaredThrowableException ute) { throw new XmlRpcRunTimeException(ute); } }
Source:
public @ResponseBody List<Member> getPlayersForTeam( HttpSession session, @PathVariable int id) { if (session.getAttribute("member") == null) { return null; } TeamDao teamDao = new TeamDao(); Team team = teamDao.getTeamById(id, false, true, false); return (List<Member>) team.getPlayers(); }

Target:
public @ResponseBody Set<Member> getPlayersForTeam( HttpSession session, @PathVariable int id) { if (session.getAttribute("member") == null) { return null; } TeamDao teamDao = new TeamDao(); Team team = teamDao.getTeamById(id, false, true, false); return team.getPlayers(); }
Source:
public boolean onTouchEvent(MotionEvent ev) { lastActiveGestureDetector = realObject; onTouchEventMotionEvent = ev; return directlyOn(realObject, GestureDetector.class, "onTouchEvent", from(MotionEvent.class, ev)); }

Target:
public boolean onTouchEvent(MotionEvent ev) { lastActiveGestureDetector = realObject; onTouchEventMotionEvent = ev; return directlyOn(realObject, GestureDetector.class).onTouchEvent(ev); }
Source:
private void initRenderingModules() { renderingModuleRegistry = context.get(RenderingModuleRegistry.class); if (renderingModuleRegistry.getOrderedRenderingModules().isEmpty()) { renderingModuleRegistry.updateRenderingModulesOrder(context.get(ModuleManager.class).getEnvironment(), context); if(renderingModuleRegistry.getOrderedRenderingModules().isEmpty()) { GameEngine gameEngine = context.get(GameEngine.class); gameEngine.changeState(new StateMainMenu("No rendering module loaded, unable to render. Try enabling CoreRendering.")); } } else { renderingModuleRegistry.updateModulesContext(context); } for (ModuleRendering moduleRenderingInstance : renderingModuleRegistry.getOrderedRenderingModules()) { if (moduleRenderingInstance.isEnabled()) { logger.info(String.format("\nInitialising rendering class %s from %s module.\n", moduleRenderingInstance.getClass().getSimpleName(), moduleRenderingInstance.getProvidingModule())); moduleRenderingInstance.initialise(); } } requestTaskListRefresh(); }

Target:
private void initRenderingModules() { renderingModuleRegistry = context.get(RenderingModuleRegistry.class); if (renderingModuleRegistry.getOrderedRenderingModules().isEmpty()) { List<ModuleRendering> renderingModules = renderingModuleRegistry.updateRenderingModulesOrder( context.get(ModuleManager.class).getEnvironment(), context); if (renderingModules.isEmpty()) { GameEngine gameEngine = context.get(GameEngine.class); gameEngine.changeState(new StateMainMenu("No rendering module loaded, unable to render. Try enabling CoreRendering.")); } } else { renderingModuleRegistry.updateModulesContext(context); } for (ModuleRendering moduleRenderingInstance : renderingModuleRegistry.getOrderedRenderingModules()) { if (moduleRenderingInstance.isEnabled()) { logger.info(String.format("\nInitialising rendering class %s from %s module.\n", moduleRenderingInstance.getClass().getSimpleName(), moduleRenderingInstance.getProvidingModule())); moduleRenderingInstance.initialise(); } } requestTaskListRefresh(); }
Source:
public void shouldCreatePersonWithFields() { Person fetchedPerson = personAdapter.getPersonByUuid(DEFAULT_CONFIG_NAME, createdPerson.getUuid()); assertEquals(person.getPreferredName().getGivenName(), fetchedPerson.getPreferredName().getGivenName()); assertEquals(person.getPreferredName().getMiddleName(), fetchedPerson.getPreferredName().getMiddleName()); assertEquals(person.getPreferredName().getFamilyName(), fetchedPerson.getPreferredName().getFamilyName()); Person.Address personAddress = person.getPreferredAddress(); Person.Address fetchedPersonAddress = fetchedPerson.getPreferredAddress(); assertEquals(personAddress.getAddress1(), fetchedPersonAddress.getAddress1()); assertEquals(personAddress.getAddress2(), fetchedPersonAddress.getAddress2()); assertEquals(personAddress.getAddress3(), fetchedPersonAddress.getAddress3()); assertEquals(personAddress.getAddress4(), fetchedPersonAddress.getAddress4()); assertEquals(personAddress.getAddress5(), fetchedPersonAddress.getAddress5()); assertEquals(personAddress.getAddress6(), fetchedPersonAddress.getAddress6()); assertEquals(personAddress.getCityVillage(), fetchedPersonAddress.getCityVillage()); assertEquals(personAddress.getStateProvince(), fetchedPersonAddress.getStateProvince()); assertEquals(personAddress.getCountry(), fetchedPersonAddress.getCountry()); assertEquals(personAddress.getCountyDistrict(), fetchedPersonAddress.getCountyDistrict()); assertEquals(personAddress.getPostalCode(), fetchedPersonAddress.getPostalCode()); assertEquals(personAddress.getLatitude(), fetchedPersonAddress.getLatitude()); assertEquals(personAddress.getLongitude(), fetchedPersonAddress.getLongitude()); assertEquals(personAddress.getStartDate(), fetchedPersonAddress.getStartDate()); assertEquals(personAddress.getEndDate(), fetchedPersonAddress.getEndDate()); }

Target:
public void shouldCreatePersonWithFields() { Person fetchedPerson = personAdapter.getPersonByUuid(DEFAULT_CONFIG_NAME, createdPerson.getUuid()); assertEquals(person.getPreferredName().getGivenName(), fetchedPerson.getPreferredName().getGivenName()); assertEquals(person.getPreferredName().getMiddleName(), fetchedPerson.getPreferredName().getMiddleName()); assertEquals(person.getPreferredName().getFamilyName(), fetchedPerson.getPreferredName().getFamilyName()); assertEquals(person.getPreferredAddress(), fetchedPerson.getPreferredAddress()); }
Source:
public String toString() { return String.join(".", Integer.toString(major), Integer.toString(minor), Integer.toString(micro), qualifier); }

Target:
public String toString() { return major + DELIMITER + minor + DELIMITER + micro + DELIMITER + qualifier; }
Source:
T remove() { Map.Entry<Long, Queue<T>> workQueue = queuedRequests.get(id); T result = workQueue.getValue().remove(); if (!workQueue.getValue().isEmpty()) { queuedRequests.put(workQueue.getKey(), workQueue.getValue()); } return result; }

Target:
T remove() { Map.Entry<Long, Queue<T>> workQueue = nextTask(); T result = workQueue.getValue().remove(); if (!workQueue.getValue().isEmpty()) { queuedRequests.put(workQueue.getKey(), workQueue.getValue()); } return result; }
Source:
public WriteOptimization getWriteOptimization() { final String writeOptimizationString = this.getOptionValue(WRITE_OPTIMIZATION.getLongOpt()); try { if (writeOptimizationString == null) { return null; } else { return WriteOptimization.valueOf(writeOptimizationString.toUpperCase()); } } catch (final IllegalArgumentException e) { System.err.printf("Error: Unknown write_optimization: %s", writeOptimizationString); System.exit(1); } return null; }

Target:
public WriteOptimization getWriteOptimization() throws BadArgumentException{ final String writeOptimizationString = this.getOptionValue(WRITE_OPTIMIZATION.getLongOpt()); try { if (writeOptimizationString == null) { return null; } else { return WriteOptimization.valueOf(writeOptimizationString.toUpperCase()); } } catch (final IllegalArgumentException e) { throw new BadArgumentException("Error: Unknown write_optimization:" + writeOptimizationString, e); } }
Source:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; HttpServletResponse resp = (HttpServletResponse) response; String accessControlAllowHeaders = PlatformConstants.CLIENT_ID_HTTP_HEADER_NAME; String headerValues = getvalues(configuration.getAccessControlAllowHeaders()); if(!headerValues.isEmpty()){ accessControlAllowHeaders = accessControlAllowHeaders + ", " + headerValues; } String clientOrigin = req.getHeader("origin"); resp.setHeader("Access-Control-Allow-Origin", clientOrigin); resp.setHeader("Access-Control-Allow-Methods", getvalues(configuration.getAccessControlAllowMethods())); resp.setHeader("Access-Control-Allow-Headers", accessControlAllowHeaders); resp.setHeader("Access-Control-Expose-Headers", PlatformConstants.CLIENT_ID_HTTP_HEADER_NAME); resp.setHeader("Access-Control-Allow-Credentials", "" + configuration.isAccessControlAllowCredentials()); resp.setHeader("Access-Control-Max-Age", "" + configuration.getAccessControlMaxAge()); chain.doFilter(request, response); }

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; HttpServletResponse resp = (HttpServletResponse) response; String accessControlAllowHeaders = PlatformConstants.CLIENT_ID_HTTP_HEADER_NAME; String headerValues = getAsCommaSeparatedList(configuration.getAccessControlAllowHeaders()); if(!headerValues.isEmpty()){ accessControlAllowHeaders = accessControlAllowHeaders + ", " + headerValues; } String allowedMethods = getAsCommaSeparatedList(configuration.getAccessControlAllowMethods()); String clientOrigin = req.getHeader("origin"); resp.setHeader("Access-Control-Allow-Origin", clientOrigin); if(!allowedMethods.isEmpty()){ resp.setHeader("Access-Control-Allow-Methods", allowedMethods); } resp.setHeader("Access-Control-Allow-Headers", accessControlAllowHeaders); resp.setHeader("Access-Control-Expose-Headers", PlatformConstants.CLIENT_ID_HTTP_HEADER_NAME); resp.setHeader("Access-Control-Allow-Credentials", "" + configuration.isAccessControlAllowCredentials()); resp.setHeader("Access-Control-Max-Age", "" + configuration.getAccessControlMaxAge()); chain.doFilter(request, response); }
Source:
public void complete(AeshCompleteOperation co) { LOG.debugf("Completing {0}", co.getBuffer()); cliCompleter.complete(ctx, co, this); if (ctx.getConfig().isColorOutput()) { List<TerminalString> completionCandidates = co.getCompletionCandidates(); List<TerminalString> requiredCandidates = new ArrayList<>(); for (TerminalString candidate : completionCandidates) { if (candidate.toString().endsWith("*") && !"*".equals(candidate.toString())) { TerminalString newCandidate = Util.formatRequired(candidate); requiredCandidates.add(newCandidate); } } completionCandidates.removeIf(candidate -> candidate.toString().endsWith("*")); completionCandidates.addAll(requiredCandidates); } LOG.debugf("Completion candidates {0}", co.getCompletionCandidates()); }

Target:
public void complete(AeshCompleteOperation co) { LOG.debugf("Completing {0}", co.getBuffer()); cliCompleter.complete(ctx, co, this); if (ctx.isColorOutput()) { List<TerminalString> completionCandidates = co.getCompletionCandidates(); List<TerminalString> requiredCandidates = new ArrayList<>(); for (TerminalString candidate : completionCandidates) { if (candidate.toString().endsWith("*") && !"*".equals(candidate.toString())) { TerminalString newCandidate = Util.formatRequired(candidate); requiredCandidates.add(newCandidate); } } completionCandidates.removeIf(new Predicate<TerminalString>() { @Override public boolean test(TerminalString candidate) { return candidate.toString().endsWith("*"); } }); completionCandidates.addAll(requiredCandidates); } LOG.debugf("Completion candidates {0}", co.getCompletionCandidates()); }
Source:
protected Query createQuery(ConvertingParameterAccessor accessor) { String queryString = replacePlaceholders(query, accessor, queryIsAlreadyQuoted); Query query = null; if (fieldSpec != null) { String fieldString = replacePlaceholders(fieldSpec, accessor, fieldsAreAlreadyQuoted); query = new BasicQuery(queryString, fieldString); } else { query = new BasicQuery(queryString); } query.with(accessor.getSort()); if (LOG.isDebugEnabled()) { LOG.debug(String.format("Created query %s", query.getQueryObject())); } return query; }

Target:
protected Query createQuery(ConvertingParameterAccessor accessor) { String queryString = replacePlaceholders(query, accessor, queryParameterBindings); Query query = null; if (fieldSpec != null) { String fieldString = replacePlaceholders(fieldSpec, accessor, fieldSpecParameterBindings); query = new BasicQuery(queryString, fieldString); } else { query = new BasicQuery(queryString); } query.with(accessor.getSort()); if (LOG.isDebugEnabled()) { LOG.debug(String.format("Created query %s", query.getQueryObject())); } return query; }
Source:
public boolean accept(TreeWalkerAuditEvent treeWalkerAuditEvent) { final XpathFilter xpathFilter = getXpathFilter(); return xpathFilter.accept(treeWalkerAuditEvent); }

Target:
public boolean accept(TreeWalkerAuditEvent treeWalkerAuditEvent) { return xpathFilter.accept(treeWalkerAuditEvent); }
Source:
public void testNfsConnectionWithValidMountOptions() { StorageServerConnections newPosixConnection = createConnection(StorageType.NFS, "timeo=30, validoption=666"); params.setStorageServerConnection(newPosixConnection); ValidationResult result = command.validateMountOptions(); assertTrue(result.isValid()); }

Target:
public void testNfsConnectionWithValidMountOptions() { testConnectionMountOptionsValidations(StorageType.NFS, "validoption=30, anothervalidoption=666", true); }
Source:
public void test_getAlwaysShowScrollBars() { boolean defaultFlag = scrolledComposite.getAlwaysShowScrollBars(); boolean setFlag = !defaultFlag; scrolledComposite.setAlwaysShowScrollBars(setFlag); if (setFlag) assertTrue(scrolledComposite.getAlwaysShowScrollBars()); else assertFalse(scrolledComposite.getAlwaysShowScrollBars()); setFlag = !setFlag; scrolledComposite.setAlwaysShowScrollBars(setFlag); if (setFlag) assertTrue(scrolledComposite.getAlwaysShowScrollBars()); else assertFalse(scrolledComposite.getAlwaysShowScrollBars()); scrolledComposite.setAlwaysShowScrollBars(defaultFlag); }

Target:
public void test_getAlwaysShowScrollBars() { boolean defaultFlag = scrolledComposite.getAlwaysShowScrollBars(); boolean setFlag = !defaultFlag; scrolledComposite.setAlwaysShowScrollBars(setFlag); if (setFlag){ assertTrue(scrolledComposite.getAlwaysShowScrollBars()); } else{ assertFalse(scrolledComposite.getAlwaysShowScrollBars()); } setFlag = !setFlag; scrolledComposite.setAlwaysShowScrollBars(setFlag); if (setFlag){ assertTrue(scrolledComposite.getAlwaysShowScrollBars()); } else{ assertFalse(scrolledComposite.getAlwaysShowScrollBars()); } scrolledComposite.setAlwaysShowScrollBars(defaultFlag); }
Source:
public int lookupId(String name) { return name == null || "".equals(name) ? 0 : -1; }

Target:
public int lookupId(String name) { return Strings.isNullOrEmpty(name) ? 0 : -1; }
Source:
public void testStartKeepaliveWLAN() throws Exception { testConnectEvent(); waitForMs(200); DataServiceManager mMockDsm = mock(DataServiceManager.class); mDc.setDataServiceManager(mMockDsm); doReturn(TransportType.WLAN).when(mMockDsm).getTransportType(); final int sessionHandle = 0xF00; final int slotId = 3; final int interval = 10; KeepalivePacketData kd = KeepalivePacketData.nattKeepalivePacket( NetworkUtils.numericToInetAddress("1.2.3.4"), 1234, NetworkUtils.numericToInetAddress("8.8.8.8"), 4500); mDc.obtainMessage( DataConnection.EVENT_KEEPALIVE_START_REQUEST, slotId, interval, kd).sendToTarget(); waitForMs(100); verify(mSimulatedCommandsVerifier, times(0)) .startNattKeepalive(anyInt(), eq(kd), eq(interval * 1000), any(Message.class)); }

Target:
public void testStartKeepaliveWLAN() throws Exception { testConnectEvent(); waitForMs(200); DataServiceManager mockDsm = mock(DataServiceManager.class); replaceInstance(DataConnection.class, "mDataServiceManager", mDc, mockDsm); doReturn(TransportType.WLAN).when(mockDsm).getTransportType(); final int sessionHandle = 0xF00; final int slotId = 3; final int interval = 10; KeepalivePacketData kd = KeepalivePacketData.nattKeepalivePacket( NetworkUtils.numericToInetAddress("1.2.3.4"), 1234, NetworkUtils.numericToInetAddress("8.8.8.8"), 4500); mDc.obtainMessage( DataConnection.EVENT_KEEPALIVE_START_REQUEST, slotId, interval, kd).sendToTarget(); waitForMs(100); try { verify(mSimulatedCommandsVerifier, times(0)) .startNattKeepalive(anyInt(), eq(kd), eq(interval * 1000), any(Message.class)); } finally { restoreInstance(DataConnection.class, "mDataServiceManager", mDc); } }
Source:
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { TFM_Util.adminAction(sender.getName(), "Opping " + sender.getName(), false); sender.setOp(true); sender.sendMessage(TotalFreedomMod.YOU_ARE_OP); if (!TFM_AdminList.isAdminImpostor(sender_p)) { sender.sendMessage("You are a Imposter, You need to verify first"); sender.setOp(false); sender.sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP); } return true; }

Target:
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { TFM_Util.adminAction(sender.getName(), "Opping " + sender.getName(), false); sender.setOp(true); sender.sendMessage(TotalFreedomMod.YOU_ARE_OP); if (!TFM_AdminList.isAdminImpostor(sender_p)) { sender.sendMessage("You are a Imposter, You need to verify first"); sender.setOp(false); } return true; }
Source:
private void dragDetectedInAvailable(MouseEvent event) { PreviewTabViewModel previewTabViewModel = viewModel; List<PreviewLayout> selectedLayouts = new ArrayList<>(previewTabViewModel.availableSelectionModelProperty().getValue().getSelectedItems()); if (!selectedLayouts.isEmpty()) { Dragboard dragboard = startDragAndDrop(TransferMode.MOVE); previewTabViewModel.dragDetected(previewTabViewModel.availableListProperty(), selectedLayouts, dragboard); } event.consume(); }

Target:
private void dragDetectedInAvailable(MouseEvent event) { List<PreviewLayout> selectedLayouts = new ArrayList<>(viewModel.availableSelectionModelProperty().getValue().getSelectedItems()); if (!selectedLayouts.isEmpty()) { Dragboard dragboard = startDragAndDrop(TransferMode.MOVE); viewModel.dragDetected(viewModel.availableListProperty(), selectedLayouts, dragboard); } event.consume(); }
Source:
static WeekActivityDTO createInstance(WeekActivity weekActivity, LevelOfDetail levelOfDetail) { boolean includeDetail = levelOfDetail == LevelOfDetail.WeekDetail; return new WeekActivityDTO(weekActivity.getGoal().getID(), weekActivity.getStartTime(), includeIf(() -> weekActivity.getSpread(), includeDetail), includeIf(() -> weekActivity.getTotalActivityDurationMinutes(), includeDetail), weekActivity.getDayActivities().stream() .map(dayActivity -> DayActivityDTO.createInstance(dayActivity, levelOfDetail)) .collect(Collectors.toList())); }

Target:
static WeekActivityDTO createInstance(WeekActivity weekActivity, LevelOfDetail levelOfDetail) { boolean includeDetail = levelOfDetail == LevelOfDetail.WeekDetail; return new WeekActivityDTO(weekActivity.getGoal().getID(), weekActivity.getStartTime(), includeDetail ? weekActivity.getSpread() : Collections.emptyList(), includeDetail ? Optional.of(weekActivity.getTotalActivityDurationMinutes()) : Optional.empty(), weekActivity.getDayActivities().stream() .map(dayActivity -> DayActivityDTO.createInstance(dayActivity, levelOfDetail)) .collect(Collectors.toList())); }