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 @@
<?flintstones.helper.data.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,17 @@
<?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.valuation.numeric.integer</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<name>[bundle] Integer</name>
<organization>
<name>Sinbad2</name>
</organization>
</project>
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>flintstones.valuation.numeric.integer</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>1779484362748</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,22 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Integer
Bundle-SymbolicName: flintstones.valuation.numeric.integer;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: Sinbad2
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: flintstones.valuation;visibility:=reexport,
flintstones.valuation.numeric;visibility:=reexport,
flintstones.domain.numeric.integer;visibility:=reexport,
flintstones.domain.fuzzyset,
flintstones.domain.numeric.real,
flintstones.valuation.numeric.real,
flintstones.helper.data.wxml,
flintstones.model.domain.service,
javax.inject,
flintstones.entity.domain,
org.apache.commons.lang,
flintstones.model.valuation.service,
flintstones.entity.valuation
Automatic-Module-Name: flintstones.valuation.integer
Export-Package: flintstones.valuation.numeric.integer
@@ -0,0 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
<?eclipse version="3.4"?>
<plugin>
<extension
point="flintstones.valuation">
<valuation
domain="flintstones.domain.numeric.integer"
uid="flintstones.valuation.integer"
implementation="flintstones.valuation.numeric.integer.IntegerValuation"
is_intermediate="false"
name="Integer">
</valuation>
</extension>
</plugin>
@@ -0,0 +1,218 @@
package flintstones.valuation.numeric.integer;
import javax.inject.Inject;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.eclipse.e4.core.services.nls.Translation;
import flintstones.domain.numeric.NumericDomain;
import flintstones.domain.numeric.integer.NumericIntegerDomain;
import flintstones.domain.numeric.real.NumericRealDomain;
import flintstones.entity.extensionenum.ExtensionEnum;
import flintstones.entity.valuation.Valuation;
import flintstones.entity.valuation.exception.InvalidValueException;
import flintstones.helper.data.wxml.WNode;
import flintstones.helper.validator.Validator;
import flintstones.model.domain.service.IDomainService;
import flintstones.model.valuation.service.IValuationService;
import flintstones.valuation.numeric.NumericValuation;
import flintstones.valuation.numeric.integer.messages.Messages;
/**
* The Class IntegerValuation.
*/
public class IntegerValuation extends NumericValuation {
@Inject
IDomainService domainService;
@Inject
IValuationService valuationService;
@Inject
@Translation
private Messages messages;
/** The Constant ID. */
public static final String ID = "flintstones.valuation.integer"; //$NON-NLS-1$
/**
* The Enum Fields.
*/
public enum Fields implements ExtensionEnum {
/** The value. */
value
}
/**
* Instantiates a new integer valuation.
*/
public IntegerValuation() {
super();
this.value = 0;
setId(ID);
}
@Override
public void initFromString(String value) throws InvalidValueException {
int iValue;
try{
iValue = Integer.parseInt(value);
} catch(NumberFormatException e) {
throw new InvalidValueException("Value is not integer " + value );
}
setValue(iValue);
}
@Override
public double getValue() {
return this.value;
}
/**
* Sets the value.
*
* @param value the new value
*/
@Override
public void setValue(double value) throws InvalidValueException {
if ((value != Math.floor(value)))
throw new InvalidValueException("Value is not integer " + value);
super.setValue(value);
}
/* (non-Javadoc)
*
* @see flintstones.valuation.Valuation#negateValuation() */
@Override
public Valuation negateValuation() {
IntegerValuation result = (IntegerValuation) this.clone();
long aux = Math.round(((NumericIntegerDomain) (NumericDomain) this.domain).getMin()) + Math.round(((NumericIntegerDomain) this.domain).getMax());
result.setValue(aux - this.value);
return result;
}
/* (non-Javadoc)
*
* @see java.lang.Object#toString() */
@Override
public String toString() {
return ("Integer(" + this.value + ") in" + this.domain.toString()); //$NON-NLS-1$ //$NON-NLS-2$
}
/* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object) */
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj.getClass() != this.getClass())
return false;
final IntegerValuation other = (IntegerValuation) obj;
EqualsBuilder eb = new EqualsBuilder();
eb.append(this.value, other.value);
eb.append(this.domain, other.domain);
return eb.isEquals();
}
/* (non-Javadoc)
*
* @see java.lang.Object#hashCode() */
@Override
public int hashCode() {
HashCodeBuilder hcb = new HashCodeBuilder(17, 31);
hcb.append(this.value);
hcb.append(this.domain);
return hcb.toHashCode();
}
/* (non-Javadoc)
*
* @see java.lang.Comparable#compareTo(java.lang.Object) */
@Override
public int compareTo(Valuation other) {
Validator.notNull(other);
if (this.domain.equals(other.getDomain()))
return Double.valueOf(this.value)
.compareTo(Double.valueOf(((IntegerValuation) other).value));
return 0;
}
/* (non-Javadoc)
*
* @see flintstones.valuation.Valuation#clone() */
@Override
public Object clone() {
IntegerValuation result = null;
result = (IntegerValuation) super.clone();
result.value = Double.valueOf(this.value);
return result;
}
/* (non-Javadoc)
*
* @see flintstones.valuation.Valuation#changeFormatValuationToString() */
@Override
public String changeFormatValuationToString() {
return Double.toString(this.value);
}
/* (non-Javadoc)
*
* @see
* flintstones.valuation.Valuation#write(javax.xml.stream.XMLStreamWriter) */
@Override
public void write(XMLStreamWriter writer) throws XMLStreamException {
writer.writeAttribute(Fields.value.toString(), Double.toString(this.value));
}
/* (non-Javadoc)
*
* @see flintstones.valuation.Valuation#read(flintstones.helper.wxml.WNode) */
@Override
public void read(WNode node) {
this.value = Double.parseDouble(node.getAttribute(Fields.value));
}
@Override
public NumericValuation cloneToNormalize() {
NumericValuation anyValuation = this;
NumericDomain anyDomain = (NumericDomain) anyValuation.getDomain();
NumericRealDomain newDomain = (NumericRealDomain) domainService.create(NumericRealDomain.ID);
newDomain.setInRange( anyDomain.isInRange() );
newDomain.setMax( anyDomain.getMax() );
newDomain.setMin( anyDomain.getMin() );
NumericValuation newValuation = (NumericValuation) valuationService.create(newDomain);
newValuation.setEvaluated( this.isEvaluated() );
return newValuation;
}
}
@@ -0,0 +1,12 @@
// This file has been auto-generated
package flintstones.valuation.numeric.integer.messages;
import org.eclipse.e4.core.services.nls.Message;
@Message
@SuppressWarnings("javadoc")
public class Messages {
public String Not_BLTS_fuzzy_set;
}
@@ -0,0 +1 @@
Not_BLTS_fuzzy_set=Not BLTS fuzzy set
@@ -0,0 +1 @@
Not_BLTS_fuzzy_set=No BLTS fuzzy establecido