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.vikorFuzzy.phase.result.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.vikorFuzzy.phase.result.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>1779484362710</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
|
||||
+9
@@ -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
|
||||
+4
@@ -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.vikorFuzzy.phase.result.ui;singleton:=true
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Automatic-Module-Name: flintstones.method.vikorFuzzy.phase.result.ui
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-11
|
||||
Require-Bundle: flintstones.entity.method.phase.ui,
|
||||
flintstones.method.vikorFuzzy.phase.result,
|
||||
flintstones.entity.method.phase,
|
||||
org.eclipse.swt,
|
||||
flintstones.model.ui.service,
|
||||
flintstones.helper.html,
|
||||
flintstones.entity.problemelement,
|
||||
flintstones.domain.fuzzyset,
|
||||
javax.inject,
|
||||
org.eclipse.e4.core.services
|
||||
@@ -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.vikorFuzzy.phase.result.ui.FuzzyVikorResultUI"
|
||||
phasemethod="flintstones.method.vikorFuzzy.phase.result"
|
||||
uid="flintstones.method.vikorFuzzy.phase.result.ui">
|
||||
</phasemethod_ui>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
+397
@@ -0,0 +1,397 @@
|
||||
package flintstones.method.vikorFuzzy.phase.result.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.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Spinner;
|
||||
|
||||
import flintstones.domain.fuzzyset.function.types.TrapezoidalFunction;
|
||||
import flintstones.entity.method.phase.ui.PhaseMethodUI;
|
||||
import flintstones.helper.html.table.HtmlTextTable;
|
||||
import flintstones.method.vikorFuzzy.phase.result.FuzzyVikorResult;
|
||||
import flintstones.method.vikorFuzzy.phase.result.ui.messages.Messages;
|
||||
import flintstones.model.ui.service.UiService;
|
||||
|
||||
/**
|
||||
* Interface for results
|
||||
*
|
||||
* @author jcfp
|
||||
*
|
||||
*/
|
||||
public class FuzzyVikorResultUI extends PhaseMethodUI {
|
||||
|
||||
FuzzyVikorResult model;
|
||||
|
||||
@Inject
|
||||
@Translation
|
||||
Messages msg;
|
||||
|
||||
/**
|
||||
* Initial data table composite
|
||||
*/
|
||||
Composite initialTableSub;
|
||||
|
||||
/**
|
||||
* Normalized difference table composite
|
||||
*/
|
||||
Composite difTableSub;
|
||||
|
||||
/**
|
||||
* Crisp method values table composite
|
||||
*/
|
||||
Composite crispTableSub;
|
||||
|
||||
/**
|
||||
* Method values table composite
|
||||
*/
|
||||
Composite valueTableSub;
|
||||
|
||||
/**
|
||||
* Main ranking table composite
|
||||
*/
|
||||
Composite rankingTableSub;
|
||||
|
||||
/**
|
||||
* Proposed solutions table composite
|
||||
*/
|
||||
Composite resultTableSub;
|
||||
|
||||
/**
|
||||
* Inital data table
|
||||
*/
|
||||
HtmlTextTable initialTable;
|
||||
|
||||
/**
|
||||
* Normalized difference table
|
||||
*/
|
||||
HtmlTextTable difTable;
|
||||
|
||||
/**
|
||||
* Crisp method values table
|
||||
*/
|
||||
HtmlTextTable crispTable;
|
||||
|
||||
/**
|
||||
* Method values table
|
||||
*/
|
||||
HtmlTextTable valuesTable;
|
||||
|
||||
/**
|
||||
* Main ranking table
|
||||
*/
|
||||
HtmlTextTable rankingTable;
|
||||
|
||||
/**
|
||||
* Proposed solutions table
|
||||
*/
|
||||
HtmlTextTable resultTable;
|
||||
|
||||
/**
|
||||
* Init interface
|
||||
*/
|
||||
@Override
|
||||
public void init() {
|
||||
model = (FuzzyVikorResult) this.getModel();
|
||||
model.loadData();
|
||||
|
||||
// <-------COMPOSITE INIT------->
|
||||
Composite base = this.getBaseComposite();
|
||||
UiService.setGridDataAuto(base);
|
||||
UiService.setGridLayout(base, 2);
|
||||
|
||||
Composite supIzq = new Composite(base, SWT.BORDER);
|
||||
UiService.setGridData(supIzq, 9, 9, true, true);
|
||||
UiService.setGridLayout(supIzq, 1);
|
||||
Composite supDer = new Composite(base, SWT.BORDER);
|
||||
UiService.setGridData(supDer, 9, 9, true, true);
|
||||
UiService.setGridLayout(supDer, 1);
|
||||
Composite infIzq = new Composite(base, SWT.NONE);
|
||||
UiService.setGridData(infIzq, 9, 9, true, true);
|
||||
UiService.setGridLayout(infIzq, 1);
|
||||
Composite infDer = new Composite(base, SWT.NONE);
|
||||
UiService.setGridData(infDer, 9, 9, true, true);
|
||||
UiService.setGridLayout(infDer, 1);
|
||||
|
||||
initialTableSub = new Composite(supIzq, SWT.NONE);
|
||||
UiService.setGridData(initialTableSub, 9, 9, true, true);
|
||||
UiService.setGridLayout(initialTableSub, 1);
|
||||
|
||||
// <--------UI CONTROLLERS INIT-------->
|
||||
Composite vBase = new Composite(supIzq, SWT.NONE);
|
||||
UiService.setGridData(vBase, 9, 9, true, false);
|
||||
UiService.setGridLayout(vBase, 3);
|
||||
Label vLabel = new Label(vBase, SWT.NONE);
|
||||
vLabel.setText(msg.v_selector + ": ");
|
||||
Spinner vSelector = new Spinner(vBase, SWT.NONE);
|
||||
vSelector.setValues(0, 0, 1000, 3, 1, 1);
|
||||
vSelector.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
super.widgetSelected(e);
|
||||
String value = vSelector.getText();
|
||||
value = value.replace(",", ".");
|
||||
model.setVValue(Double.parseDouble(value));
|
||||
}
|
||||
});
|
||||
Button btnCalculate = new Button(vBase, SWT.NONE);
|
||||
btnCalculate.setText(msg.calculate_button);
|
||||
btnCalculate.addSelectionListener(new SelectionAdapter() {
|
||||
/**
|
||||
* Al pulsar, recalcula los rankings
|
||||
*/
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
super.widgetSelected(e);
|
||||
model.calculateSRQ();
|
||||
model.computeRankings();
|
||||
createAll(model.calculateSolution());
|
||||
}
|
||||
});
|
||||
|
||||
Label difLabel = new Label(supIzq, SWT.NONE);
|
||||
difLabel.setText(msg.dif_title);
|
||||
// <--------TABLE INITS-------->
|
||||
difTableSub = new Composite(supIzq, SWT.NONE);
|
||||
UiService.setGridData(difTableSub, 9, 9, true, true);
|
||||
UiService.setGridLayout(difTableSub, 1);
|
||||
|
||||
Label crispLabel = new Label(supDer, SWT.NONE);
|
||||
crispLabel.setText(msg.crisp_title);
|
||||
crispTableSub = new Composite(supDer, SWT.NONE);
|
||||
UiService.setGridData(crispTableSub, 9, 9, true, true);
|
||||
UiService.setGridLayout(crispTableSub, 1);
|
||||
|
||||
Label valLabel = new Label(supDer, SWT.NONE);
|
||||
valLabel.setText(msg.values_title);
|
||||
valueTableSub = new Composite(supDer, SWT.NONE);
|
||||
UiService.setGridData(valueTableSub, 9, 9, true, true);
|
||||
UiService.setGridLayout(valueTableSub, 1);
|
||||
|
||||
Label rankLabel = new Label(infIzq, SWT.NONE);
|
||||
rankLabel.setText(msg.rank_title);
|
||||
rankingTableSub = new Composite(infIzq, SWT.NONE);
|
||||
UiService.setGridData(rankingTableSub, 9, 9, true, true);
|
||||
UiService.setGridLayout(rankingTableSub, 1);
|
||||
|
||||
Label resultLabel = new Label(infDer, SWT.NONE);
|
||||
resultLabel.setText(msg.result_title);
|
||||
resultTableSub = new Composite(infDer, SWT.NONE);
|
||||
UiService.setGridData(resultTableSub, 9, 9, true, true);
|
||||
UiService.setGridLayout(resultTableSub, 1);
|
||||
|
||||
model.calculateBestWorst();
|
||||
model.calculateDifference();
|
||||
createInitialTable(initialTableSub);
|
||||
createDifferenceTable(difTableSub);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Makes, or refresh all tables
|
||||
*
|
||||
* @param last Last proposed alternative
|
||||
*/
|
||||
private void createAll(int last) {
|
||||
createCrispTable(crispTableSub);
|
||||
createValuesTable(valueTableSub);
|
||||
createRankingTable(rankingTableSub);
|
||||
createResultTable(resultTableSub, last);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Makes results table
|
||||
*
|
||||
* @param base Table composite
|
||||
* @param last Last proposed alternative
|
||||
*/
|
||||
private void createResultTable(Composite base, int last) {
|
||||
String[] data;
|
||||
|
||||
if(last == -1) {
|
||||
data = new String[1];
|
||||
data[0] = msg.all_alt_tag;
|
||||
}else {
|
||||
data = new String[last + 1];
|
||||
for(int i = 0; i <= last; i++) {
|
||||
data[i] = model.getAlternatives()[model.rankCrispQ.get(i)].getName();
|
||||
}
|
||||
}
|
||||
|
||||
if (resultTable == null)
|
||||
resultTable = new HtmlTextTable(base, data, true);
|
||||
else {
|
||||
resultTable.refresh(data);
|
||||
}
|
||||
resultTable.render();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Makes ranking table
|
||||
*
|
||||
* @param base Table composite
|
||||
*/
|
||||
private void createRankingTable(Composite base) {
|
||||
String[] rowHeaders = new String[model.getAlternatives().length];
|
||||
String[] colHeaders = new String[] { "Core ranking", "Fuzzy ranking", "Crisp ranking S", "Crisp ranking R", "Crisp ranking Q"};
|
||||
String[][] data = new String[rowHeaders.length][colHeaders.length];
|
||||
|
||||
for (int a = 0; a < rowHeaders.length; a++) {
|
||||
rowHeaders[a] = model.getAlternatives()[a].getName();
|
||||
|
||||
data[a][0] = Integer.toString(model.coreRanking.indexOf(a) + 1);
|
||||
if(model.fuzzyRanking.get(model.coreRanking.indexOf(a))) {
|
||||
data[a][1] = Integer.toString(model.coreRanking.indexOf(a) + 1);
|
||||
}else {
|
||||
data[a][1] = "-";
|
||||
}
|
||||
data[a][2] = Integer.toString(model.rankCrispS.indexOf(a) + 1);
|
||||
data[a][3] = Integer.toString(model.rankCrispR.indexOf(a) + 1);
|
||||
data[a][4] = Integer.toString(model.rankCrispQ.indexOf(a) + 1);
|
||||
}
|
||||
|
||||
if (rankingTable == null)
|
||||
rankingTable = new HtmlTextTable(base, data, colHeaders, rowHeaders);
|
||||
else {
|
||||
rankingTable.refresh(data);
|
||||
}
|
||||
rankingTable.render();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Makes method values table
|
||||
*
|
||||
* @param base Table composite
|
||||
*/
|
||||
private void createValuesTable(Composite base) {
|
||||
String[] headers = new String[] { "S*", "Sor", "R*", "Ror" };
|
||||
String[] data = new String[] { model.Sstar.toString(), Double.toString(model.Sor), model.Rstar.toString(),
|
||||
Double.toString(model.Ror) };
|
||||
|
||||
if (valuesTable == null)
|
||||
valuesTable = new HtmlTextTable(base, data, headers, false);
|
||||
else {
|
||||
valuesTable.refresh(data);
|
||||
}
|
||||
valuesTable.render();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Makes crisp values table
|
||||
*
|
||||
* @param base Table composite
|
||||
*/
|
||||
private void createCrispTable(Composite base) {
|
||||
String[] rowHeaders = new String[model.getAlternatives().length];
|
||||
String[] colHeaders = new String[] { "Sj", "Crisp(Sj)", "Rj", "Crisp(Rj)", "Qj", "Crisp(Qj)" };
|
||||
String[][] data = new String[rowHeaders.length][colHeaders.length];
|
||||
|
||||
for (int a = 0; a < rowHeaders.length; a++) {
|
||||
rowHeaders[a] = model.getAlternatives()[a].getName();
|
||||
|
||||
data[a][0] = model.Sj[a].toString();
|
||||
data[a][1] = String.format("%.3f", model.crispS[a]);
|
||||
data[a][2] = model.Rj[a].toString();
|
||||
data[a][3] = String.format("%.3f", model.crispR[a]);
|
||||
data[a][4] = model.Qj[a].toString();
|
||||
data[a][5] = String.format("%.3f", model.crispQ[a]);
|
||||
}
|
||||
|
||||
if (crispTable == null)
|
||||
crispTable = new HtmlTextTable(base, data, colHeaders, rowHeaders);
|
||||
else {
|
||||
crispTable.refresh(data);
|
||||
}
|
||||
crispTable.render();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Makes normalized difference table
|
||||
*
|
||||
* @param base Table composite
|
||||
*/
|
||||
private void createDifferenceTable(Composite base) {
|
||||
String[] rowHeaders = new String[model.getAlternatives().length];
|
||||
String[] colHeaders = new String[model.getCriteria().length];
|
||||
String[][] data = new String[rowHeaders.length][colHeaders.length];
|
||||
for (int i = 0; i < rowHeaders.length; i++) {
|
||||
rowHeaders[i] = model.getAlternatives()[i].getName();
|
||||
}
|
||||
for (int i = 0; i < colHeaders.length; i++) {
|
||||
colHeaders[i] = model.getCriteria()[i].getName();
|
||||
}
|
||||
|
||||
for (int c = 0; c < model.getCriteria().length; c++) {
|
||||
for (int a = 0; a < model.getAlternatives().length; a++) {
|
||||
data[a][c] = model.getDifference(a, c).toString();
|
||||
}
|
||||
}
|
||||
|
||||
if (difTable == null)
|
||||
difTable = new HtmlTextTable(base, data, colHeaders, rowHeaders);
|
||||
else {
|
||||
difTable.refresh(data);
|
||||
}
|
||||
difTable.render();
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes initial data table and best/worst values
|
||||
*
|
||||
* @param base Table composite
|
||||
*/
|
||||
private void createInitialTable(Composite base) {
|
||||
String[] rowHeaders = new String[model.getAlternatives().length + 2];
|
||||
String[] colHeaders = new String[model.getCriteria().length];
|
||||
String[][] data = new String[rowHeaders.length][colHeaders.length];
|
||||
for (int i = 0; i < rowHeaders.length - 2; i++) {
|
||||
rowHeaders[i] = model.getAlternatives()[i].getName();
|
||||
}
|
||||
rowHeaders[rowHeaders.length - 2] = msg.best_tag;
|
||||
rowHeaders[rowHeaders.length - 1] = msg.worst_tag;
|
||||
for (int i = 0; i < colHeaders.length; i++) {
|
||||
colHeaders[i] = model.getCriteria()[i].getName();
|
||||
}
|
||||
|
||||
TrapezoidalFunction[] best = model.getBestValues();
|
||||
TrapezoidalFunction[] worst = model.getWorstValues();
|
||||
|
||||
for (int c = 0; c < model.getCriteria().length; c++) {
|
||||
for (int a = 0; a < model.getAlternatives().length; a++) {
|
||||
data[a][c] = model.getInitialValuation(model.getAlternatives()[a], model.getCriteria()[c]).toString();
|
||||
}
|
||||
data[model.getAlternatives().length][c] = best[c].toString();
|
||||
data[model.getAlternatives().length + 1][c] = worst[c].toString();
|
||||
}
|
||||
|
||||
if (initialTable == null)
|
||||
initialTable = new HtmlTextTable(base, data, colHeaders, rowHeaders);
|
||||
else
|
||||
initialTable.refresh(data);
|
||||
initialTable.render();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true always enable next phase
|
||||
*/
|
||||
@Override
|
||||
protected boolean isForwardEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package flintstones.method.vikorFuzzy.phase.result.ui.messages;
|
||||
|
||||
import org.eclipse.e4.core.services.nls.Message;
|
||||
|
||||
@Message
|
||||
public class Messages {
|
||||
public String v_selector;
|
||||
public String calculate_button;
|
||||
public String solution_tag;
|
||||
public String all_alt_tag;
|
||||
public String best_tag;
|
||||
public String worst_tag;
|
||||
|
||||
public String dif_title;
|
||||
public String crisp_title;
|
||||
public String values_title;
|
||||
public String rank_title;
|
||||
public String result_title;
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
v_selector=V value
|
||||
calculate_button=Calculate
|
||||
solution_tag=Solution
|
||||
all_alt_tag=All alternatives
|
||||
best_tag=Best
|
||||
worst_tag=Worst
|
||||
dif_title=Normalized difference
|
||||
crisp_title=Crisp values
|
||||
values_title=Method values
|
||||
rank_title=Ranking
|
||||
result_title=Proposed solutions
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
v_selector=Valor V
|
||||
calculate_button=Calcular
|
||||
solution_tag=Solución
|
||||
all_alt_tag=Todas las alternativas
|
||||
best_tag=Mejor
|
||||
worst_tag=Peor
|
||||
dif_title=Diferencia normalizada
|
||||
crisp_title=Valores crisp
|
||||
values_title=Valores del método
|
||||
rank_title=Clasificación
|
||||
result_title=Soluciones propuestas
|
||||
Reference in New Issue
Block a user