public code v1

This commit is contained in:
2026-05-22 11:14:29 +02:00
parent 427197ec5a
commit b8141736eb
28859 changed files with 575079 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 @@
/bin/
+34
View File
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>afryca.rcp.ase.context</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>
</projectDescription>
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
line.separator=\n
@@ -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,25 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: afryca.rcp.ase.context;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: %Bundle-Vendor
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: afryca.ase,
afryca.simulation,
afryca.workspace,
afryca.twotuple,
afryca.hpr,
org.apache.commons.math3,
org.eclipse.core.runtime,
org.eclipse.e4.core.services,
org.eclipse.e4.core.di,
org.eclipse.e4.core.di.extensions,
org.eclipse.e4.core.contexts,
org.eclipse.e4.ui.di,
org.eclipse.e4.ui.model.workbench,
javax.inject
Bundle-ActivationPolicy: lazy
Service-Component: OSGI-INF/ase_context_context_function.xml
Automatic-Module-Name: afryca.rcp.ase.context
Export-Package: afryca.rcp.ase.context
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="IASEContext context function">
<implementation class="afryca.rcp.ase.context.ASEContextContextFunction"/>
<property
name="service.context.key"
type="String"
value="afryca.ase.IASEContext"/>
<service>
<provide
interface="org.eclipse.e4.core.contexts.IContextFunction"/>
</service>
</scr:component>
@@ -0,0 +1,3 @@
#Properties file for afryca.rcp.ase.context
Bundle-Name = ASE Context
Bundle-Vendor = Sinbad\u00B2
@@ -0,0 +1,3 @@
#Archivo de propiedades para afryca.rcp.ase.context
Bundle-Name = Contexto de ASE
Bundle-Vendor = Sinbad\u00B2
@@ -0,0 +1,6 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
OSGI-INF/,\
plugin.xml
+179
View File
@@ -0,0 +1,179 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="afryca.ase.preloadedclass">
<PreloadedClass
class="afryca.gdmp.service.IGDMPService">
</PreloadedClass>
<PreloadedClass
class="afryca.behavior.Attitude">
</PreloadedClass>
<PreloadedClass
class="afryca.behavior.Behavior">
</PreloadedClass>
<PreloadedClass
class="afryca.behavior.Parameter">
</PreloadedClass>
<PreloadedClass
class="afryca.behavior.service.IBehaviorService">
</PreloadedClass>
<PreloadedClass
class="afryca.cm.CM">
</PreloadedClass>
<PreloadedClass
class="afryca.consensusmodel.Configuration">
</PreloadedClass>
<PreloadedClass
class="afryca.consensusmodel.ConsensusEngine">
</PreloadedClass>
<PreloadedClass
class="afryca.consensusmodel.ConsensusModel">
</PreloadedClass>
<PreloadedClass
class="afryca.consensusmodel.Variables">
</PreloadedClass>
<PreloadedClass
class="afryca.consensusmodel.definition.EResultElements">
</PreloadedClass>
<PreloadedClass
class="afryca.consensusmodel.definition.ERoundResult">
</PreloadedClass>
<PreloadedClass
class="afryca.consensusmodel.service.IConsensusModelService">
</PreloadedClass>
<PreloadedClass
class="afryca.consensusmodel.variable.Variable">
</PreloadedClass>
<PreloadedClass
class="afryca.fpr.FPR">
</PreloadedClass>
<PreloadedClass
class="afryca.gdmp.GDMP">
</PreloadedClass>
<PreloadedClass
class="afryca.gdmp.service.IGDMPService">
</PreloadedClass>
<PreloadedClass
class="afryca.structure.service.IStructureService">
</PreloadedClass>
<PreloadedClass
class="java.util.Arrays">
</PreloadedClass>
<PreloadedClass
class="java.util.Collections">
</PreloadedClass>
<PreloadedClass
class="java.util.HashMap">
</PreloadedClass>
<PreloadedClass
class="java.util.LinkedList">
</PreloadedClass>
<PreloadedClass
class="java.util.ArrayList">
</PreloadedClass>
<PreloadedClass
class="java.util.stream.Stream">
</PreloadedClass>
<PreloadedClass
class="java.lang.System">
</PreloadedClass>
<PreloadedClass
class="afryca.workspace.service.IWorkspaceService">
</PreloadedClass>
<PreloadedClass
class="afryca.ase.service.IASEService">
</PreloadedClass>
<PreloadedClass
class="afryca.ase.ParametersBuilder">
</PreloadedClass>
<PreloadedClass
class="afryca.simulation.service.ISimulationService">
</PreloadedClass>
<PreloadedClass
class="org.apache.commons.math3.random.RandomDataGenerator">
</PreloadedClass>
<PreloadedClass
class="afryca.structure.Structure">
</PreloadedClass>
<PreloadedClass
class="afryca.pr.PR">
</PreloadedClass>
<PreloadedClass
class="afryca.domain.real.NumericRealDomain">
</PreloadedClass>
<PreloadedClass
class="afryca.domain.integer.NumericIntegerDomain">
</PreloadedClass>
<PreloadedClass
class="afryca.domain.fuzzyset.FuzzySet">
</PreloadedClass>
<PreloadedClass
class="afryca.domain.fuzzyset.function.FragmentFunction">
</PreloadedClass>
<PreloadedClass
class="afryca.domain.fuzzyset.function.IFragmentFunction">
</PreloadedClass>
<PreloadedClass
class="afryca.domain.fuzzyset.semantic.IMembershipFunction">
</PreloadedClass>
<PreloadedClass
class="afryca.domain.fuzzyset.function.types.TrapezoidalFunction">
</PreloadedClass>
<PreloadedClass
class="afryca.domain.fuzzyset.labelset.LabelSet">
</PreloadedClass>
<PreloadedClass
class="afryca.domain.fuzzyset.labelset.Label">
</PreloadedClass>
<PreloadedClass
class="afryca.domain.Domain">
</PreloadedClass>
<PreloadedClass
class="afryca.domain.service.IDomainService">
</PreloadedClass>
<PreloadedClass
class="afryca.twotuple.TwoTuple">
</PreloadedClass>
<PreloadedClass
class="afryca.hpr.HPR">
</PreloadedClass>
<PreloadedClass
class="afryca.hpr.valuation.HesitantNumericValuation">
</PreloadedClass>
<PreloadedClass
class="afryca.hpr.valuation.ExpertDegree">
</PreloadedClass>
<PreloadedClass
class="afryca.hlpr.valuation.HesitantLinguisticValuation">
</PreloadedClass>
<PreloadedClass
class="org.apache.commons.math3.linear.MatrixUtils">
</PreloadedClass>
<PreloadedClass
class="org.apache.commons.math3.linear.EigenDecomposition">
</PreloadedClass>
<PreloadedClass
class="org.apache.commons.math3.linear.RealMatrix">
</PreloadedClass>
<PreloadedClass
class="org.apache.commons.math3.stat.correlation.Covariance">
</PreloadedClass>
<PreloadedClass
class="afryca.lpr.LPR">
</PreloadedClass>
<PreloadedClass
class="afryca.decisionmatrix.DecisionMatrix">
</PreloadedClass>
<PreloadedClass
class="org.eclipse.core.runtime.preferences.InstanceScope">
</PreloadedClass>
<PreloadedClass
class="afryca.consensusmodel.preferences.PreferenceConstants">
</PreloadedClass>
<PreloadedClass
class="afryca.mpr.MPR">
</PreloadedClass>
</extension>
</plugin>
@@ -0,0 +1,26 @@
package afryca.rcp.ase.context;
import org.eclipse.e4.core.contexts.ContextFunction;
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.ui.model.application.MApplication;
import afryca.ase.IASEContext;
/**
* ASEContext context function
*
* @author Sinbad²
* @version 3.0
*/
public class ASEContextContextFunction extends ContextFunction {
@Override
public Object compute(IEclipseContext context, String contextKey) {
IASEContext aseContextProvider = ContextInjectionFactory.make(ASEContextProvider.class,
context);
MApplication application = context.get(MApplication.class);
IEclipseContext applicationContext = application.getContext();
applicationContext.set(IASEContext.class, aseContextProvider);
return aseContextProvider;
}
}
@@ -0,0 +1,286 @@
package afryca.rcp.ase.context;
import java.util.Map;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.script.ScriptEngine;
import javax.script.ScriptException;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.core.di.extensions.EventTopic;
import org.eclipse.e4.core.services.nls.Translation;
import org.eclipse.e4.ui.di.UISynchronize;
import afryca.ase.Binding;
import afryca.ase.IASEContext;
import afryca.ase.engine.IEngine;
import afryca.ase.service.IASEService;
import afryca.ase.service.events.IASEServiceEvents;
import afryca.behavior.service.IBehaviorService;
import afryca.behavior.service.events.IBehaviorServiceEvents;
//import afryca.birt.service.IBIRTService;
import afryca.consensusmodel.service.IConsensusModelService;
import afryca.consensusmodel.service.events.IConsensusModelServiceEvents;
import afryca.gdmp.GDMP;
import afryca.gdmp.service.IGDMPService;
import afryca.gdmp.service.events.IGDMPServiceEvents;
import afryca.rcp.ase.context.definition.EBinding;
import afryca.rcp.ase.context.l10n.Messages;
import afryca.simulation.Simulation;
import afryca.simulation.service.ISimulationService;
import afryca.simulation.service.events.ISimulationServiceEvents;
import afryca.structure.Structure;
import afryca.workspace.service.IWorkspaceService;
/**
* ASEContext provider
*
* @author Sinbad²
* @version 3.0
*/
public class ASEContextProvider implements IASEContext {
private boolean globalGroupUpdates;
private boolean gdmpGroupUpdates;
private boolean consensusModelGroupUpdates;
private boolean behaviorGroupUpdates;
@Inject
private IWorkspaceService workspaceService;
@Inject
private IGDMPService gdmpService;
@Inject
private IConsensusModelService consensusModelService;
@Inject
private IBehaviorService behaviorService;
@Inject
private ISimulationService simulationService;
@Inject
private IASEService aseService;
//@Inject
//private IBIRTService birtService;
@Inject
private UISynchronize sync;
@Inject
@Translation
private Messages messages;
@Inject
public ASEContextProvider() {
globalGroupUpdates = false;
gdmpGroupUpdates = false;
consensusModelGroupUpdates = false;
behaviorGroupUpdates = false;
}
@PostConstruct
private void updateBindings() {
globalGroupUpdates = true;
aseService.groupUpdatesActive(true);
updateASEBinding();
updateBIRTBinding();
updateUISyncBinding();
updateWorkspaceBinding();
updateGDMPBindings();
updateConsensusModelBindings();
updateBehaviorBindings();
updateSimulationBindings();
aseService.groupUpdatesActive(false);
globalGroupUpdates = false;
}
private void doUpdateStep(Runnable step) {
if (!globalGroupUpdates) {
aseService.groupUpdatesActive(true);
}
step.run();
if (!globalGroupUpdates) {
aseService.groupUpdatesActive(false);
}
}
private void updateASEBinding() {
doUpdateStep(() -> {
bind(EBinding.aseService, messages.ase_service, aseService);
});
}
private void updateBIRTBinding() {
//doUpdateStep(() -> {
//bind(EBinding.birtService, messages.birt_service, birtService);
//});
}
private void updateUISyncBinding() {
doUpdateStep(() -> {
bind(EBinding.uiSync, messages.sync, sync);
});
}
private void bind(EBinding eBinding, String description, Object value) {
aseService.bind(new Binding(
(eBinding.getName() != null) ? eBinding.getName() : description,
description,
value,
eBinding.getReadableFunction(),
eBinding.getCompareFunction()));
}
private void updateWorkspaceBinding() {
doUpdateStep(() -> {
bind(EBinding.workspaceService, messages.workspace_service, workspaceService);
});
}
private void updateGDMPBindings() {
doUpdateStep(() -> {
if (!gdmpGroupUpdates) {
GDMP gdmp = gdmpService.getSelection();
String expert = gdmpService.getSelectedExpert();
String alternative = gdmpService.getSelectedAlternative();
String criterion = gdmpService.getSelectedCriterion();
Structure st = null;
if (expert != null && criterion != null) {
try {
st = (Structure) gdmp.getPreferences().get(gdmp.getCriteria().size() * gdmp.getExperts().indexOf(expert) + gdmp.getCriteria().indexOf(criterion)).clone();
} catch (CloneNotSupportedException e) {
st = null;
}
} else if(expert != null) {
try {
st = (Structure) gdmp.getPreferences().get(gdmp.getCriteria().size() * gdmp.getExperts().indexOf(expert)).clone();
} catch (CloneNotSupportedException e) {
st = null;
}
} else if(criterion != null) {
try {
st = (Structure) gdmp.getPreferences().get(gdmp.getCriteria().indexOf(criterion)).clone();
} catch (CloneNotSupportedException e) {
st = null;
}
}
bind(EBinding.gdmpService, messages.gdmp_service, gdmpService);
bind(EBinding.gdmp, messages.selected_gdmp, gdmp);
bind(EBinding.numberOfExperts, messages.number_of_experts, (gdmp != null) ? gdmp.getExperts().size() : null);
bind(EBinding.numberOfAlternatives, messages.number_of_alternatives, (gdmp != null) ? gdmp.getAlternatives().size() : null);
bind(EBinding.numberOfCriteria, messages.number_of_criteria, (gdmp != null) ? gdmp.getCriteria().size() : null);
bind(EBinding.expertId, messages.selected_expert_id, expert);
bind(EBinding.expertPos, messages.selected_expert_pos, (expert != null) ? gdmp.getExperts().indexOf(expert) : null);
bind(EBinding.fpr, messages.selected_expert_preferences, st);
bind(EBinding.alternativeId, messages.selected_alternative_id, alternative);
bind(EBinding.alternativePos, messages.selected_alternative_pos, (alternative != null) ? gdmp.getAlternatives().indexOf(alternative) : null);
bind(EBinding.criterionId, messages.selected_criterion_id, criterion);
bind(EBinding.criterionPos, messages.selected_criterion_pos, (criterion != null) ? gdmp.getCriteria().indexOf(criterion) : null);
}
});
}
private void updateConsensusModelBindings() {
doUpdateStep(() -> {
if (!consensusModelGroupUpdates) {
bind(EBinding.consensusModelService, messages.consensus_model_service, consensusModelService);
bind(EBinding.consensusModelId, messages.selected_consensus_model_id, consensusModelService.getSelection());
bind(EBinding.configuration, messages.selected_configuration, consensusModelService.getConfiguration());
}
});
}
private void updateBehaviorBindings() {
doUpdateStep(() -> {
if (!behaviorGroupUpdates) {
bind(EBinding.behaviorService, messages.behavior_service, behaviorService);
bind(EBinding.behaviorId, messages.selected_behavior_id, behaviorService.getSelection());
bind(EBinding.attitude, messages.attitude, behaviorService.getAttitude());
}
});
}
private void updateSimulationBindings() {
doUpdateStep(() -> {
Map<Long, Simulation> simulationStack = simulationService.getSimulationStack();
Simulation simulation = simulationService.getSelection();
bind(EBinding.simulationService, messages.simulation_service, simulationService);
bind(EBinding.simulation, messages.selected_simulation, simulation);
bind(EBinding.simulationStack, messages.simulation_stack, simulationStack);
bind(EBinding.simulationInitialRound, messages.simulation_initial_round, simulationService.getInitialRound());
bind(EBinding.simulationFinalRound, messages.simulation_final_round, simulationService.getFinalRound());
bind(EBinding.simulationExpert, messages.simulation_expert, simulationService.getSelectedExpert());
bind(EBinding.simulationAlternative, messages.simulation_alternative, simulationService.getSelectedAlternative());
bind(EBinding.simulationCriterion, messages.simulation_criterion, simulationService.getSelectedCriterion());
});
}
@Override
public Object eval(ScriptEngine engine, String code) throws ScriptException {
try {
return engine.eval(code);
} catch (NullPointerException | ClassCastException e) {
return null;
}
}
@Inject
@Optional
private void subscribeTopicGDMP(
@EventTopic(IGDMPServiceEvents.GDMP_ALL) Map<String, String> event) {
if (event.get(IGDMPServiceEvents.TOPIC_BASE).equals(IGDMPServiceEvents.GDMP_GROUP_UPDATES)) {
Object value = (Object) event.get(IGDMPServiceEvents.FIELD_GROUPED);
gdmpGroupUpdates = Boolean.parseBoolean((String) value);
}
updateGDMPBindings();
}
@Inject
@Optional
private void subscribeTopicConsensusModel(
@EventTopic(IConsensusModelServiceEvents.CONSENSUS_MODELS_ALL) Map<String, String> event) {
if (event.get(IConsensusModelServiceEvents.TOPIC_BASE)
.equals(IConsensusModelServiceEvents.CONSENSUS_MODEL_GROUP_UPDATES)) {
Object value = (Object) event.get(IConsensusModelServiceEvents.FIELD_GROUPED);
consensusModelGroupUpdates = Boolean.parseBoolean((String) value);
}
updateConsensusModelBindings();
}
@Inject
@Optional
private void subscribeTopicBehavior(
@EventTopic(IBehaviorServiceEvents.BEHAVIORS_ALL) Map<String, String> event) {
if (event.get(IBehaviorServiceEvents.TOPIC_BASE).equals(IBehaviorServiceEvents.BEHAVIOR_GROUP_UPDATES)) {
Object value = (Object) event.get(IGDMPServiceEvents.FIELD_GROUPED);
behaviorGroupUpdates = Boolean.parseBoolean((String) value);
}
updateBehaviorBindings();
}
@Inject
@Optional
private void subscribeTopicSimulationGroupUpdates(
@EventTopic(ISimulationServiceEvents.SIMULATION_GROUP_UPDATES) Map<String, String> event) {
Object value = (Object) event.get(ISimulationServiceEvents.FIELD_GROUPED);
if (!Boolean.parseBoolean((String) value)) {
updateSimulationBindings();
}
}
@Inject
@Optional
private void subscribeTopicEngine(
@EventTopic(IASEServiceEvents.ASE_ENGINE_NEW) Map<String, String> event) {
String name = event.get(IASEServiceEvents.FIELD_NAME);
IEngine engine = aseService.getEngines().get(name);
Object value = (engine != null) ? engine.getEngine() : null;
bind(EBinding.engine, name, value);
}
}
@@ -0,0 +1,71 @@
package afryca.rcp.ase.context.definition;
import java.util.function.BiFunction;
import java.util.function.Function;
/**
* ASE service bindings
*
* @author Sinbad²
* @version 3.0
*/
public enum EBinding {
aseService("ase", EReadableFunction.serviceInterface, ECompareFunction.classes),
birtService("birt", EReadableFunction.serviceInterface, ECompareFunction.classes),
uiSync("ui", EReadableFunction.enclosingClassName, ECompareFunction.classes),
workspaceService("sWork", EReadableFunction.serviceInterface, ECompareFunction.classes),
gdmpService("sGDMP", EReadableFunction.serviceInterface, ECompareFunction.classes),
gdmp("gdmp", EReadableFunction.gdmp, ECompareFunction.toStrings),
fpr("fpr", EReadableFunction.className, ECompareFunction.toStrings),
numberOfExperts("eNum", EReadableFunction.parseInt, ECompareFunction.ints),
expertId("eId", EReadableFunction.stringCast, ECompareFunction.strings),
expertPos("ePos", EReadableFunction.parseInt, ECompareFunction.ints),
numberOfAlternatives("aNum", EReadableFunction.parseInt, ECompareFunction.ints),
alternativeId("aId", EReadableFunction.stringCast, ECompareFunction.strings),
alternativePos("aPos", EReadableFunction.parseInt, ECompareFunction.ints),
criterionId("cId", EReadableFunction.stringCast, ECompareFunction.strings),
criterionPos("cPos", EReadableFunction.parseInt, ECompareFunction.ints),
numberOfCriteria("cNum", EReadableFunction.parseInt, ECompareFunction.ints),
consensusModelService("sCM", EReadableFunction.serviceInterface, ECompareFunction.classes),
consensusModelId("cmId", EReadableFunction.stringCast, ECompareFunction.strings),
configuration("conf", EReadableFunction.configuration, ECompareFunction.toStrings),
behaviorService("sBeh", EReadableFunction.serviceInterface, ECompareFunction.classes),
behaviorId("behId", EReadableFunction.stringCast, ECompareFunction.strings),
attitude("att", EReadableFunction.attitude, ECompareFunction.toStrings),
simulationService("sSim", EReadableFunction.serviceInterface, ECompareFunction.classes),
simulation("sim", EReadableFunction.simulation, ECompareFunction.simulations),
simulationStack("simStack", EReadableFunction.className, ECompareFunction.simulationStacks),
simulationInitialRound("irSim", EReadableFunction.parseInt, ECompareFunction.ints),
simulationFinalRound("frSim", EReadableFunction.parseInt, ECompareFunction.ints),
simulationExpert("eSim", EReadableFunction.stringCast, ECompareFunction.strings),
simulationAlternative("aSim", EReadableFunction.stringCast, ECompareFunction.strings),
simulationCriterion("cSim", EReadableFunction.stringCast, ECompareFunction.strings),
engine(null, EReadableFunction.className, ECompareFunction.classes);
private String name;
private EReadableFunction readableFunction;
private ECompareFunction compareFunction;
private EBinding(String name, EReadableFunction readableFunction, ECompareFunction compareFunction) {
this.name = name;
this.readableFunction = readableFunction;
this.compareFunction = compareFunction;
}
public String getName() {
return name;
}
public Function<Object, String> getReadableFunction() {
return readableFunction.get();
}
public BiFunction<Object, Object, Boolean> getCompareFunction() {
return compareFunction.get();
}
@Override
public String toString() {
return name;
}
}
@@ -0,0 +1,64 @@
package afryca.rcp.ase.context.definition;
import java.util.Map;
import java.util.Set;
import java.util.function.BiFunction;
import afryca.ase.Binding;
import afryca.simulation.Simulation;
public enum ECompareFunction {
classes((o1, o2) -> o1.getClass() == o2.getClass()),
ints((o1, o2) -> ((Integer) o1).intValue() == ((Integer) o2).intValue()),
strings((o1, o2) -> ((String) o1).equals((String) o2)),
toStrings((o1, o2) -> o1.toString().equals(o2.toString())),
simulations((o1, o2) -> {
Long l1 = ((Simulation) o1).getTimeStamp();
Long l2 = ((Simulation) o2).getTimeStamp();
return l1.longValue() == l2.longValue();
}),
simulationStacks((o1, o2) -> {
Set<?> k1 = ((Map<?, ?>) o1).keySet();
Set<?> k2 = ((Map<?, ?>) o2).keySet();
return k1.equals(k2);
});
private BiFunction<Object, Object, Boolean> function;
private ECompareFunction(BiFunction<Object, Object, Boolean> function) {
this.function = wrapFunction(function);
}
private BiFunction<Object, Object, Boolean> wrapFunction(BiFunction<Object, Object, Boolean> function) {
return compareObjects(compareBindings(function));
}
private BiFunction<Object, Object, Boolean> compareBindings(BiFunction<Object, Object, Boolean> function) {
return (o1, o2) -> {
if ((o1 instanceof Binding) && (o2 instanceof Binding)) {
Binding b1 = (Binding) o1;
Binding b2 = (Binding) o2;
if (b1.getName().equals(b2.getName())) {
return compareObjects(function).apply(b1.getValue(), b2.getValue());
}
}
return false;
};
}
private BiFunction<Object, Object, Boolean> compareObjects(BiFunction<Object, Object, Boolean> function) {
return (o1, o2) -> {
if ((o1 == null) && (o2 == null)) {
return true;
} else if ((o1 == null) || (o2 == null)) {
return false;
} else {
return function.apply(o1, o2);
}
};
}
public BiFunction<Object, Object, Boolean> get() {
return function;
}
}
@@ -0,0 +1,45 @@
package afryca.rcp.ase.context.definition;
import java.util.function.Function;
import afryca.gdmp.GDMP;
import afryca.behavior.Attitude;
import afryca.consensusmodel.Configuration;
import afryca.simulation.Simulation;
/**
* Readable functions enum
*
* @author Sinbad²
* @version 3.0
*/
public enum EReadableFunction {
attitude(value -> ((Attitude) value).getSimpleName()),
className(value -> value.getClass().getSimpleName()),
enclosingClassName(value -> value.getClass().getEnclosingClass().getSimpleName()),
configuration(value -> ((Configuration) value).getSimpleName()),
gdmp(value -> ((GDMP) value).getSimpleName()),
parseInt(value -> Integer.toString((Integer) value)),
serviceInterface(value -> {
Class<?>[] interfaces = value.getClass().getInterfaces();
return (interfaces.length > 0)
? interfaces[0].getSimpleName()
: null;
}),
simulation(value -> Long.toString(((Simulation) value).getTimeStamp())),
stringCast(value -> (String) value);
private Function<Object, String> function;
private EReadableFunction(Function<Object, String> function) {
this.function = wrapFunction(function);
}
private Function<Object, String> wrapFunction(Function<Object, String> function) {
return value -> (value != null) ? function.apply(value) : null;
}
public Function<Object, String> get() {
return function;
}
}
@@ -0,0 +1,41 @@
package afryca.rcp.ase.context.l10n;
/**
* Localization messages
*
* @author Sinbad²
* @version 3.0
*/
public class Messages {
public String ase_service;
public String attitude;
public String behavior_service;
public String birt_service;
public String consensus_model_service;
public String gdmp_service;
public String number_of_alternatives;
public String number_of_experts;
public String number_of_criteria;
public String R;
public String selected_alternative_id;
public String selected_alternative_pos;
public String selected_behavior_id;
public String selected_configuration;
public String selected_consensus_model_id;
public String selected_criterion_id;
public String selected_criterion_pos;
public String selected_expert_id;
public String selected_expert_pos;
public String selected_expert_preferences;
public String selected_gdmp;
public String selected_simulation;
public String simulation_alternative;
public String simulation_expert;
public String simulation_criterion;
public String simulation_final_round;
public String simulation_initial_round;
public String simulation_service;
public String simulation_stack;
public String sync;
public String workspace_service;
}
@@ -0,0 +1,31 @@
R=R engine
ase_service=ASE
attitude=Attitude
behavior_service=Behavior service
birt_service=BIRT service
consensus_model_service=Consensus model service
gdmp_service=GDMP service
number_of_alternatives=Number of alternatives
number_of_experts=Number of experts
number_of_criteria=Number of criteria
selected_alternative_id=Selected alternative id
selected_alternative_pos=Selected alternative position
selected_behavior_id=Selected behavior id
selected_configuration=Selected configuration
selected_consensus_model_id=Selected consensus model id
selected_criterion_id=Selected criterion id
selected_criterion_pos=Selected criterion position
selected_expert_id=Selected expert id
selected_expert_pos=Selected expert position
selected_expert_preferences=Selected expert preferences
selected_gdmp=Selected GDMP
selected_simulation=Selected simulation
simulation_alternative=Selected simulation alternative
simulation_expert=Selected simulation expert
simulation_criterion=Selected simulation criterion
simulation_final_round=Simulation final round
simulation_initial_round=Simulation initial round
simulation_service=Simulation service
simulation_stack=Simulation stack
sync=Sync service
workspace_service=Workspace service
@@ -0,0 +1,31 @@
R=Entorno R
ase_service=ASE
attitude=Actidud seleccionada
behavior_service=Servicio de comportamientos
birt_service=Servicio de BIRT
consensus_model_service=Servicio de modelos de consenso
gdmp_service=Servicio de GDMP
number_of_alternatives=Número de alternativas
number_of_experts=Número de expertos
number_of_criteria=Número de criterios
selected_alternative_id=Identificador de la alternativa seleccionada
selected_alternative_pos=Posición de la alternativa seleccionada
selected_behavior_id=Identificador del comportamiento seleccionado
selected_configuration=Configuración seleccionada
selected_consensus_model_id=Identificador del modelo de consenso seleccionado
selected_criterion_id=Identificador del criterio seleccionado
selected_criterion_pos=Posición del criterio seleccionado
selected_expert_id=Identificador del experto seleccionado
selected_expert_pos=Posición del experto seleccionado
selected_expert_preferences=Preferencias del experto seleccionado
selected_gdmp=GDMP seleccionado
selected_simulation=Simulación seleccionada
simulation_alternative=Alternativa seleccionada de simulación
simulation_expert=Experto seleccionado de simulación
simulation_criterion=Criterio seleccionado de simulación
simulation_final_round=Ronda final de simulación
simulation_initial_round=Ronda inicial de simulación
simulation_service=Servicio de simulación
simulation_stack=Pila de simulaciones
sync=Servicio de sincronización
workspace_service=Servicio de espacio de trabajo
@@ -0,0 +1,16 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: afryca.rcp.ase.context;singleton:=true
Bundle-Version: 1.0.0.202101221157
Bundle-Vendor: %Bundle-Vendor
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: afryca.ase,afryca.birt,afryca.simulation,afryca.workspac
e,afryca.twotuple,afryca.hpr,org.apache.commons.math3,org.eclipse.core.
runtime,org.eclipse.e4.core.services,org.eclipse.e4.core.di,org.eclipse
.e4.core.di.extensions,org.eclipse.e4.core.contexts,org.eclipse.e4.ui.d
i,org.eclipse.e4.ui.model.workbench,javax.inject
Bundle-ActivationPolicy: lazy
Service-Component: OSGI-INF/ase_context_context_function.xml
Automatic-Module-Name: afryca.rcp.ase.context
@@ -0,0 +1,31 @@
R=R engine
ase_service=ASE
attitude=Attitude
behavior_service=Behavior service
birt_service=BIRT service
consensus_model_service=Consensus model service
gdmp_service=GDMP service
number_of_alternatives=Number of alternatives
number_of_experts=Number of experts
number_of_criteria=Number of criteria
selected_alternative_id=Selected alternative id
selected_alternative_pos=Selected alternative position
selected_behavior_id=Selected behavior id
selected_configuration=Selected configuration
selected_consensus_model_id=Selected consensus model id
selected_criterion_id=Selected criterion id
selected_criterion_pos=Selected criterion position
selected_expert_id=Selected expert id
selected_expert_pos=Selected expert position
selected_expert_preferences=Selected expert preferences
selected_gdmp=Selected GDMP
selected_simulation=Selected simulation
simulation_alternative=Selected simulation alternative
simulation_expert=Selected simulation expert
simulation_criterion=Selected simulation criterion
simulation_final_round=Simulation final round
simulation_initial_round=Simulation initial round
simulation_service=Simulation service
simulation_stack=Simulation stack
sync=Sync service
workspace_service=Workspace service
@@ -0,0 +1,31 @@
R=Entorno R
ase_service=ASE
attitude=Actidud seleccionada
behavior_service=Servicio de comportamientos
birt_service=Servicio de BIRT
consensus_model_service=Servicio de modelos de consenso
gdmp_service=Servicio de GDMP
number_of_alternatives=Número de alternativas
number_of_experts=Número de expertos
number_of_criteria=Número de criterios
selected_alternative_id=Identificador de la alternativa seleccionada
selected_alternative_pos=Posición de la alternativa seleccionada
selected_behavior_id=Identificador del comportamiento seleccionado
selected_configuration=Configuración seleccionada
selected_consensus_model_id=Identificador del modelo de consenso seleccionado
selected_criterion_id=Identificador del criterio seleccionado
selected_criterion_pos=Posición del criterio seleccionado
selected_expert_id=Identificador del experto seleccionado
selected_expert_pos=Posición del experto seleccionado
selected_expert_preferences=Preferencias del experto seleccionado
selected_gdmp=GDMP seleccionado
selected_simulation=Simulación seleccionada
simulation_alternative=Alternativa seleccionada de simulación
simulation_expert=Experto seleccionado de simulación
simulation_criterion=Criterio seleccionado de simulación
simulation_final_round=Ronda final de simulación
simulation_initial_round=Ronda inicial de simulación
simulation_service=Servicio de simulación
simulation_stack=Pila de simulaciones
sync=Servicio de sincronización
workspace_service=Servicio de espacio de trabajo
@@ -0,0 +1,4 @@
#Fri Jan 22 13:02:33 CET 2021
artifact.main=C\:\\Users\\\u00C1lvaro\\Workspaces\\afryca_2020\\afryca\\plugins\\afryca.rcp.ase.context\\target\\afryca.rcp.ase.context-1.0.0-SNAPSHOT.jar
artifact.attached.p2artifacts=C\:\\Users\\\u00C1lvaro\\Workspaces\\afryca_2020\\afryca\\plugins\\afryca.rcp.ase.context\\target\\p2artifacts.xml
artifact.attached.p2metadata=C\:\\Users\\\u00C1lvaro\\Workspaces\\afryca_2020\\afryca\\plugins\\afryca.rcp.ase.context\\target\\p2content.xml
@@ -0,0 +1,3 @@
artifactId=afryca.rcp.ase.context
groupId=afryca.group
version=1.0.0-SNAPSHOT
@@ -0,0 +1,13 @@
<?xml version='1.0' encoding='UTF-8'?>
<?artifactRepository version='1.1.0'?>
<artifacts size='1'>
<artifact classifier='osgi.bundle' id='afryca.rcp.ase.context' version='1.0.0.202101221157'>
<properties size='5'>
<property name='artifact.size' value='19412'/>
<property name='download.size' value='19412'/>
<property name='maven-groupId' value='afryca.group'/>
<property name='maven-artifactId' value='afryca.rcp.ase.context'/>
<property name='maven-version' value='1.0.0-SNAPSHOT'/>
</properties>
</artifact>
</artifacts>
@@ -0,0 +1,62 @@
<?xml version='1.0' encoding='UTF-8'?>
<units size='1'>
<unit id='afryca.rcp.ase.context' version='1.0.0.202101221157' generation='2'>
<update id='afryca.rcp.ase.context' range='[0.0.0,1.0.0.202101221157)' severity='0'/>
<properties size='9'>
<property name='es.Bundle-Name' value='Contexto de ASE'/>
<property name='es.Bundle-Vendor' value='Sinbad²'/>
<property name='df_LT.Bundle-Name' value='ASE Context'/>
<property name='df_LT.Bundle-Vendor' value='Sinbad²'/>
<property name='org.eclipse.equinox.p2.name' value='%Bundle-Name'/>
<property name='org.eclipse.equinox.p2.provider' value='%Bundle-Vendor'/>
<property name='maven-groupId' value='afryca.group'/>
<property name='maven-artifactId' value='afryca.rcp.ase.context'/>
<property name='maven-version' value='1.0.0-SNAPSHOT'/>
</properties>
<provides size='6'>
<provided namespace='org.eclipse.equinox.p2.iu' name='afryca.rcp.ase.context' version='1.0.0.202101221157'/>
<provided namespace='osgi.bundle' name='afryca.rcp.ase.context' version='1.0.0.202101221157'/>
<provided namespace='osgi.identity' name='afryca.rcp.ase.context' version='1.0.0.202101221157'>
<properties size='1'>
<property name='type' value='osgi.bundle'/>
</properties>
</provided>
<provided namespace='org.eclipse.equinox.p2.eclipse.type' name='bundle' version='1.0.0'/>
<provided namespace='org.eclipse.equinox.p2.localization' name='es' version='1.0.0'/>
<provided namespace='org.eclipse.equinox.p2.localization' name='df_LT' version='1.0.0'/>
</provides>
<requires size='16'>
<required namespace='osgi.bundle' name='afryca.ase' range='0.0.0'/>
<required namespace='osgi.bundle' name='afryca.birt' range='0.0.0'/>
<required namespace='osgi.bundle' name='afryca.simulation' range='0.0.0'/>
<required namespace='osgi.bundle' name='afryca.workspace' range='0.0.0'/>
<required namespace='osgi.bundle' name='afryca.twotuple' range='0.0.0'/>
<required namespace='osgi.bundle' name='afryca.hpr' range='0.0.0'/>
<required namespace='osgi.bundle' name='org.apache.commons.math3' range='0.0.0'/>
<required namespace='osgi.bundle' name='org.eclipse.core.runtime' range='0.0.0'/>
<required namespace='osgi.bundle' name='org.eclipse.e4.core.services' range='0.0.0'/>
<required namespace='osgi.bundle' name='org.eclipse.e4.core.di' range='0.0.0'/>
<required namespace='osgi.bundle' name='org.eclipse.e4.core.di.extensions' range='0.0.0'/>
<required namespace='osgi.bundle' name='org.eclipse.e4.core.contexts' range='0.0.0'/>
<required namespace='osgi.bundle' name='org.eclipse.e4.ui.di' range='0.0.0'/>
<required namespace='osgi.bundle' name='org.eclipse.e4.ui.model.workbench' range='0.0.0'/>
<required namespace='osgi.bundle' name='javax.inject' range='0.0.0'/>
<requiredProperties namespace='osgi.ee' match='(&amp;(osgi.ee=JavaSE)(version=1.8))'>
<description>
afryca.rcp.ase.context
</description>
</requiredProperties>
</requires>
<artifacts size='1'>
<artifact classifier='osgi.bundle' id='afryca.rcp.ase.context' version='1.0.0.202101221157'/>
</artifacts>
<touchpoint id='org.eclipse.equinox.p2.osgi' version='1.0.0'/>
<touchpointData size='1'>
<instructions size='1'>
<instruction key='manifest'>
Bundle-SymbolicName: afryca.rcp.ase.context;singleton:=true&#xA;Bundle-Version: 1.0.0.202101221157&#xA;
</instruction>
</instructions>
</touchpointData>
</unit>
</units>