auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void pageChange(int pageIndex) { super.pageChange(pageIndex); setContextClassLoader(); switch (pageIndex) { case DESIGN_VIEW_PAGE_INDEX: { String source = sourceEditor.getDocument().get(); MediatorFactoryUtils.registerFactories(); try { handleDesignViewActivatedEvent(); Display.getCurrent().asyncExec(new Runnable() { @Override public void run() { EditorUtils.setLockmode(graphicalEditor, true); final boolean dirty = isDirty(); AbstractEsbNodeDeserializer.relocateStartNodes(); AbstractEsbNodeDeserializer.resizeParentCompartments(); if (!dirty && isDirty()) { getEditor(0).doSave(new NullProgressMonitor()); firePropertyChange(PROP_DIRTY); } EditorUtils.setLockmode(graphicalEditor, false); } }); } catch (Exception e) { setActivePage(SOURCE_VIEW_PAGE_INDEX); sourceEditor.getDocument().set(source); printHandleDesignViewActivatedEventErrorMessage(e); } finally { AbstractEsbNodeDeserializer.cleanupData(); firePropertyChange(PROP_DIRTY); } break; } case SOURCE_VIEW_PAGE_INDEX: { try { updateSequenceDetails(); handleSourceViewActivatedEvent(); } catch (Exception e) { log.error("Cannot update source view", e); String simpleMessage = ExceptionMessageMapper.getNonTechnicalMessage(e.getMessage()); IStatus editorStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, simpleMessage); setActivePage(DESIGN_VIEW_PAGE_INDEX); ErrorDialog.openError(getActiveEditor().getSite().getShell(), "Error", "Cannot update source view. The following error(s) have been detected. Please see the error log for more details ", editorStatus); } break; } } }

Target:
protected void pageChange(int pageIndex) { super.pageChange(pageIndex); setContextClassLoader(); switch (pageIndex) { case DESIGN_VIEW_PAGE_INDEX: { MediatorFactoryUtils.registerFactories(); handleDesignViewActivatedEvent(); final EsbMultiPageEditor currentEditor = this; Display.getCurrent().asyncExec(new Runnable() { @Override public void run() { EditorUtils.setLockmode(graphicalEditor, true); final boolean dirty = isDirty(); AbstractEsbNodeDeserializer.relocateStartNodes(); if(!dirty && isDirty()){ getEditor(0).doSave(new NullProgressMonitor()); firePropertyChange(PROP_DIRTY); } EditorUtils.setLockmode(graphicalEditor, false); } }); break; } case SOURCE_VIEW_PAGE_INDEX: { try { updateSequenceDetails(); handleSourceViewActivatedEvent(); } catch (Exception e) { log.error("Cannot update source view", e); String simpleMessage = ExceptionMessageMapper.getNonTechnicalMessage(e.getMessage()); IStatus editorStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, simpleMessage); setActivePage(0); ErrorDialog.openError(getActiveEditor().getSite().getShell(), "Error", "Cannot update source view. The following error(s) have been detected. Please see the error log for more details ", editorStatus); } break; } } }
Source:
static public Test suite() throws IOException { MultiConfigSuiteBuilder builder = new MultiConfigSuiteBuilder(TestEmptySchema.class); VoltProjectBuilder project = getBuilderForTest(); boolean success; LocalCluster config = new LocalCluster(true, "decimal-default.jar", 2, 3, 0, BackendTarget.NATIVE_EE_JNI); success = config.compile(project); assertTrue(success); builder.addServerConfig(config); return builder; }

Target:
static public Test suite() throws IOException { MultiConfigSuiteBuilder builder = new MultiConfigSuiteBuilder(TestEmptySchema.class); VoltProjectBuilder project = getBuilderForTest(); boolean success; LocalCluster config = new LocalCluster("decimal-default.jar", 2, 1, 0, BackendTarget.NATIVE_EE_JNI); success = config.compile(project); assertTrue(success); builder.addServerConfig(config); return builder; }
Source:
public static void instantiateDriverObject() { if (!Property.REUSE_BROWSER.isSpecified()) { driver.set(new DriverSetup().instantiateDriver()); } else { driver.set(getNextAvailableDriverFromPool()); } wait.set(newDefaultWait()); }

Target:
public static void instantiateDriverObject() { if (Property.REUSE_BROWSER.isSpecified()) { driver.set(getNextAvailableDriverFromPool()); } else { driver.set(new DriverSetup().instantiateDriver()); } wait.set(newDefaultWait()); }
Source:
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { SubMonitor subMon = SubMonitor.convert(monitor, Messages.LoadTargetOperation_mainTaskName, 40); try { if (subMon.isCanceled()) { return Status.CANCEL_STATUS; } if (!fTarget.isResolved()) { fTarget.resolve(subMon.split(20)); } subMon.setWorkRemaining(20); PDEPreferencesManager preferences = PDECore.getDefault().getPreferencesManager(); ((TargetPlatformService) TargetPlatformService.getDefault()).setWorkspaceTargetDefinition(fTarget); String memento = fTarget.getHandle().getMemento(); if (fNone) { memento = ICoreConstants.NO_TARGET; } if (memento.equals(preferences.getString(ICoreConstants.WORKSPACE_TARGET_HANDLE))) { preferences.setValue(ICoreConstants.WORKSPACE_TARGET_HANDLE, ""); } preferences.setValue(ICoreConstants.WORKSPACE_TARGET_HANDLE, memento); clearDeprecatedPreferences(preferences, subMon.split(3)); loadJRE(subMon.split(3)); PDECore.getDefault().getPreferencesManager().savePluginPreferences(); resetPlatform(subMon.split(14)); } catch (OperationCanceledException e) { return Status.CANCEL_STATUS; } finally { subMon.done(); if (monitor != null) { monitor.done(); } } return Status.OK_STATUS; }

Target:
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { SubMonitor subMon = SubMonitor.convert(monitor, Messages.LoadTargetOperation_mainTaskName, 40); try { if (subMon.isCanceled()) { return Status.CANCEL_STATUS; } if (!fTarget.isResolved()) { fTarget.resolve(subMon.split(20)); } subMon.setWorkRemaining(20); PDEPreferencesManager preferences = PDECore.getDefault().getPreferencesManager(); ((TargetPlatformService) TargetPlatformService.getDefault()).setWorkspaceTargetDefinition(fTarget); String memento = fTarget.getHandle().getMemento(); if (fNone) { memento = ICoreConstants.NO_TARGET; } if (memento.equals(preferences.getString(ICoreConstants.WORKSPACE_TARGET_HANDLE))) { preferences.setValue(ICoreConstants.WORKSPACE_TARGET_HANDLE, ""); } preferences.setValue(ICoreConstants.WORKSPACE_TARGET_HANDLE, memento); clearDeprecatedPreferences(preferences, subMon.split(3)); loadJRE(subMon.split(3)); PDECore.getDefault().getPreferencesManager().savePluginPreferences(); resetPlatform(subMon.split(14)); } catch (OperationCanceledException e) { return Status.CANCEL_STATUS; } finally { if (monitor != null) { monitor.done(); } } return Status.OK_STATUS; }
Source:
public void testExpandableItemStatusAfterOpening() { SWTBotVSMEditor odesignEditor = openViewpointSpecificationModel(VSM); SWTBotTreeItem[] treeItem = odesignEditor.bot().tree().getAllItems(); assertEquals("There should be only one group node under resource node", 1, treeItem.length); SWTBotTreeItem resourceItem = treeItem[0]; assertEquals("There should be only one viewpoint node under group node", resourceItem.getItems().length); SWTBotTreeItem groupItem = resourceItem.getItems()[0]; assertEquals(errorMessage(2, 6), 6, groupItem.getItems().length); SWTBotTreeItem viewpointItem = groupItem.getItems()[0]; assertEquals(errorMessage(3, 7), 7, viewpointItem.getItems().length); SWTBotTreeItem viewpointItem2 = groupItem.getItems()[2]; assertEquals(errorMessage(3, 4), 4, viewpointItem2.getItems().length); SWTBotTreeItem entitiesDiagramItem2 = viewpointItem2.getItems()[0]; assertEquals("The level 4 node should not be expanded. It should contains only the empty node.", 1, entitiesDiagramItem2.getItems().length); SWTBotTreeItem entitiesDiagramItem = viewpointItem.getItems()[0]; assertEquals("The level 4 node should not be expanded. It should contains only the empty node.", 1, entitiesDiagramItem.getItems().length); SWTBotTreeItem expandedEntitiesDiagramItem2 = entitiesDiagramItem2.expand(); assertEquals(errorMessage(4, 2), 2, expandedEntitiesDiagramItem2.getItems().length); SWTBotTreeItem expandedEntitiesDiagramItem = entitiesDiagramItem.expand(); assertEquals(errorMessage(4, 9), 9, expandedEntitiesDiagramItem.getItems().length); }

Target:
public void testExpandableItemStatusAfterOpening() { SWTBotVSMEditor odesignEditor = openViewpointSpecificationModel(VSM); SWTBotTreeItem[] treeItem = odesignEditor.bot().tree().getAllItems(); assertEquals("There should be only one group node under resource node", 1, treeItem.length); SWTBotTreeItem resourceItem = treeItem[0]; assertEquals("There should be only one viewpoint node under group node", 1, resourceItem.getItems().length); SWTBotTreeItem groupItem = resourceItem.getItems()[0]; assertEquals(errorMessage(2, 6), 6, groupItem.getItems().length); SWTBotTreeItem viewpointItem = groupItem.getItems()[0]; assertEquals(errorMessage(3, 7), 7, viewpointItem.getItems().length); SWTBotTreeItem viewpointItem2 = groupItem.getItems()[2]; assertEquals(errorMessage(3, 4), 4, viewpointItem2.getItems().length); SWTBotTreeItem entitiesDiagramItem2 = viewpointItem2.getItems()[0]; assertEquals("The level 4 node should not be expanded. It should contains only the empty node.", 1, entitiesDiagramItem2.getItems().length); SWTBotTreeItem entitiesDiagramItem = viewpointItem.getItems()[0]; assertEquals("The level 4 node should not be expanded. It should contains only the empty node.", 1, entitiesDiagramItem.getItems().length); SWTBotTreeItem expandedEntitiesDiagramItem2 = entitiesDiagramItem2.expand(); assertEquals(errorMessage(4, 2), 2, expandedEntitiesDiagramItem2.getItems().length); SWTBotTreeItem expandedEntitiesDiagramItem = entitiesDiagramItem.expand(); assertEquals(errorMessage(4, 9), 9, expandedEntitiesDiagramItem.getItems().length); }
Source:
public IStatus downloadAndUnzip(String unzipDirectoryPath, String downloadDirectoryPath, String urlString, boolean deleteOnExit, String user, String pass, TaskModel tm, IProgressMonitor monitor) { monitor.beginTask("Configuring runtime from url " + urlString, 500); try { validateInputs(downloadDirectoryPath, unzipDirectoryPath); File downloadedFile = downloadRemoteRuntime(unzipDirectoryPath, downloadDirectoryPath, urlString, deleteOnExit, user, pass, new SubProgressMonitor(monitor, 450)); ExtractUtility extractUtil = new ExtractUtility(downloadedFile); IOverwrite ow = (IOverwrite)tm.getObject(IDownloadRuntimeWorkflowConstants.OVERWRITE); if( ow == null ) { ow = createOverwriteFileQuery(); } unzip(extractUtil, downloadedFile, unzipDirectoryPath, ow, new SubProgressMonitor(monitor, 30)); String updatedRuntimeRoot = getUpdatedUnzipPath(extractUtil, unzipDirectoryPath, new SubProgressMonitor(monitor, 10)); tm.putObject(IDownloadRuntimeWorkflowConstants.UNZIPPED_SERVER_HOME_DIRECTORY, updatedRuntimeRoot); } catch(CoreException ce) { return new Status(ce.getStatus().getSeverity(), RuntimeCoreActivator.PLUGIN_ID, "Error while retrieving runtime from "+ urlString, ce); } finally { monitor.done(); } return Status.OK_STATUS; }

Target:
public IStatus downloadAndUnzip(String unzipDirectoryPath, String downloadDirectoryPath, String urlString, boolean deleteOnExit, String user, String pass, TaskModel tm, IProgressMonitor monitor) { monitor.beginTask("Configuring runtime from url " + urlString, 500); try { validateInputs(downloadDirectoryPath, unzipDirectoryPath); File downloadedFile = downloadRemoteRuntime(unzipDirectoryPath, downloadDirectoryPath, urlString, deleteOnExit, user, pass, new SubProgressMonitor(monitor, 450)); ExtractUtility extractUtil = new ExtractUtility(downloadedFile); IOverwrite ow = (IOverwrite)tm.getObject(IDownloadRuntimeWorkflowConstants.OVERWRITE); if( ow == null ) { ow = createOverwriteFileQuery(); } unzip(extractUtil, downloadedFile, unzipDirectoryPath, ow, new SubProgressMonitor(monitor, 30)); String updatedRuntimeRoot = getUpdatedUnzipPath(extractUtil, unzipDirectoryPath, new SubProgressMonitor(monitor, 10)); tm.putObject(IDownloadRuntimeWorkflowConstants.UNZIPPED_SERVER_HOME_DIRECTORY, updatedRuntimeRoot); } catch(CoreException ce) { return new Status(ce.getStatus().getSeverity(), RuntimeCoreActivator.PLUGIN_ID, NLS.bind("Error while retrieving runtime from {0}", urlString), ce); } finally { monitor.done(); } return Status.OK_STATUS; }
Source:
public void configure(Requirement<?> requirement) { if (!(requirement instanceof PropertyConfiguration)){ throw new IllegalArgumentException("The requirement does not implement " + PropertyConfiguration.class); } boolean configurationSet = false; for (Object configuration : this.configurations) { try { log.debug("Setting property based configuration to requirement " + requirement.getClass()); PropertyBasedConfiguration config = (PropertyBasedConfiguration) configuration; setter.set(requirement, config); log.debug("Configuration successfully set"); configurationSet = true; break; } catch (RedDeerConfigurationException e) { log.error("This property based configuration (" + configuration + ") cannot be set to " + requirement.toString()); } catch (ClassCastException e) { log.error("This configuration (" + configuration + ") cannot be set to " + requirement.toString() + " " + e); } } if (!configurationSet) { throw new RedDeerConfigurationException("None of the given configurations " + "could have ben set as configuration of the requirement " + requirement.getClass().getName()); } }

Target:
public void configure(Requirement<?> requirement) { if (!(requirement instanceof PropertyConfiguration)){ throw new IllegalArgumentException("The requirement does not implement " + PropertyConfiguration.class); } boolean configurationSet = false; for (Object configuration : this.configurations) { if (PropertyBasedConfiguration.class.isAssignableFrom(configuration.getClass())) { try { log.debug("Setting property based configuration to requirement " + requirement.getClass()); PropertyBasedConfiguration config = (PropertyBasedConfiguration) configuration; if (requirement.getClass().getCanonicalName().equalsIgnoreCase(config.getRequirementClassName())) { setter.set(requirement, config); log.debug("Configuration successfully set"); configurationSet = true; break; } } catch (RedDeerConfigurationException e) { log.error("This property based configuration (" + configuration + ") cannot be set to " + requirement.toString()); } } } if (!configurationSet) { throw new RedDeerConfigurationException("None of the given configurations " + "could have ben set as configuration of the requirement " + requirement.getClass().getName()); } }
Source:
private ListenableOrderedSet<String> initSelectedItems() { return new ListenableOrderedSet<String>() { private static final long serialVersionUID = 1L; @Override public void onAdd(String item) { populateSelectedItemsString(); checkBoxes.get(item).setValue(true); } @Override public void onRemove(String item) { populateSelectedItemsString(); checkBoxes.get(item).setValue(false); } @Override public void onRemoveAll(Collection<String> items) { populateSelectedItemsString(); for (String item : items) { checkBoxes.get(item).setValue(false); } } @Override public void onRemoveAll() { Iterator<Entry<String, CheckBox>> iterator = checkBoxes.entrySet().iterator(); while (iterator.hasNext()) { Entry<String, CheckBox> mapEntry = iterator.next(); mapEntry.getValue().setValue(false); } } @Override public void onAddAll(Collection<String> items) { populateSelectedItemsString(); for (String item : items) { checkBoxes.get(item).setValue(true); } } }; }

Target:
private ObservableOrderedSet<String> initSelectedItems() { return new ObservableOrderedSet<String>() { private static final long serialVersionUID = 1L; @Override public void onAdd(String item) { updateValue(); checkBoxes.get(item).setValue(true); } @Override public void onRemove(String item) { updateValue(); checkBoxes.get(item).setValue(false); } @Override public void onRemoveAll(Collection<String> items) { updateValue(); for (String item : items) { checkBoxes.get(item).setValue(false); } } @Override public void onRemoveAll() { updateValue(); Iterator<Entry<String, CheckBox>> iterator = checkBoxes.entrySet().iterator(); while (iterator.hasNext()) { Entry<String, CheckBox> mapEntry = iterator.next(); mapEntry.getValue().setValue(false); } } @Override public void onAddAll(Collection<String> items) { updateValue(); for (String item : items) { checkBoxes.get(item).setValue(true); } } }; }
Source:
public void init() { setRetryPublisher(tracePublisher); setTypeReference(new TypeReference<java.util.List<Trace>>() { }); setProcessor(new AbstractProcessor<Trace, Void>(ProcessorType.ManyToMany) { @Override public List<Void> processManyToMany(String tenantId, List<Trace> items) throws Exception { long startTime = 0; if (perfLog.isLoggable(Level.FINEST)) { startTime = System.currentTimeMillis(); perfLog.finest("Performance: about to store trace (first id=" + items.get(0).getId() + ")"); } traceService.storeTraces(tenantId, items); if (perfLog.isLoggable(Level.FINEST)) { perfLog.finest("Performance: store trace (first id=" + items.get(0).getId() + ") duration=" + (System.currentTimeMillis() - startTime) + "ms"); } return null; } }); }

Target:
public void init() { setRetryPublisher(tracePublisher); setTypeReference(new TypeReference<java.util.List<Trace>>() { }); setProcessor(new AbstractProcessor<Trace, Void>(ProcessorType.ManyToMany) { @Override public List<Void> processManyToMany(String tenantId, List<Trace> items) throws Exception { traceService.storeTraces(tenantId, items); return null; } }); }
Source:
public void testRemoteSLDMultipleStyles() throws Exception { final URL remoteSldUrl = getClass().getResource("MultipleStyles.sld"); this.allParameters.put("SLD", remoteSldUrl.toExternalForm()); this.allParameters.put("LAYER", "cite:Ponds"); this.allParameters.put("STYLE", "Ponds"); GetLegendGraphicRequest request = requestReader.read(new GetLegendGraphicRequest(null), allParameters, allParameters); Style selectedStyle = request.getStyles().get(0); assertNotNull(selectedStyle); assertEquals("Ponds", selectedStyle.getName()); this.allParameters.put("LAYER", "cite:Lakes"); this.allParameters.put("STYLE", "Lakes"); request = requestReader.read(new GetLegendGraphicRequest(null), allParameters, allParameters); selectedStyle = request.getStyles().get(0); assertNotNull(selectedStyle); assertEquals("Lakes", selectedStyle.getName()); }

Target:
public void testRemoteSLDMultipleStyles() throws Exception { final URL remoteSldUrl = getClass().getResource("MultipleStyles.sld"); this.allParameters.put("SLD", remoteSldUrl.toExternalForm()); this.allParameters.put("LAYER", "cite:Ponds"); this.allParameters.put("STYLE", "Ponds"); GetLegendGraphicRequest request = requestReader.read(new GetLegendGraphicRequest(), allParameters, allParameters); Style selectedStyle = request.getStyles().get(0); assertNotNull(selectedStyle); assertEquals("Ponds", selectedStyle.getName()); this.allParameters.put("LAYER", "cite:Lakes"); this.allParameters.put("STYLE", "Lakes"); request = requestReader.read(new GetLegendGraphicRequest(), allParameters, allParameters); selectedStyle = request.getStyles().get(0); assertNotNull(selectedStyle); assertEquals("Lakes", selectedStyle.getName()); }
Source:
public boolean onKeyDown(int keycode, KeyEvent event) { if (keycode == KeyEvent.KEYCODE_BACK) { if (currentScreen != HomeScreenState.GALLERY) { newGallery frag = new newGallery(); getSupportFragmentManager().beginTransaction() .replace(R.id.fragment_container, frag) .commit(); currentScreen = HomeScreenState.GALLERY; keycode = 0; } else { AlertDialog.Builder alertbox = new AlertDialog.Builder(ctx); alertbox.setMessage(getString(R.string.exit_message)); alertbox.setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { finish(); System.exit(0); } }); alertbox.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); alertbox.create().show(); } } return super.onKeyDown(keycode, event); }

Target:
public boolean onKeyDown(int keycode, KeyEvent event) { if (keycode == KeyEvent.KEYCODE_BACK) { if (currentScreen != HomeScreenState.GALLERY) { newGallery frag = new newGallery(); getSupportFragmentManager().beginTransaction() .replace(R.id.fragment_container, frag) .commit(); currentScreen = HomeScreenState.GALLERY; } else { AlertDialog.Builder alertbox = new AlertDialog.Builder(ctx); alertbox.setMessage(getString(R.string.exit_message)); alertbox.setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { finish(); System.exit(0); } }); alertbox.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); alertbox.create().show(); } } return super.onKeyDown(keycode, event); }
Source:
public void findLocationByName_ShouldFindCorrectLocationByName() { mDatabase.locationRoomDAO().findLocationByName("name"); mDatabase.locationRoomDAO().findLocationByName("display") .test() .assertValue(actualLocationEntity -> Objects.equals(actualLocationEntity.getName(), "name") && Objects.equals(actualLocationEntity.getDescription(), "description") && Objects.equals(actualLocationEntity.getDisplay(), "display")); }

Target:
public void findLocationByName_ShouldFindCorrectLocationByName() { mDatabase.locationRoomDAO().addLocation(expectedLocationEntity1); mDatabase.locationRoomDAO().findLocationByName("display") .test() .assertValue(actualLocationEntity -> Objects.equals(actualLocationEntity.getName(), "name") && Objects.equals(actualLocationEntity.getDescription(), "description") && Objects.equals(actualLocationEntity.getDisplay(), "display")); }
Source:
public static Map<String, Object> virtualTableQueryToMap(VirtualTableQueryFilter queryFilter) { Map<String, Object> map = new HashMap<>(); List<Long> columnsId = queryFilter.getColumnsId(); long index = queryFilter.getIndex(); int count = queryFilter.getCount(); map.put("columnId", columnsId); map.put("index", index); map.put("count", count); return map; }

Target:
public static Map<String, Object> virtualTableQueryToMap(VirtualTableQueryFilter queryFilter) { Map<String, Object> map = new HashMap<>(); List<Long> columnsId = queryFilter.getColumnsId(); long index = queryFilter.getIndex(); int count = queryFilter.getCount(); map.put(COLUMN_ID_KEY, columnsId); map.put(TABLE_INDEX, index); map.put(TABLE_COUNT, count); return map; }
Source:
private String asYaml(Tool tool, KubernetesList list) throws DevfileRecipeFormatException { try { return Serialization.asYaml(list); } catch (KubernetesClientException e) { throw new DevfileRecipeFormatException( format( "Unable to deserialize specified local file content for tool '%s'", tool.getName())); } }

Target:
private String asYaml(Tool tool, KubernetesList list) throws DevfileRecipeFormatException { try { return Serialization.asYaml(list); } catch (KubernetesClientException e) { throw new DevfileRecipeFormatException( format( "Unable to deserialize specified local file content for tool '%s'. Error: %s", tool.getName(), e.getMessage())); } }
Source:
public QuotaDependency getQuotaDependency() { return this.quotaDependency; }

Target:
public QuotaDependency getQuotaDependency() { return quotaDependency; }
Source:
public InstanceOfExpr(final Expression expression, final ReferenceType type) { this(null, expression, type); }

Target:
public InstanceOfExpr(final Expression expression, final ReferenceType type) { this(null, expression, type, null); }
Source:
public int getLightPercentile(final int lightValue) { if (lightValue > MAX_LIGHT) return MAX_LIGHT_PERCENTILE; return this.distributionLookup.get(lightValue); }

Target:
public int getLightPercentile(final int lightValue) { if (lightValue > MAX_LIGHT) { return MAX_LIGHT_PERCENTILE; } return this.distributionLookup.get(lightValue); }
Source:
public static WebArchive createWebArchiveNoGw() { Map<String,String> replacements = new HashMap(); replacements.put("2727", String.valueOf(mediaPort)); replacements.put("8080", String.valueOf(restcommHTTPPort)); replacements.put("8090", String.valueOf(mockPort)); replacements.put("5080", String.valueOf(restcommPort)); replacements.put("5070", String.valueOf(georgePort)); replacements.put("5090", String.valueOf(bobPort)); replacements.put("5091", String.valueOf(alicePort)); replacements.put("5092", String.valueOf(mariaPort)); replacements.put("5093", String.valueOf(dimitriPort)); replacements.put("5094", String.valueOf(alicePort2)); replacements.put("5095", String.valueOf(clientWithAppPort)); replacements.put("5096", String.valueOf(fotiniPort)); replacements.put("5097", String.valueOf(bobPort)); replacements.put("5098", String.valueOf(leftyPort)); List<String> resources = new ArrayList( Arrays.asList( "dial-conference-entry.xml", "dial-fork-entry.xml", "dial-uri-entry.xml", "dial-client-entry.xml", "dial-number-entry.xml")); return WebArchiveUtil.createWebArchiveNoGw( "restcomm-delay.xml", "restcomm.script_dialTest", resources, replacements); }

Target:
public static WebArchive createWebArchiveNoGw() { reconfigurePorts(); Map<String,String> replacements = new HashMap(); replacements.put("2727", String.valueOf(mediaPort)); replacements.put("8080", String.valueOf(restcommHTTPPort)); replacements.put("8090", String.valueOf(mockPort)); replacements.put("5080", String.valueOf(restcommPort)); replacements.put("5070", String.valueOf(georgePort)); replacements.put("5090", String.valueOf(bobPort)); replacements.put("5091", String.valueOf(alicePort)); replacements.put("5092", String.valueOf(mariaPort)); replacements.put("5093", String.valueOf(dimitriPort)); replacements.put("5094", String.valueOf(alicePort2)); replacements.put("5095", String.valueOf(clientWithAppPort)); replacements.put("5096", String.valueOf(fotiniPort)); replacements.put("5097", String.valueOf(bobPort)); replacements.put("5098", String.valueOf(leftyPort)); List<String> resources = new ArrayList( Arrays.asList( "dial-conference-entry.xml", "dial-fork-entry.xml", "dial-uri-entry.xml", "dial-client-entry.xml", "dial-number-entry.xml")); return WebArchiveUtil.createWebArchiveNoGw( "restcomm-delay.xml", "restcomm.script_dialTest", resources, replacements); }
Source:
public VersionRangeType get(String feature) { return all().get(feature); }

Target:
public VersionRangeType get(String feature) { return features.get(feature); }
Source:
public Void call(ApiCaller ac, Deserializer parms) throws PerunException { ac.getGroupsManager().forceGroupStructureSynchronization(ac.getSession(), ac.getGroupById(parms.readInt("group"))); return null; }

Target:
public Group call(ApiCaller ac, Deserializer parms) throws PerunException { ac.stateChangingCheck(); if (parms.contains("group")) { if (parms.contains("parentGroup")) { return ac.getGroupsManager().createGroup(ac.getSession(), ac.getGroupById(parms.readInt("parentGroup")), parms.read("group", Group.class)); } else if (parms.contains("vo")) { Group group = parms.read("group", Group.class); if (group.getParentGroupId() == null) { return ac.getGroupsManager().createGroup(ac.getSession(), ac.getVoById(parms.readInt("vo")), group); } else { throw new RpcException(RpcException.Type.WRONG_PARAMETER, "Top-level groups can't have parentGroupId set!"); } } else { throw new RpcException(RpcException.Type.MISSING_VALUE, "vo or parentGroup"); } } else if (parms.contains("name") && parms.contains("description")) { if (parms.contains("parentGroup")) { String name = parms.readString("name"); String description = parms.readString("description"); Group group = new Group(name, description); return ac.getGroupsManager().createGroup(ac.getSession(), ac.getGroupById(parms.readInt("parentGroup")), group); } else if (parms.contains("vo")) { String name = parms.readString("name"); String description = parms.readString("description"); Group group = new Group(name, description); return ac.getGroupsManager().createGroup(ac.getSession(), ac.getVoById(parms.readInt("vo")), group); } else { throw new RpcException(RpcException.Type.MISSING_VALUE, "vo or parentGroup"); } } else { throw new RpcException(RpcException.Type.MISSING_VALUE, "group or (name and description)"); } }
Source:
public String getColumnText(Object element, XViewerColumn column, int columnIndex) { try { if (element instanceof Artifact) { Artifact refArt = ((Artifact) element).getSoleAttributeValue(AtsAttributeTypes.TaskToChangedArtifactReference, null); if (refArt != null) { Branch refBranch = refArt.getFullBranch(); if (refBranch.getBranchState().equals( BranchState.COMMITTED) || refBranch.getBranchType().isBaselineBranch()) { return "Commited"; } else if (refArt.isDeleted()) { return "Deleted"; } else if (refArt.getLastModified().after(((Artifact) element).getLastModified())) { return refArt.getLastModified().toString(); } else { return "Unmodified"; } } } } catch (OseeCoreException ex) { return LogUtil.getCellExceptionString(ex); } return ""; }

Target:
public String getColumnText(Object element, XViewerColumn column, int columnIndex) { try { if (element instanceof Artifact) { Artifact refArt = ((Artifact) element).getSoleAttributeValue(AtsAttributeTypes.TaskToChangedArtifactReference, null); if (refArt != null) { Branch refBranch = refArt.getFullBranch(); if (refArt.isDeleted()) { return "Deleted"; } else if (refBranch.getBranchState().equals( BranchState.COMMITTED) || refBranch.getBranchType().isBaselineBranch()) { return "Commited"; } else if (refArt.getLastModified().after(((Artifact) element).getLastModified())) { return refArt.getLastModified().toString(); } else { return "Unmodified"; } } } } catch (OseeCoreException ex) { return LogUtil.getCellExceptionString(ex); } return ""; }
Source:
public void writeBytes(Binary v) { int i = 0; byte[] vb = v.getBytesUnsafe(); int length = previous.length < vb.length ? previous.length : vb.length; for(i = 0; (i < length) && (previous[i] == vb[i]); i++); prefixLengthWriter.writeInteger(i); suffixWriter.writeBytes(Binary.fromUnmodifiedByteArray(vb, i, vb.length - i)); previous = vb; }

Target:
public void writeBytes(Binary v) { int i = 0; byte[] vb = v.getBytes(); int length = previous.length < vb.length ? previous.length : vb.length; for(i = 0; (i < length) && (previous[i] == vb[i]); i++); prefixLengthWriter.writeInteger(i); suffixWriter.writeBytes(v.slice(i, vb.length - i)); previous = vb; }
Source:
public void testIsAdHocAutostart_false() throws Exception { String id = UUID.randomUUID().toString(); AdHocSubProcess adHocSubProcess = bpmn2.createAdHocSubProcess(); adHocSubProcess.setId(id); CustomElement.autoStart.of(adHocSubProcess).set(Boolean.FALSE); tested = new AdHocSubProcessPropertyReader(adHocSubProcess, definitionResolverReal.getDiagram(), definitionResolverReal); assertFalse(tested.isAdHocAutostart()); }

Target:
public void testIsAdHocAutostart_false() { String id = UUID.randomUUID().toString(); AdHocSubProcess adHocSubProcess = bpmn2.createAdHocSubProcess(); adHocSubProcess.setId(id); CustomElement.autoStart.of(adHocSubProcess).set(Boolean.FALSE); tested = new AdHocSubProcessPropertyReader(adHocSubProcess, definitionResolverReal.getDiagram(), definitionResolverReal); assertFalse(tested.isAdHocAutostart()); }
Source:
protected void executeCommand() { VDSGroup vdsGroup = getVdsGroup(); boolean initSucceeded = true; getVds().setPowerManagementControlledByPolicy(true); DbFacade.getInstance().getVdsDynamicDao().update(getVds().getDynamicData()); if (vdsGroup.supportsTrustedService()) { initSucceeded = initTrustedService(); } if (initSucceeded && vdsGroup.supportsVirtService()) { initSucceeded = initVirtResources(); } if (initSucceeded && vdsGroup.supportsGlusterService()) { initSucceeded = initGlusterHost(); } setSucceeded(initSucceeded); }

Target:
protected void executeCommand() { VDSGroup vdsGroup = getVdsGroup(); boolean initSucceeded = true; getVds().setPowerManagementControlledByPolicy(true); DbFacade.getInstance().getVdsDynamicDao().updateVdsDynamicPowerManagementPolicyFlag( getVds().getId(), getVds().isPowerManagementControlledByPolicy()); if (vdsGroup.supportsTrustedService()) { initSucceeded = initTrustedService(); } if (initSucceeded && vdsGroup.supportsVirtService()) { initSucceeded = initVirtResources(); } if (initSucceeded && vdsGroup.supportsGlusterService()) { initSucceeded = initGlusterHost(); } setSucceeded(initSucceeded); }
Source:
public void buildDependencyGraph(AbstractProject owner, DependencyGraph graph) { if (!canDeclare(owner)) return; for (BuildTriggerConfig config : configs) { List<AbstractProject> projectList = config.getProjectList(owner.getParent(), null); for (AbstractProject project : projectList) { if (config.triggerFromChildProjects() && owner instanceof ItemGroup) { ItemGroup parent = (ItemGroup) owner; for (AbstractProject child : (Collection<AbstractProject>)parent.getItems()) { ParameterizedDependency.add(child, project, config, graph); } } else{ ParameterizedDependency.add(owner, project, config, graph); } } } }

Target:
public void buildDependencyGraph(AbstractProject owner, DependencyGraph graph) { if (!canDeclare(owner)) return; for (BuildTriggerConfig config : configs) { List<AbstractProject> projectList = config.getProjectList(owner.getParent(), null); for (AbstractProject project : projectList) { if (config.isTriggerFromChildProjects() && owner instanceof ItemGroup) { ItemGroup<Item> parent = (ItemGroup) owner; for (Item item : parent.getItems()) { if(item instanceof AbstractProject){ AbstractProject child = (AbstractProject) item; ParameterizedDependency.add(child, project, config, graph); } } } else{ ParameterizedDependency.add(owner, project, config, graph); } } } }
Source:
public static String validateFileName(String fileName) throws IllegalArgumentException{ if (!isSet(fileName) || REGEX_FILENAME_INVALID_CHARS.matcher(fileName).matches()) { throw new IllegalArgumentException("Invalid Filename passed in: " + fileName); } else { return fileName; } }

Target:
public static String validateFileName(String fileName) throws IllegalArgumentException{ if (!isSet(fileName) || REGEX_FILENAME_INVALID_CHARS.matcher(fileName).find()) { throw new IllegalArgumentException("Invalid Filename passed in: " + fileName); } else { return fileName; } }
Source:
protected CompletionStage<Collection<M>> handleMessageAsync(M message, MessageCollector collector, TaskCoordinator coordinator) { Object key, value; if (outputStream.isKeyed()) { key = ((KV) message).getKey(); value = ((KV) message).getValue(); } else { key = null; value = message; } collector.send(new OutgoingMessageEnvelope(systemStream, null, key, value)); return CompletableFuture.completedFuture(new ArrayList<M>(Arrays.asList(message))); }

Target:
protected CompletionStage<Collection<M>> handleMessageAsync(M message, MessageCollector collector, TaskCoordinator coordinator) { Object key, value; if (outputStream.isKeyed()) { key = ((KV) message).getKey(); value = ((KV) message).getValue(); } else { key = null; value = message; } collector.send(new OutgoingMessageEnvelope(systemStream, null, key, value)); return CompletableFuture.completedFuture(Collections.singleton(message)); }
Source:
public Table getTable(TableName tableName) throws HiveException { return tableName.getDb() == null ? this.getTable(tableName.getTable(), true) : this .getTable(tableName.getDb(), tableName.getTable(), true); }

Target:
public Table getTable(TableName tableName) throws HiveException { return this.getTable(ObjectUtils.firstNonNull(tableName.getDb(), SessionState.get().getCurrentDatabase()), tableName.getTable(), true); }
Source:
public void setValues() { overwriteAllowProperty.setValue(!initialBibtexKeyPatternPreferences.avoidOverwritingCiteKey()); overwriteWarningProperty.setValue(initialBibtexKeyPatternPreferences.isWarningBeforeOverwrite()); generateOnSaveProperty.setValue(initialBibtexKeyPatternPreferences.isGenerateKeysBeforeSaving()); if (initialBibtexKeyPatternPreferences.getKeyLetters() == BibtexKeyPatternPreferences.KeyLetters.ALWAYS) { letterAlwaysAddProperty.setValue(true); letterStartAProperty.setValue(false); letterStartBProperty.setValue(false); } else if (initialBibtexKeyPatternPreferences.getKeyLetters() == BibtexKeyPatternPreferences.KeyLetters.SECOND_WITH_A) { letterAlwaysAddProperty.setValue(false); letterStartAProperty.setValue(true); letterStartBProperty.setValue(false); } else { letterAlwaysAddProperty.setValue(false); letterStartAProperty.setValue(false); letterStartBProperty.setValue(true); } keyPatternRegexProperty.setValue(initialBibtexKeyPatternPreferences.getKeyPatternRegex()); keyPatternReplacementProperty.setValue(initialBibtexKeyPatternPreferences.getKeyPatternReplacement()); unwantedCharactersProperty.setValue(initialBibtexKeyPatternPreferences.getUnwantedCharacters()); }

Target:
public void setValues() { overwriteAllowProperty.setValue(!initialBibtexKeyPatternPreferences.shouldAvoidOverwriteCiteKey()); overwriteWarningProperty.setValue(initialBibtexKeyPatternPreferences.shouldWarnBeforeOverwriteCiteKey()); generateOnSaveProperty.setValue(initialBibtexKeyPatternPreferences.shouldGenerateCiteKeysBeforeSaving()); if (initialBibtexKeyPatternPreferences.getKeySuffix() == BibtexKeyPatternPreferences.KeySuffix.ALWAYS) { letterAlwaysAddProperty.setValue(true); letterStartAProperty.setValue(false); letterStartBProperty.setValue(false); } else if (initialBibtexKeyPatternPreferences.getKeySuffix() == BibtexKeyPatternPreferences.KeySuffix.SECOND_WITH_A) { letterAlwaysAddProperty.setValue(false); letterStartAProperty.setValue(true); letterStartBProperty.setValue(false); } else { letterAlwaysAddProperty.setValue(false); letterStartAProperty.setValue(false); letterStartBProperty.setValue(true); } keyPatternRegexProperty.setValue(initialBibtexKeyPatternPreferences.getKeyPatternRegex()); keyPatternReplacementProperty.setValue(initialBibtexKeyPatternPreferences.getKeyPatternReplacement()); unwantedCharactersProperty.setValue(initialBibtexKeyPatternPreferences.getUnwantedCharacters()); }
Source:
public static Optional<Duration> parseDuration(String stringAsDuration) throws Exception { if (stringAsDuration != null && stringAsDuration.length() > 0) { final String[] parts = stringAsDuration.split(":"); if (parts.length > 3) { throw new Exception("Wrong format: " + stringAsDuration); } int seconds = 0; if (parts.length == 3) { seconds += 60 * 60 * Integer.parseInt(parts[0]); seconds += 60 * Integer.parseInt(parts[1]); seconds += Integer.parseInt(parts[2]); } if (parts.length == 2) { seconds += 60 * Integer.parseInt(parts[0]); seconds += Integer.parseInt(parts[1]); } if (parts.length == 1) { seconds += Integer.parseInt(parts[0]); } return Optional.of(Duration.ofSeconds(seconds)); } else { return Optional.empty(); } }

Target:
public static Optional<Duration> parseDuration(String stringAsDuration) throws Exception { if (stringAsDuration != null && stringAsDuration.length() > 0) { final Date date = applyFormats(stringAsDuration, new SimpleDateFormat("HH:mm:ss"), new SimpleDateFormat("mm:ss"), new SimpleDateFormat("ss")); return Optional.of(Duration.ofMillis(date.getTime())); } else { return Optional.empty(); } }
Source:
public void shouldDropUnselectedLabelIndexes() throws Exception { GraphDatabaseService db = db( LabelIndex.NATIVE ); Node nodeA = createNode( db ); assertNodes( db, nodeA ); db.shutdown(); db = db( LabelIndex.LUCENE ); Node nodeB = createNode( db ); assertNodes( db, nodeA, nodeB ); db.shutdown(); db = db( LabelIndex.NATIVE ); Node nodeC = createNode( db ); assertNodes( db, nodeA, nodeB, nodeC ); db.shutdown(); }

Target:
public void shouldDropUnselectedLabelIndexes() throws Exception { LabelIndex[] types = LabelIndex.values(); Set<Node> expectedNodes = new HashSet<>(); for ( int i = 0; i < 5; i++ ) { GraphDatabaseService db = db( random.among( types ) ); Node node = createNode( db ); expectedNodes.add( node ); assertNodes( db, expectedNodes ); db.shutdown(); } }
Source:
protected boolean canDoAction() { if (getVds() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_HOST_NOT_EXIST); } if (!isValidVdsStatus()) { addCanDoActionMessage(VdcBllMessages.VAR__HOST_STATUS__UP_MAINTENANCE_OR_NON_OPERATIONAL); addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VDS_STATUS_ILLEGAL); return false; } return true; }

Target:
protected boolean canDoAction() { if (!(validate(hostExists()) && validate(hostStatusValid()))){ return false; } return true; }
Source:
public List<String> getBuildCauses() { return new ArrayList<String>(causes); }

Target:
public List<String> getBuildCauses() { return new ArrayList<>(causes); }
Source:
private int checkSourceAddress() { for (InetAddress address : mNai.linkProperties.getAllAddresses()) { if (address.equals(mPacket.srcAddress)) { return SUCCESS; } } return ERROR_INVALID_IP_ADDRESS; }

Target:
private int checkSourceAddress() { for (InetAddress address : mNai.linkProperties.getAddresses()) { if (address.equals(mPacket.srcAddress)) { return SUCCESS; } } return ERROR_INVALID_IP_ADDRESS; }
Source:
default Constraint binPacking(IntVar[] itemBin, int[] itemSize, IntVar[] binLoad, int offset) { if (itemBin.length != itemSize.length) { throw new SolverException("itemBin and itemSize arrays should have same size"); } Model model = itemBin[0].getModel(); int sum = 0; for (int i = 0; i<itemSize.length; i++) { sum += itemSize[i]; } int maxCapa = binLoad[0].getUB(); for(int j = 1; j<binLoad.length; j++) { maxCapa = Math.max(maxCapa, binLoad[j].getUB()); } List<IntVar> list = new ArrayList<>(itemBin.length); for(int i = 0; i<itemBin.length; i++) { if(itemSize[i] > (int) Math.ceil(1.0*maxCapa/2)) { list.add(itemBin[i]); } } Constraint diffConstraint; if(list.size() > 2) { diffConstraint = model.allDifferent(list.toArray(new IntVar[0])); } else if(list.size() == 2) { diffConstraint = model.arithm(list.get(0), "!=", list.get(1)); } else { diffConstraint = model.trueConstraint(); } return Constraint.merge( ConstraintsName.BINPACKING, new Constraint(ConstraintsName.BINPACKING, new PropBinPacking(itemBin, itemSize, binLoad, offset)), model.sum(binLoad, "=", sum), diffConstraint ); }

Target:
default Constraint binPacking(IntVar[] itemBin, int[] itemSize, IntVar[] binLoad, int offset) { if (itemBin.length != itemSize.length) { throw new SolverException("itemBin and itemSize arrays should have same size"); } Model model = itemBin[0].getModel(); int sum = 0; for (int i = 0; i<itemSize.length; i++) { sum += itemSize[i]; } int maxCapa = binLoad[0].getUB(); for(int j = 1; j<binLoad.length; j++) { maxCapa = Math.max(maxCapa, binLoad[j].getUB()); } int thresholdCapa = (int) Math.ceil(1.0*maxCapa/2); List<IntVar> list = new ArrayList<>(itemBin.length); for(int i = 0; i<itemBin.length; i++) { if(itemSize[i] > thresholdCapa) { list.add(itemBin[i]); } } return Constraint.merge( ConstraintsName.BINPACKING, new Constraint(ConstraintsName.BINPACKING, new PropBinPacking(itemBin, itemSize, binLoad, offset)), model.sum(binLoad, "=", sum), model.allDifferent(list.toArray(new IntVar[0])) ); }
Source:
public Credentials convert(String source) { String data[] = source.split(","); return new Credentials(data[0], data[1]); }

Target:
public Credentials convert(String source) { String[] data = source.split(","); return new Credentials(data[0], data[1]); }
Source:
private Object[] executeAggregateExp(PageContext pc, SQL sql, Query source, Expression exp, boolean includeNull, boolean returnDistinct) throws PageException { Object[] result = new Object[source.getRecordcount()]; if (exp instanceof Value) { Object value = ((Value) exp).getValue(); for (int i = 0; i < source.getRecordcount(); i++) { result[i] = value; } return result; } if (exp instanceof Column) { result = ((QueryColumnImpl) source.getColumn(((Column) exp).getColumn())).toArray(); if (!returnDistinct && includeNull) { return result; } else { Stream<Object> resultStream = Arrays.stream(result); if (!includeNull) resultStream = resultStream.filter(s -> (s != null)); if (returnDistinct) resultStream = resultStream.distinct(); return resultStream.toArray(Object[]::new); } } if (exp instanceof Operation) { for (int i = 0; i < source.getRecordcount(); i++) { result[i] = executeOperation(pc, sql, source, (Operation) exp, i + 1); } if (!returnDistinct && includeNull) { return result; } else { Stream<Object> resultStream = Arrays.stream(result); if (!includeNull) resultStream = resultStream.filter(s -> (s != null)); if (returnDistinct) resultStream = resultStream.distinct(); return resultStream.toArray(Object[]::new); } } throw new DatabaseException("unsupported sql statement [" + exp + "]", null, sql, null); }

Target:
private Object[] executeAggregateExp(PageContext pc, SQL sql, Query source, Expression exp, boolean includeNull, boolean returnDistinct) throws PageException { Object[] result = new Object[source.getRecordcount()]; if (exp instanceof Value) { Object value = ((Value) exp).getValue(); for (int i = 0; i < source.getRecordcount(); i++) { result[i] = value; } return result; } if (exp instanceof Column) { result = ((QueryColumnImpl) source.getColumn(((Column) exp).getColumn())).toArray(); if (!returnDistinct && includeNull) { return result; } else { Stream<Object> resultStream = Arrays.stream(result); if (!includeNull) resultStream = resultStream.filter(s -> (s != null)); if (returnDistinct) resultStream = resultStream.distinct(); return resultStream.toArray(); } } if (exp instanceof Operation) { for (int i = 0; i < source.getRecordcount(); i++) { result[i] = executeOperation(pc, sql, source, (Operation) exp, i + 1); } if (!returnDistinct && includeNull) { return result; } else { Stream<Object> resultStream = Arrays.stream(result); if (!includeNull) resultStream = resultStream.filter(s -> (s != null)); if (returnDistinct) resultStream = resultStream.distinct(); return resultStream.toArray(); } } throw new DatabaseException("unsupported sql statement [" + exp + "]", null, sql, null); }
Source:
public DiscoveryResult createResult(ServiceInfo service) { ThingUID uid = getThingUID(service); Map<String, Object> properties = new HashMap<>(2); properties.put(DigitalSTROMBindingConstants.HOST, hostAdress); properties.put(DigitalSTROMBindingConstants.DS_ID, dsid); if (uid != null) { return DiscoveryResultBuilder.create(uid).withProperties(properties).withLabel("DigitalSTROM-Server") .build(); } return null; }

Target:
public DiscoveryResult createResult(ServiceInfo service) { if (service.getApplication().contains("dssweb")) { ThingUID uid = getThingUID(service); if (uid != null) { String hostAddress = service.getName() + "." + service.getDomain() + "."; Map<String, Object> properties = new HashMap<>(2); properties.put(DigitalSTROMBindingConstants.HOST, hostAddress); properties.put(DigitalSTROMBindingConstants.DS_ID, uid.getId()); return DiscoveryResultBuilder.create(uid).withProperties(properties) .withRepresentationProperty(uid.getId()).withLabel("digitalSTROM-Server").build(); } } return null; }
Source:
public static Matrix4f parseMatrix(JsonElement e) { if (!e.isJsonArray()) throw new JsonParseException("Matrix: expected an array, got: " + e); JsonArray m = e.getAsJsonArray(); if (m.size() != 3) throw new JsonParseException("Matrix: expected an array of length 3, got: " + m.size()); Matrix4f ret = new Matrix4f(); for (int i = 0; i < 3; i++) { if (!m.get(i).isJsonArray()) throw new JsonParseException("Matrix row: expected an array, got: " + m.get(i)); JsonArray r = m.get(i).getAsJsonArray(); if (r.size() != 4) throw new JsonParseException("Matrix row: expected an array of length 4, got: " + r.size()); for (int j = 0; j < 4; j++) { try { ret.setElement(i, j, r.get(i).getAsNumber().floatValue()); } catch (ClassCastException ex) { throw new JsonParseException("Matrix element: expected number, got: " + r.get(i)); } } } return ret; }

Target:
public static Matrix4f parseMatrix(JsonElement e) { if (!e.isJsonArray()) throw new JsonParseException("Matrix: expected an array, got: " + e); JsonArray m = e.getAsJsonArray(); if (m.size() != 3) throw new JsonParseException("Matrix: expected an array of length 3, got: " + m.size()); Matrix4f ret = new Matrix4f(); for (int i = 0; i < 3; i++) { if (!m.get(i).isJsonArray()) throw new JsonParseException("Matrix row: expected an array, got: " + m.get(i)); JsonArray r = m.get(i).getAsJsonArray(); if (r.size() != 4) throw new JsonParseException("Matrix row: expected an array of length 4, got: " + r.size()); for (int j = 0; j < 4; j++) { try { ret.setElement(i, j, r.get(j).getAsNumber().floatValue()); } catch (ClassCastException ex) { throw new JsonParseException("Matrix element: expected number, got: " + r.get(j)); } } } return ret; }