public code v1
This commit is contained in:
@@ -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.real</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
<name>[bundle] Real</name>
|
||||
<organization>
|
||||
<name>Sinbad2</name>
|
||||
</organization>
|
||||
</project>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>flintstones.valuation.numeric.real</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>1779484362750</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: Real
|
||||
Bundle-SymbolicName: flintstones.valuation.numeric.real;singleton:=true
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-Vendor: Sinbad2
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Require-Bundle: flintstones.entity.valuation,
|
||||
flintstones.model.valuation.service,
|
||||
flintstones.valuation.numeric;visibility:=reexport,
|
||||
flintstones.domain.fuzzyset,
|
||||
flintstones.domain.numeric,
|
||||
flintstones.domain.numeric.real,
|
||||
flintstones.helper.data.wxml,
|
||||
flintstones.model.domain.service,
|
||||
javax.inject,
|
||||
org.apache.commons.lang,
|
||||
flintstones.entity.domain,
|
||||
flintstones.valuation,
|
||||
flintstones.helper.data
|
||||
Export-Package: flintstones.valuation.numeric.real
|
||||
Automatic-Module-Name: flintstones.valuation.real
|
||||
@@ -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.real"
|
||||
uid="flintstones.valuation.real"
|
||||
implementation="flintstones.valuation.numeric.real.RealValuation"
|
||||
is_intermediate="false"
|
||||
name="Real">
|
||||
</valuation>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
+173
@@ -0,0 +1,173 @@
|
||||
package flintstones.valuation.numeric.real;
|
||||
|
||||
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.real.NumericRealDomain;
|
||||
import flintstones.entity.extensionenum.ExtensionEnum;
|
||||
import flintstones.entity.valuation.Valuation;
|
||||
import flintstones.entity.valuation.exception.InvalidValueException;
|
||||
import flintstones.helper.DoubleHelper;
|
||||
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.real.messages.Messages;
|
||||
|
||||
@SuppressWarnings("javadoc")
|
||||
public class RealValuation extends NumericValuation {
|
||||
|
||||
@Inject
|
||||
@Translation
|
||||
private Messages messages;
|
||||
|
||||
@Inject
|
||||
IDomainService domainService;
|
||||
|
||||
@Inject
|
||||
IValuationService valuationService;
|
||||
|
||||
public static final String ID = "flintstones.valuation.real"; //$NON-NLS-1$
|
||||
|
||||
public enum Fields implements ExtensionEnum {
|
||||
value
|
||||
}
|
||||
|
||||
public RealValuation() {
|
||||
super();
|
||||
this.value = 0;
|
||||
this.setId(ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initFromString(String value) {
|
||||
|
||||
double dValue = 0;
|
||||
boolean error = false;
|
||||
try {
|
||||
dValue = DoubleHelper.ParseDouble(value);
|
||||
} catch (NumberFormatException e) {
|
||||
error = true;
|
||||
throw new InvalidValueException("El valor " + value + " no es un Real válido.");
|
||||
}
|
||||
|
||||
if (!error)
|
||||
setValue(dValue);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(double value) {
|
||||
super.setValue(value);
|
||||
}
|
||||
|
||||
public double getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Valuation negateValuation() {
|
||||
RealValuation result = (RealValuation) this.clone();
|
||||
double aux = ((NumericRealDomain) (NumericDomain) this.domain).getMin()
|
||||
+ ((NumericRealDomain) (NumericDomain) this.domain).getMax();
|
||||
|
||||
result.setValue(aux - this.value);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String domainS = domain != null ? " in " + domain.toString() : "";
|
||||
return "(Real(" + this.value + ")" + domainS; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
|
||||
if (this == obj)
|
||||
return true;
|
||||
|
||||
if (obj == null)
|
||||
return false;
|
||||
|
||||
if (obj.getClass() != this.getClass())
|
||||
return false;
|
||||
|
||||
final RealValuation other = (RealValuation) obj;
|
||||
|
||||
EqualsBuilder eb = new EqualsBuilder();
|
||||
eb.append(this.value, other.value);
|
||||
eb.append(this.domain, other.domain);
|
||||
|
||||
return eb.isEquals();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
HashCodeBuilder hcb = new HashCodeBuilder(17, 31);
|
||||
hcb.append(this.value);
|
||||
hcb.append(this.domain);
|
||||
return hcb.toHashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Valuation other) {
|
||||
Validator.notNull(other);
|
||||
// Validator.notIllegalElementType(other, new String[] { Integer.class.toString() });
|
||||
|
||||
if (this.domain.equals(other.getDomain()))
|
||||
return Double.compare(this.value, ((RealValuation) other).value);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() {
|
||||
RealValuation result = null;
|
||||
result = (RealValuation) super.clone();
|
||||
result.value = Double.valueOf(this.value);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String changeFormatValuationToString() {
|
||||
return Double.toString(this.value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(XMLStreamWriter writer) throws XMLStreamException {
|
||||
writer.writeAttribute(Fields.value.toString(), Double.toString(this.value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(WNode node) {
|
||||
this.value = Double.parseDouble(node.getAttribute(Fields.value.toString()));
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// This file has been auto-generated
|
||||
package flintstones.valuation.numeric.real.messages;
|
||||
|
||||
import org.eclipse.e4.core.services.nls.Message;
|
||||
|
||||
@Message
|
||||
@SuppressWarnings("javadoc")
|
||||
public class Messages {
|
||||
|
||||
public String Not_BLTS_fuzzy_set;
|
||||
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
Not_BLTS_fuzzy_set=Not BLTS fuzzy set.
|
||||
+1
@@ -0,0 +1 @@
|
||||
Not_BLTS_fuzzy_set=No BLTS fuzzy establecido.
|
||||
Reference in New Issue
Block a user