public code v1
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>flintstones.group</groupId>
|
||||
<artifactId>flintstones.bundles</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>flintstones.method.waspas.results.ui</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
<name>[bundle] Bundle-Name</name>
|
||||
</project>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>flintstones.method.waspas.results.ui</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
<filteredResources>
|
||||
<filter>
|
||||
<id>1779484362712</id>
|
||||
<name></name>
|
||||
<type>30</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.core.resources.regexFilterMatcher</id>
|
||||
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
</filteredResources>
|
||||
</projectDescription>
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
||||
@@ -0,0 +1,9 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
|
||||
org.eclipse.jdt.core.compiler.compliance=11
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
|
||||
org.eclipse.jdt.core.compiler.release=enabled
|
||||
org.eclipse.jdt.core.compiler.source=11
|
||||
@@ -0,0 +1,4 @@
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
||||
@@ -0,0 +1,17 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %Bundle-Name
|
||||
Bundle-SymbolicName: flintstones.method.waspas.results.ui;singleton:=true
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Automatic-Module-Name: flintstones.method.waspas.results.ui
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-11
|
||||
Require-Bundle: org.eclipse.e4.core.services,
|
||||
flintstones.entity.method.phase.ui,
|
||||
javax.inject,
|
||||
flintstones.method.waspas.results,
|
||||
org.eclipse.swt,
|
||||
flintstones.helper.html,
|
||||
flintstones.model.ui.service,
|
||||
flintstones.entity.method.phase,
|
||||
flintstones.engine.R,
|
||||
flintstones.entity.problemelement
|
||||
@@ -0,0 +1,5 @@
|
||||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
plugin.xml
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension
|
||||
point="flintstones.phasemethod.ui">
|
||||
<phasemethod_ui
|
||||
implementation="flintstones.method.waspas.results.ui.WASPASResultsUI"
|
||||
phasemethod="flintstones.method.waspas.results"
|
||||
uid="flintstones.method.waspas.results.ui">
|
||||
</phasemethod_ui>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
+131
@@ -0,0 +1,131 @@
|
||||
package flintstones.method.waspas.results.ui;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.eclipse.e4.core.services.nls.Translation;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Spinner;
|
||||
import org.rosuda.JRI.REXP;
|
||||
import org.rosuda.JRI.RVector;
|
||||
import flintstones.entity.method.phase.ui.PhaseMethodUI;
|
||||
import flintstones.helper.html.table.HtmlTextTable;
|
||||
import flintstones.method.waspas.results.WASPASResults;
|
||||
import flintstones.method.waspas.results.ui.messages.Messages;
|
||||
import flintstones.model.ui.service.UiService;
|
||||
|
||||
public class WASPASResultsUI extends PhaseMethodUI {
|
||||
|
||||
@Inject
|
||||
@Translation
|
||||
Messages msg;
|
||||
|
||||
/**
|
||||
* Phase model implementation
|
||||
*/
|
||||
WASPASResults model;
|
||||
|
||||
/**
|
||||
* Value selector for lambda variable
|
||||
*/
|
||||
Spinner lambda;
|
||||
|
||||
/**
|
||||
* Results table
|
||||
*/
|
||||
HtmlTextTable results;
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
model = (WASPASResults) this.getModel();
|
||||
model.loadData();
|
||||
|
||||
Composite base = this.getBaseComposite();
|
||||
UiService.setGridData(base, 9, 9, true, true);
|
||||
UiService.setGridLayout(base, 1);
|
||||
|
||||
|
||||
Composite lambdaComposite = new Composite(base, SWT.NONE);
|
||||
UiService.setGridData(lambdaComposite, 0, -1, true, false);
|
||||
UiService.setGridLayout(lambdaComposite, 2);
|
||||
Label textLambda = new Label(lambdaComposite, SWT.NONE);
|
||||
textLambda.setText("Lambda:");
|
||||
|
||||
lambda = new Spinner(lambdaComposite, SWT.NONE);
|
||||
lambda.setDigits(3);
|
||||
lambda.setMinimum(0);
|
||||
lambda.setMaximum(1000);
|
||||
lambda.setIncrement(1);
|
||||
lambda.setSelection(0);
|
||||
|
||||
Composite tableBase = new Composite(base, SWT.NONE);
|
||||
UiService.setGridData(tableBase, 9, 9, true, true);
|
||||
UiService.setGridLayout(tableBase, 1);
|
||||
lambda.addSelectionListener(new SelectionAdapter() {
|
||||
/**
|
||||
* Executes method on lambda value change
|
||||
*/
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
createResultTable(tableBase);
|
||||
}
|
||||
});
|
||||
createResultTable(tableBase);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates method results table
|
||||
*
|
||||
* @param base Composite
|
||||
*/
|
||||
private void createResultTable(Composite base) {
|
||||
REXP rexp = model.executeR(lambda.getSelection() / Math.pow(10, lambda.getDigits()));
|
||||
|
||||
int[] alts = (int[]) ((REXP) ((RVector) rexp.getContent()).get(0)).getContent();
|
||||
String[] rHeaders = new String[alts.length];
|
||||
for (int a = 0; a < alts.length; a++) {
|
||||
rHeaders[a] = model.allAlternatives()[alts[a] - 1].getName();
|
||||
}
|
||||
// Makes table data based on R-gui result table
|
||||
String[] cHeaders = msg.headers.split(",");
|
||||
String[][] values = new String[alts.length][cHeaders.length];
|
||||
double[] wsm = (double[]) ((REXP) ((RVector) rexp.getContent()).get(1)).getContent();
|
||||
double[] wpm = (double[]) ((REXP) ((RVector) rexp.getContent()).get(2)).getContent();
|
||||
double[] w = (double[]) ((REXP) ((RVector) rexp.getContent()).get(3)).getContent();
|
||||
int[] ranks = (int[]) ((REXP) ((RVector) rexp.getContent()).get(4)).getContent();
|
||||
|
||||
for (int i = 0; i < rHeaders.length; i++) {
|
||||
values[i][0] = Double.toString(wsm[i]);
|
||||
values[i][1] = Double.toString(wpm[i]);
|
||||
values[i][2] = Double.toString(w[i]);
|
||||
values[i][3] = Integer.toString(ranks[i]);
|
||||
}
|
||||
|
||||
if (results != null) {
|
||||
results.dispose();
|
||||
}
|
||||
|
||||
results = new HtmlTextTable(base, values, cHeaders, rHeaders);
|
||||
results.render();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reloads phase view
|
||||
*/
|
||||
@Override
|
||||
public void refresh() {
|
||||
sendRefresh();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return false, last phase
|
||||
*/
|
||||
@Override
|
||||
protected boolean isForwardEnabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package flintstones.method.waspas.results.ui.messages;
|
||||
|
||||
import org.eclipse.e4.core.services.nls.Message;
|
||||
|
||||
@Message
|
||||
public class Messages {
|
||||
public String headers;
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
headers=WSM, WPM, Q, Ranking
|
||||
+1
@@ -0,0 +1 @@
|
||||
headers=WSM, WPM, Q, Clasificación
|
||||
Reference in New Issue
Block a user