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.entity.valuation</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
<name>[bundle] Valuation</name>
|
||||
</project>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>flintstones.entity.valuation</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>1779484362591</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,15 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Valuation
|
||||
Bundle-SymbolicName: flintstones.entity.valuation;singleton:=true
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Automatic-Module-Name: flintstones.entity.valuation
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Export-Package: flintstones.entity.valuation,
|
||||
flintstones.entity.valuation.exception,
|
||||
flintstones.entity.valuation.messages
|
||||
Require-Bundle: flintstones.entity.domain;visibility:=reexport,
|
||||
flintstones.helper.data.wxml;visibility:=reexport,
|
||||
flintstones.entity.extensionenum,
|
||||
javax.inject,
|
||||
org.eclipse.e4.core.services
|
||||
@@ -0,0 +1,5 @@
|
||||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
plugin.xml
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE xml>
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension-point id="flintstones.valuation" name="Valuation" schema="schema/flintstones.valuation.exsd"/>
|
||||
</plugin>
|
||||
@@ -0,0 +1,148 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="flintstones.valuation" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.schema plugin="flintstones.valuation" id="flintstones.valuation" name="Valuation"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
Este punto de extensión permite definir nuevos tipos de evaluaciones, los cuales estarán enlazados con un dominio concreto.
|
||||
|
||||
Si revisamos la definición del punto de extensión de dominio, vemos que es posible crear distintos dominios que compartan implementación. Esto nos permite definir distintos tipos de evaluaciones para cada uno de los distintos dominios definidos. Se compartiría la implementación del dominio pero no la implementación de la evaluación.
|
||||
|
||||
Por ejemplo un dominio numérico entero se evalúa de forma distinta a uno numérico entero intervalar pero la definición de dominio es la misma.
|
||||
|
||||
==============================================================================================================================================
|
||||
|
||||
This extension point allows you to define new types of evaluations, which will be linked to a specific domain.
|
||||
|
||||
If we review the definition of the domain extension point, we see that it is possible to create different domains that share implementation. This allows us to define different types of evaluations for each of the different domains defined. The implementation of the domain would be shared but not the implementation of the evaluation.
|
||||
|
||||
For example, an integer domain is evaluated differently than an interval integer domain but the domain definition is the same.
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<element name="extension">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.element />
|
||||
</appinfo>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<choice minOccurs="1" maxOccurs="unbounded">
|
||||
<element ref="valuation"/>
|
||||
</choice>
|
||||
<attribute name="point" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="xid" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="name" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute translatable="true"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="valuation">
|
||||
<complexType>
|
||||
<attribute name="uid" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="name" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute translatable="true"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="domain" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute kind="identifier" basedOn="flintstones.entity.domain/domain/@uid"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="implementation" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute kind="java" basedOn="flintstones.entity.valuation.Valuation:"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="is_intermediate" type="boolean" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="since"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter the first release in which this extension point appears.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="examples"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter extension point usage example here.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="apiinfo"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter API information here.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="implementation"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter information about supplied implementation of this extension point.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
|
||||
</schema>
|
||||
@@ -0,0 +1,220 @@
|
||||
package flintstones.entity.valuation;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
import javax.xml.stream.XMLStreamWriter;
|
||||
|
||||
import org.eclipse.e4.core.services.nls.Translation;
|
||||
|
||||
import flintstones.entity.domain.Domain;
|
||||
import flintstones.entity.extensionenum.ExtensionEnum;
|
||||
import flintstones.entity.valuation.exception.InvalidValueException;
|
||||
import flintstones.entity.valuation.messages.Messages;
|
||||
import flintstones.helper.data.wxml.WNode;
|
||||
|
||||
/**
|
||||
* The Class Valuation.
|
||||
*/
|
||||
public abstract class Valuation implements Cloneable, Comparable<Valuation> {
|
||||
|
||||
/** The messages. */
|
||||
@Inject
|
||||
@Translation
|
||||
private Messages messages;
|
||||
|
||||
/** The domain. */
|
||||
protected Domain domain;
|
||||
|
||||
/** The id. */
|
||||
private String id;
|
||||
|
||||
/** The name. */
|
||||
private String name;
|
||||
|
||||
/** The evaluated. */
|
||||
private boolean evaluated = false;
|
||||
|
||||
/** The Constant EXTENSION_POINT. */
|
||||
public static String EXTENSION_POINT = "flintstones.valuation"; //$NON-NLS-1$
|
||||
|
||||
/** The image. */
|
||||
public static String IMAGE = "valuation.png";; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* The Enum Fields.
|
||||
*/
|
||||
public enum Fields implements ExtensionEnum {
|
||||
|
||||
/** The Valuation. */
|
||||
Valuation,
|
||||
/** The id. */
|
||||
uid,
|
||||
/** The name. */
|
||||
name,
|
||||
/** The implementation. */
|
||||
implementation,
|
||||
/** The domain. */
|
||||
domain,
|
||||
/** The type. */
|
||||
type,
|
||||
/** The is intermediate. */
|
||||
is_intermediate,
|
||||
/** The Valuations. */
|
||||
Valuations,
|
||||
/** The alternative. */
|
||||
alternative,
|
||||
/** The criterion. */
|
||||
criterion,
|
||||
/** The expert. */
|
||||
expert;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new valuation.
|
||||
*/
|
||||
public Valuation() {
|
||||
this.domain = null;
|
||||
this.id = null;
|
||||
this.name = null;
|
||||
}
|
||||
|
||||
public void setValueFromString(String value) {
|
||||
|
||||
if(value == null)
|
||||
throw new InvalidValueException("Debes rellenar el valor. ");
|
||||
|
||||
if(domain == null)
|
||||
throw new InvalidValueException("Debes asignar un dominio antes de evaluar. ");
|
||||
|
||||
initFromString(value);
|
||||
}
|
||||
|
||||
protected abstract void initFromString(String value);
|
||||
|
||||
/**
|
||||
* Sets the id.
|
||||
*
|
||||
* @param id the new id
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the id.
|
||||
*
|
||||
* @return the id
|
||||
*/
|
||||
public String getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name.
|
||||
*
|
||||
* @param name the new name
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the domain.
|
||||
*
|
||||
* @param domain the new domain
|
||||
*/
|
||||
public void setDomain(Domain domain) {
|
||||
this.domain = domain;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the domain.
|
||||
*
|
||||
* @return the domain
|
||||
*/
|
||||
public Domain getDomain() {
|
||||
return this.domain;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#clone() */
|
||||
@Override
|
||||
public Object clone() {
|
||||
// throw new RuntimeException("No se puede clonar así");
|
||||
|
||||
Valuation result = null;
|
||||
|
||||
try {
|
||||
result = (Valuation) super.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
||||
if(domain != null) {
|
||||
result.domain = (Domain) domain.clone();
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Negate valuation.
|
||||
*
|
||||
* @return the valuation
|
||||
*/
|
||||
public abstract Valuation negateValuation();
|
||||
|
||||
/**
|
||||
* Change format valuation to string.
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
public abstract String changeFormatValuationToString();
|
||||
|
||||
/**
|
||||
* Checks if is evaluated.
|
||||
*
|
||||
* @return true, if is evaluated
|
||||
*/
|
||||
public boolean isEvaluated() {
|
||||
return this.evaluated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the evaluated.
|
||||
*
|
||||
* @param status the new evaluated
|
||||
*/
|
||||
public void setEvaluated(boolean status) {
|
||||
this.evaluated = status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write.
|
||||
*
|
||||
* @param writer the writer
|
||||
* @throws XMLStreamException the XML stream exception
|
||||
*/
|
||||
public abstract void write(XMLStreamWriter writer) throws XMLStreamException;
|
||||
|
||||
/**
|
||||
* Read.
|
||||
*
|
||||
* @param node the node
|
||||
*/
|
||||
public abstract void read(WNode node);
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package flintstones.entity.valuation.exception;
|
||||
|
||||
public class InvalidValueException extends RuntimeException {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -2367035980186200517L;
|
||||
|
||||
public InvalidValueException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// This file has been auto-generated
|
||||
package flintstones.entity.valuation.messages;
|
||||
|
||||
import org.eclipse.e4.core.services.nls.Message;
|
||||
|
||||
@Message
|
||||
@SuppressWarnings({ "javadoc", "nls" })
|
||||
public class Messages {
|
||||
|
||||
public String Valuation_entity = "Valuation";
|
||||
public String Valuation_image = "valuation.png";
|
||||
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
Valuation_entity=valuation
|
||||
Valuation_extension=flintstones.valuation
|
||||
Valuation_image=valuation.png
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
Valuation_entity=Evaluación
|
||||
Valuation_extension=flintstones.valuation
|
||||
Valuation_image=valuation.png
|
||||
Reference in New Issue
Block a user