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.domain.fuzzyset.unbalanced.ui.chart</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<name>[bundle] Chart</name>
</project>
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>flintstones.domain.fuzzyset.unbalanced.ui.chart</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>1779484362542</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,18 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Chart
Bundle-SymbolicName: flintstones.domain.fuzzyset.unbalanced.ui.chart
Bundle-Version: 1.0.0.qualifier
Automatic-Module-Name: flintstones.domain.fuzzyset.unbalanced.ui.chart
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: flintstones.domain.fuzzyset.ui.chart,
org.eclipse.swt,
flintstones.domain.fuzzyset.unbalanced,
flintstones.model.domain.ui.service,
javax.inject,
org.eclipse.e4.core.contexts,
org.eclipse.e4.core.di,
flintstones.entity.domain,
flintstones.domain.numeric.real,
org.jfree.chart.jfreechart
Export-Package: flintstones.domain.fuzzyset.unbalanced.ui.chart
@@ -0,0 +1,4 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.
@@ -0,0 +1,262 @@
package flintstones.domain.fuzzyset.unbalanced.ui.chart;
import java.util.Map;
import javax.inject.Inject;
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import flintstones.domain.fuzzyset.FuzzySet;
import flintstones.domain.fuzzyset.ui.chart.PlainFuzzySetChart;
import flintstones.domain.fuzzyset.unbalanced.Unbalanced;
import flintstones.domain.numeric.real.NumericRealDomain;
import flintstones.model.domain.ui.service.IDomainUIService;
@SuppressWarnings("javadoc")
public class LHChart {
public PlainFuzzySetChart[] _charts;
private int[] _lh;
private Composite _composite;
private Unbalanced _domain;
@Inject
IDomainUIService uiDomainService;
@Inject
IEclipseContext context;
/*
private LHChart() {
this._charts = null;
this._domain = null;
}
*/
public LHChart() {
this._charts = null;
this._domain = null;
}
public void initLHChart(int[] lh, Composite composite, int width, int height) {
// this();
this._lh = lh;
this._charts = new PlainFuzzySetChart[this._lh.length];
this._composite = composite;
for (Control control : this._composite.getChildren())
control.dispose();
RowLayout layout = new RowLayout(SWT.VERTICAL);
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.marginBottom = 0;
layout.marginTop = 0;
layout.marginRight = 0;
layout.marginLeft = 0;
layout.spacing = 0;
this._composite.setLayout(layout);
Composite auxComposite;
int sumHeight = 0;
int auxHeight = (height / this._lh.length) + 1;
for (int i = 0; i < this._lh.length; i++) {
sumHeight += auxHeight;
while (sumHeight > height) {
sumHeight--;
auxHeight--;
}
auxComposite = new Composite(composite, SWT.NONE);
PlainFuzzySetChart chart = ContextInjectionFactory.make(PlainFuzzySetChart.class, this.context);
// PlainFuzzySetChart chart = new PlainFuzzySetChart();
chart.initialize(this.createDomain(this._lh[i]), auxComposite, width, auxHeight, SWT.NONE, 0, 0, 125, false);
this._charts[i] = chart;
}
}
public void initLHChart(int[] lh, Composite composite, int width, int height, Unbalanced domain) {
// this();
this._lh = lh;
int size = this._lh.length;
this._charts = new PlainFuzzySetChart[size + 1];
this._domain = domain;
this._composite = composite;
for (Control control : this._composite.getChildren())
control.dispose();
RowLayout layout = new RowLayout(SWT.VERTICAL);
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.marginBottom = 0;
layout.marginTop = 0;
layout.marginRight = 0;
layout.marginLeft = 0;
layout.spacing = 0;
this._composite.setLayout(layout);
Composite auxComposite;
int sumHeight = 0;
int auxHeight = (height / (size + 1)) + 1;
for (int i = 0; i < size; i++) {
sumHeight += auxHeight;
auxComposite = new Composite(composite, SWT.NONE);
PlainFuzzySetChart chart = ContextInjectionFactory.make(PlainFuzzySetChart.class, context);
chart.initialize(this.createDomain(this._lh[i]), auxComposite, width, auxHeight, SWT.NONE, 0, 0, 125, true);
this._charts[i] = chart;
}
sumHeight += auxHeight;
while (sumHeight > height) {
sumHeight--;
auxHeight--;
}
auxComposite = new Composite(composite, SWT.NONE);
PlainFuzzySetChart chart = ContextInjectionFactory.make(PlainFuzzySetChart.class, context);
chart.initialize(domain, auxComposite, width, auxHeight, SWT.NONE, false);
this._charts[size] = chart;
this.clearCharts();
}
private void clearCharts() {
for (PlainFuzzySetChart chart : this._charts)
chart.refreshChart();
boolean find;
int j;
NumericRealDomain center;
NumericRealDomain coverage;
double left;
double right;
int other;
int otherPos;
Map<Integer, Map<Integer, Integer>> labels = this._domain.getLabels();
for (Integer pos : labels.keySet()) {
Map<Integer, Integer> values = labels.get(pos);
other = -1;
otherPos = -1;
for (Integer lhDomain : values.keySet()) {
find = false;
j = 0;
do
if (this._lh[j] == lhDomain)
find = true;
else
j++;
while (!find);
if (values.size() == 1)
this._charts[j].setPosColor(values.get(lhDomain), PlainFuzzySetChart.getColor(pos));
else if (other != -1) {
center = ((FuzzySet) this._domain).getLabelSet()
.getLabel(pos)
.getSemantic()
.getCenter();
coverage = ((FuzzySet) this._domain).getLabelSet()
.getLabel(pos)
.getSemantic()
.getCoverage();
left = center.getMin() - coverage.getMin();
right = coverage.getMax() - center.getMax();
if (((left > right) && (other < lhDomain)) || ((left < right) && (other > lhDomain))) {
this._charts[otherPos].setPosLeftColor(values.get(other), PlainFuzzySetChart.getColor(pos));
this._charts[j].setPosRightColor(values.get(lhDomain), PlainFuzzySetChart.getColor(pos));
} else {
this._charts[j].setPosLeftColor(values.get(lhDomain), PlainFuzzySetChart.getColor(pos));
this._charts[otherPos].setPosRightColor(values.get(other), PlainFuzzySetChart.getColor(pos));
}
}
if (other == -1) {
other = lhDomain;
otherPos = j;
}
}
}
}
private Unbalanced createDomain(int cardinality) {
Unbalanced domain = ContextInjectionFactory.make(Unbalanced.class, this.context);
String[] labels = new String[cardinality];
for (int i = 0; i < cardinality; i++)
labels[i] = Integer.toString(i);
domain.createTrapezoidalFunction(labels);
return domain;
}
public void dispose() {
if (this._charts != null)
for (PlainFuzzySetChart chart : this._charts)
chart.getChartComposite()
.dispose();
}
public void select(int pos) {
this.clearCharts();
this._charts[this._lh.length].select(pos);
Map<Integer, Integer> values = this._domain.getLabels()
.get(pos);
int other = -1;
int otherPos = -1;
boolean find;
int j;
NumericRealDomain center;
NumericRealDomain coverage;
for (Integer lhDomain : values.keySet()) {
find = false;
j = 0;
do
if (this._lh[j] == lhDomain)
find = true;
else
j++;
while (!find);
if (values.size() == 1)
this._charts[j].select(values.get(lhDomain));
else if (other != -1) {
center = ((FuzzySet) this._domain).getLabelSet()
.getLabel(pos)
.getSemantic()
.getCenter();
coverage = ((FuzzySet) this._domain).getLabelSet()
.getLabel(pos)
.getSemantic()
.getCoverage();
double left = center.getMin() - coverage.getMin();
double right = coverage.getMax() - center.getMax();
if (((left > right) && (other < lhDomain)) || ((left < right) && (other > lhDomain))) {
this._charts[otherPos].selectLeft(values.get(other));
this._charts[j].selectRight(values.get(lhDomain));
} else {
this._charts[j].selectLeft(values.get(lhDomain));
this._charts[otherPos].selectRight(values.get(other));
}
}
if (other == -1) {
other = lhDomain;
otherPos = j;
}
}
}
}