public code v1

This commit is contained in:
Francisco Jesús Martínez Mimbrera
2026-05-23 00:32:57 +02:00
commit 759a8968a2
4357 changed files with 163763 additions and 0 deletions
@@ -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.mmoora.phase.results</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.mmoora.phase.results</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>1779484362686</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>
@@ -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,16 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: flintstones.method.mmoora.phase.results;singleton:=true
Bundle-Version: 1.0.0.qualifier
Automatic-Module-Name: flintstones.method.mmoora.phase.results
Bundle-RequiredExecutionEnvironment: JavaSE-11
Require-Bundle: org.eclipse.e4.core.services,
flintstones.entity.method.phase,
javax.inject,
flintstones.model.problemelement.service,
flintstones.engine.R,
flintstones.entity.valuation,
flintstones.helper.data
Import-Package: flintstones.valuation.numeric
Export-Package: flintstones.method.mmoora.phase.results
@@ -0,0 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="flintstones.phasemethod.extensionpoint">
<phase
implementation="flintstones.method.mmoora.phase.results.MMOORAResults"
uid="flintstones.method.mmoora.phase.results">
</phase>
</extension>
</plugin>
@@ -0,0 +1,141 @@
package flintstones.method.mmoora.phase.results;
import java.util.HashMap;
import javax.inject.Inject;
import org.eclipse.e4.core.services.nls.Translation;
import org.rosuda.JRI.REXP;
import org.rosuda.JRI.Rengine;
import flintstones.entity.method.phase.PhaseMethod;
import flintstones.entity.problemelement.entities.Alternative;
import flintstones.entity.problemelement.entities.Criterion;
import flintstones.entity.problemelement.entities.ProblemElement;
import flintstones.entity.problemelement.entities.ProblemElementHelper;
import flintstones.entity.valuation.Valuation;
import flintstones.helper.data.HashMatrix;
import flintstones.method.mmoora.phase.results.messages.Messages;
import flintstones.model.problemelement.service.IProblemElementService;
import flintstones.valuation.numeric.NumericValuation;
public class MMOORAResults extends PhaseMethod {
@Inject
IProblemElementService problemService;
@Inject
@Translation
Messages msg;
/**
* Problem criteria
*/
Criterion[] allCriteria;
/**
* Problem alternatives
*/
Alternative[] allAlternatives;
/**
* R execution engine
*/
Rengine eng;
/**
* Criteria weights
*/
HashMap<ProblemElement, Double> aggCriWeights;
/**
* Aggregated valuations
*/
HashMatrix<Alternative, Criterion, Valuation> aggregatedValues;
/**
* @return Problem criteria
*/
public Criterion[] allCriteria() {
return allCriteria;
}
/**
* @return Problem alternatives
*/
public Alternative[] allAlternatives() {
return allAlternatives;
}
/**
* @return Phase name
*/
@Override
public String getName() {
return msg.phase_name;
}
/**
* Loads problem data from previous phases and creates R engine
*/
@SuppressWarnings("unchecked")
public void loadData() {
eng = Rengine.getMainEngine();
if (eng == null)
eng = new Rengine(new String[] { "--no-save" }, false, null);
allCriteria = ProblemElementHelper.asCriterions(problemService.getAll(Criterion.Type));
allAlternatives = ProblemElementHelper.asAlternatives(problemService.getAll(Alternative.Type));
aggCriWeights = (HashMap<ProblemElement, Double>) importData("criterionWeights");
aggregatedValues = (HashMatrix<Alternative, Criterion, Valuation>) importData("decisionmatrix");
}
/**
* Executes FuzzyMMOORA function from R engine
*
* @return R expression with results
*/
public REXP executeR() {
// Start library
eng.eval("library(MCDM)");
// Valuation matrix: decision <- matrix(c(...), nrow, ncol)
StringBuilder sb = new StringBuilder("decision <- matrix(c(");
NumericValuation temp;
for (int c = 0; c < allCriteria.length; c++) {
for (int a = 0; a < allAlternatives.length; a++) {
temp = (NumericValuation) aggregatedValues.get(allAlternatives[a], allCriteria[c]);
sb.append(Double.toString(temp.getValue()) + ",");
}
}
sb.deleteCharAt(sb.length() - 1);
sb.append("),nrow = " + allAlternatives.length + ",ncol = " + allCriteria.length + ")");
eng.eval(sb.toString());
// Criterion weights: we <- c(...)
sb = new StringBuilder("we <- c(");
for (int c = 0; c < allCriteria.length; c++) {
sb.append(Double.toString(aggCriWeights.get(allCriteria[c])) + ",");
}
sb.deleteCharAt(sb.length() - 1);
sb.append(")");
eng.eval(sb.toString());
// Type of criteria (cost/benefit)
sb = new StringBuilder("cb <- c(");
for (int c = 0; c < allCriteria.length; c++) {
if (allCriteria[c].isCost()) {
sb.append("\"min\",");
} else {
sb.append("\"max\",");
}
}
sb.deleteCharAt(sb.length() - 1);
sb.append(")");
eng.eval(sb.toString());
return eng.eval("MCDM::MMOORA(decision, we, cb)");
}
}
@@ -0,0 +1,8 @@
package flintstones.method.mmoora.phase.results.messages;
import org.eclipse.e4.core.services.nls.Message;
@Message
public class Messages {
public String phase_name;
}