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-1.8"/>
<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.common.phase.collectweightsaggregation</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<name>[bundle] Collectweightsaggregation</name>
</project>
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>flintstones.method.common.phase.collectweightsaggregation</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>1779484362648</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,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
@@ -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: Collectweightsaggregation
Bundle-SymbolicName: flintstones.method.common.phase.collectweightsaggregation;singleton:=true
Bundle-Version: 1.0.0.qualifier
Automatic-Module-Name: flintstones.method.common.phase.collectweightsaggregation
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: flintstones.entity.method.phase,
flintstones.entity.problemelement,
flintstones.helper.data,
flintstones.entity.aggregation,
flintstones.entity.operator,
javax.inject,
flintstones.operator,
flintstones.entity.valuation,
flintstones.model.valuation.service
Export-Package: flintstones.method.common.phase.collectweightsaggregation
@@ -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
uid="flintstones.method.common.phase.collectweightsaggregation"
implementation="flintstones.method.common.phase.collectweightsaggregation.CollectAggregationDataModel">
</phase>
</extension>
</plugin>
@@ -0,0 +1,142 @@
package flintstones.method.common.phase.collectweightsaggregation;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import javax.inject.Inject;
import flintstones.entity.aggregation.AggregationItem;
import flintstones.entity.method.phase.ImportedDataNotFoundException;
import flintstones.entity.method.phase.PhaseMethod;
import flintstones.entity.operator.AggregationOperator;
import flintstones.entity.problemelement.ProblemElementKey;
import flintstones.entity.problemelement.entities.Criterion;
import flintstones.entity.problemelement.entities.Expert;
import flintstones.entity.valuation.Valuation;
import flintstones.helper.data.HashMatrix;
import flintstones.model.valuation.service.IValuationService;
import flintstones.operator.service.IOperatorService;
public class CollectAggregationDataModel extends PhaseMethod {
@Inject
IOperatorService operatorService;
@Inject
IValuationService valuationService;
@Override
public String getName() {
return "Collect Weights Aggregation";
}
private ArrayList<AggregationItem> getLeafItems(AggregationItem item) {
ArrayList<AggregationItem> arr = new ArrayList<>();
if (item.getElement2() != null && item.getElement3() != null)
arr.add(item);
Arrays.stream(item.getChildren()).forEach(k -> arr.addAll(getLeafItems(k)));
return arr;
}
private ArrayList<AggregationItem> getLevel2ItemsOnly(AggregationItem item) {
ArrayList<AggregationItem> arr = new ArrayList<>();
// Stop expanding tree
if(item.getElement3() != null)
return arr;
if (item.getElement2() != null)
arr.add(item);
Arrays.stream(item.getChildren()).forEach(k -> arr.addAll(getLevel2ItemsOnly(k)));
return arr;
}
public void refreshExpertWeights(AggregationItem mainItem) {
// Expert -> Criterion
HashMatrix<Expert, Criterion, Double> expertCriterionWeights = new HashMatrix<>();
ArrayList<AggregationItem> finalECChildren = getLeafItems(mainItem);
for (AggregationItem item : finalECChildren)
expertCriterionWeights.put((Expert)item.getElement2(), (Criterion)item.getElement3(), item.getWeight());
// Expert
HashMap<Expert, Double> expertWeights = new HashMap<>();
ArrayList<AggregationItem> finalEChildren = getLevel2ItemsOnly(mainItem);
for (AggregationItem item : finalEChildren)
expertWeights.put((Expert)item.getElement2(), item.getWeight());
exportData("expertWeights",expertWeights, true);
exportData("expertCriterionWeights",expertCriterionWeights, true);
exportData("expertCriterionWeightsMainTtem", mainItem, true);
}
public void refreshCriterionWeights(AggregationItem mainItem) {
HashMatrix<Criterion, Expert, Double> criterionExpertWeights = new HashMatrix<>();
ArrayList<AggregationItem> finalChildren = getLeafItems(mainItem);
for (AggregationItem item : finalChildren)
criterionExpertWeights.put((Criterion)item.getElement2(), (Expert)item.getElement3(), item.getWeight());
// Criterion
HashMap<Criterion, Double> criterionWeights = new HashMap<>();
ArrayList<AggregationItem> finalEChildren = getLevel2ItemsOnly(mainItem);
for (AggregationItem item : finalEChildren)
criterionWeights.put((Criterion)item.getElement2(), item.getWeight());
exportData("criterionWeights",criterionWeights, true);
exportData("criterionExpertWeights",criterionExpertWeights, true);
exportData("criterionExpertSubItems", finalEChildren, true); // List of Sub-Criteria
exportData("criterionExpertWeightsMainItem", mainItem, true);
}
@SuppressWarnings("unchecked")
private Map<ProblemElementKey, Valuation> getValuations() {
Map<ProblemElementKey, Valuation> valuations;
try {
valuations = (Map<ProblemElementKey, Valuation>) importData("twoTupleUnifiedValuations");
} catch (ImportedDataNotFoundException e) {
valuations = valuationService.getAllKV();
}
return valuations;
}
public HashMap<String, String> getOperatorsIdName(){
HashMap<String, String> operatorsIdNameCache = new HashMap<>();
Valuation v = getValuations().values().iterator().next();
AggregationOperator[] operators = operatorService.getAggregationOperatorsFor(v.getId(), true);
for(AggregationOperator op : operators)
operatorsIdNameCache.put(op.getId(), op.getName());
return operatorsIdNameCache;
}
public HashMap<String, String> getOperatorsNameId(){
HashMap<String, String> operatorsNameIdCache = new HashMap<>();
Valuation v = getValuations().values().iterator().next();
AggregationOperator[] operators = operatorService.getAggregationOperatorsFor(v.getId(), true);
for(AggregationOperator op : operators)
operatorsNameIdCache.put(op.getName(), op.getId());
return operatorsNameIdCache;
}
}