public code v1
This commit is contained in:
@@ -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.valuation.numeric</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
<name>[bundle] Numeric</name>
|
||||
</project>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>flintstones.valuation.numeric</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>1779484362747</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,14 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Numeric
|
||||
Bundle-SymbolicName: flintstones.valuation.numeric
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Automatic-Module-Name: flintstones.valuation.numeric
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Require-Bundle: flintstones.entity.valuation,
|
||||
flintstones.model.valuation.service,
|
||||
flintstones.domain.fuzzyset,
|
||||
flintstones.domain.numeric,
|
||||
flintstones.entity.domain,
|
||||
flintstones.valuation
|
||||
Export-Package: flintstones.valuation.numeric
|
||||
@@ -0,0 +1,4 @@
|
||||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
package flintstones.valuation.numeric;
|
||||
|
||||
import flintstones.helper.validator.Validator;
|
||||
|
||||
public abstract class NumericIntervalarValuation extends NumericValuation {
|
||||
|
||||
/** The min value. */
|
||||
public double _min;
|
||||
|
||||
/** The max value. */
|
||||
public double _max;
|
||||
|
||||
/**
|
||||
* Sets the min.
|
||||
*
|
||||
* @param min the new min
|
||||
*/
|
||||
public void setMin(double min) {
|
||||
this._min = min;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the min.
|
||||
*
|
||||
* @return the min
|
||||
*/
|
||||
public double getMin() {
|
||||
return this._min;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the max.
|
||||
*
|
||||
* @param max the new max
|
||||
*/
|
||||
public void setMax(double max) {
|
||||
this._max = max;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the max.
|
||||
*
|
||||
* @return the max
|
||||
*/
|
||||
public double getMax() {
|
||||
return this._max;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the min max.
|
||||
*
|
||||
* @param min the min
|
||||
* @param max the max
|
||||
*/
|
||||
public void setMinMax(Double min, Double max) {
|
||||
Validator.notNull(this.domain);
|
||||
Validator.notDisorder(new double[] { min, max }, false);
|
||||
|
||||
this._min = min;
|
||||
this._max = max;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public NumericValuation cloneToNormalize() {
|
||||
throw new Error("Interval valuation is not normalized");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
package flintstones.valuation.numeric;
|
||||
|
||||
import flintstones.domain.numeric.NumericDomain;
|
||||
import flintstones.entity.valuation.Valuation;
|
||||
import flintstones.entity.valuation.exception.InvalidValueException;
|
||||
import flintstones.helper.validator.Validator;
|
||||
|
||||
/**
|
||||
* The Class NumericValuation.
|
||||
*/
|
||||
public abstract class NumericValuation extends Valuation {
|
||||
|
||||
/** The value. */
|
||||
protected double value;
|
||||
|
||||
/**
|
||||
* Normalized.
|
||||
*
|
||||
* @return the valuation
|
||||
*/
|
||||
public Valuation normalized() {
|
||||
NumericValuation result = (NumericValuation) this.clone();
|
||||
double min, max, intervalSize;
|
||||
|
||||
min = ((NumericDomain) this.domain).getMin();
|
||||
max = ((NumericDomain) this.domain).getMax();
|
||||
intervalSize = max - min;
|
||||
|
||||
((NumericDomain) result.domain).setMinMax(0d, 1d);
|
||||
result.value = (this.value - min) / intervalSize;
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value.
|
||||
*
|
||||
* @return the value
|
||||
*/
|
||||
public double getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setValue(double value) {
|
||||
// 1 Check domain
|
||||
if(domain == null)
|
||||
throw new InvalidValueException("No exíste un dominio asignado");
|
||||
|
||||
NumericDomain cDomain = (NumericDomain) this.domain;
|
||||
if (cDomain.getInRange()) {
|
||||
|
||||
double min = cDomain.getMin();
|
||||
double max = cDomain.getMax();
|
||||
boolean inRange = Validator.inRange(value, min, max);
|
||||
|
||||
// 2.Check range
|
||||
if(!inRange)
|
||||
throw new InvalidValueException("El valor " + value + " no se encuentra en el rango correcto " + min + "," + max);
|
||||
|
||||
this.value = value;
|
||||
|
||||
} else {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Clone to normalize.
|
||||
*
|
||||
* @return the numeric valuation
|
||||
*/
|
||||
// This let us use Integer Valuation as Real in a copy. The domain is also patched into a real one.
|
||||
public abstract NumericValuation cloneToNormalize();
|
||||
}
|
||||
Reference in New Issue
Block a user