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.operator</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
<name>[bundle] Operator</name>
|
||||
</project>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>flintstones.entity.operator</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>1779484362571</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: Operator
|
||||
Bundle-SymbolicName: flintstones.entity.operator
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Automatic-Module-Name: flintstones.entity.operator
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Export-Package: flintstones.entity.operator,
|
||||
flintstones.entity.operator.interfaces
|
||||
Require-Bundle: flintstones.entity.extensionenum,
|
||||
flintstones.entity.valuation,
|
||||
flintstones.entity.wvaluation,
|
||||
flintstones.domain.fuzzyset,
|
||||
flintstones.entity.problemelement,
|
||||
org.eclipse.jface
|
||||
@@ -0,0 +1,4 @@
|
||||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package flintstones.entity.operator;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import flintstones.domain.fuzzyset.function.types.TrapezoidalFunction;
|
||||
import flintstones.entity.operator.interfaces.IFuzzyWeightedAggregationOperator;
|
||||
import flintstones.entity.operator.interfaces.IParameterizedOperator;
|
||||
import flintstones.entity.operator.interfaces.IUnweightedAggregationOperator;
|
||||
import flintstones.entity.operator.interfaces.IWeightedAggregationOperator;
|
||||
import flintstones.entity.problemelement.entities.ProblemElement;
|
||||
import flintstones.entity.valuation.Valuation;
|
||||
|
||||
/**
|
||||
* The Class AggregationOperator.
|
||||
*/
|
||||
public abstract class AggregationOperator extends Operator {
|
||||
|
||||
/** The type. */
|
||||
protected String type = "Aggregation";
|
||||
|
||||
|
||||
public Valuation computeAggregation(List<Valuation> valuations, List<?> weights) {
|
||||
return aggregate(valuations, weights);
|
||||
}
|
||||
|
||||
public Valuation computeParameterizedAggregation(ProblemElement[] items, List<Valuation> valuations, List<?> weights) {
|
||||
|
||||
((IParameterizedOperator) this).openDialog(items);
|
||||
|
||||
return aggregate(valuations, weights);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Valuation aggregate(List<Valuation> valuations, List<?> weights) {
|
||||
String valuationId = valuations.get(0).getId();
|
||||
Valuation result;
|
||||
|
||||
if ((this instanceof IWeightedAggregationOperator || this instanceof IFuzzyWeightedAggregationOperator) && weights != null) {
|
||||
|
||||
if(weights.get(0) instanceof Double)
|
||||
result = ((IWeightedAggregationOperator) this).aggregate(valuations, (List<Double>) weights);
|
||||
else
|
||||
result = ((IFuzzyWeightedAggregationOperator) this).aggregateF(valuations, (List<TrapezoidalFunction>) weights);
|
||||
|
||||
} else
|
||||
result = ((IUnweightedAggregationOperator) this).aggregate(valuations);
|
||||
|
||||
result.setId(valuationId);
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package flintstones.entity.operator;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import flintstones.entity.wvaluation.WValuation;
|
||||
|
||||
public abstract class NormalizationOperator extends Operator {
|
||||
|
||||
protected String type = "Normalization";
|
||||
|
||||
public abstract WValuation[] normalize(List<WValuation> valuations);
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package flintstones.entity.operator;
|
||||
|
||||
import flintstones.entity.extensionenum.ExtensionEnum;
|
||||
|
||||
/**
|
||||
* The Operator Class.
|
||||
*/
|
||||
public abstract class Operator {
|
||||
|
||||
/** The id. */
|
||||
protected String id;
|
||||
|
||||
/** The name. */
|
||||
protected String name;
|
||||
|
||||
/**
|
||||
* The Class Fields.
|
||||
*/
|
||||
public enum Fields implements ExtensionEnum {
|
||||
|
||||
/** The id. */
|
||||
uid,
|
||||
/** The name. */
|
||||
name,
|
||||
/** The parameters. */
|
||||
parameters,
|
||||
/** The implementation. */
|
||||
implementation,
|
||||
/** The weighted. */
|
||||
weighted,
|
||||
/** The unweighted. */
|
||||
unweighted,
|
||||
/** The supported types. */
|
||||
supported_types,
|
||||
/** The type. */
|
||||
type,
|
||||
/** The has attributes. */
|
||||
hasAttributes,
|
||||
/** The aggregation operator. */
|
||||
aggregation_operator,
|
||||
/** The valuation id. */
|
||||
valuationId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new aggregation operator.
|
||||
*/
|
||||
public Operator() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the id.
|
||||
*
|
||||
* @return the id
|
||||
*/
|
||||
public String getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the id.
|
||||
*
|
||||
* @param id the new id
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
public abstract String getName();
|
||||
|
||||
/**
|
||||
* Sets the name.
|
||||
*
|
||||
* @param name the new name
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package flintstones.entity.operator.interfaces;
|
||||
|
||||
import java.util.List;
|
||||
import flintstones.domain.fuzzyset.function.types.TrapezoidalFunction;
|
||||
import flintstones.entity.valuation.Valuation;
|
||||
|
||||
public interface IFuzzyWeightedAggregationOperator {
|
||||
|
||||
/**
|
||||
* Aggregate a set of valuations into one valuation using weights.
|
||||
*
|
||||
* @param valuations the valuations
|
||||
* @param weights the fuzzy weights
|
||||
* @return the valuation
|
||||
*/
|
||||
public abstract Valuation aggregateF(List<Valuation> valuations, List<TrapezoidalFunction> weights);
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package flintstones.entity.operator.interfaces;
|
||||
|
||||
import flintstones.entity.problemelement.entities.ProblemElement;
|
||||
|
||||
/**
|
||||
* The Interface IParameterizedOperator let you provide a wizard to configure a AggregationOperator.
|
||||
*/
|
||||
public interface IParameterizedOperator {
|
||||
|
||||
/**
|
||||
* Open the dialog.
|
||||
* @param parentItem The elements to be aggregated and that must be represented in the dialog
|
||||
*
|
||||
*/
|
||||
public abstract void openDialog(ProblemElement[] items);
|
||||
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package flintstones.entity.operator.interfaces;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import flintstones.entity.valuation.Valuation;
|
||||
|
||||
/**
|
||||
* The Interface IUnweightedOperator is used to define operators that wi.
|
||||
*/
|
||||
public interface IUnweightedAggregationOperator {
|
||||
|
||||
/**
|
||||
* Aggregate a set of valuations into one valuation.
|
||||
*
|
||||
* @param valuations the valuations
|
||||
* @return the valuation
|
||||
*/
|
||||
public abstract Valuation aggregate(List<Valuation> valuations);
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package flintstones.entity.operator.interfaces;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import flintstones.entity.valuation.Valuation;
|
||||
|
||||
public interface IWeightedAggregationOperator {
|
||||
|
||||
/**
|
||||
* Aggregate a set of valuations into one valuation using weights.
|
||||
*
|
||||
* @param valuations the valuations
|
||||
* @param weights the weights
|
||||
* @return the valuation
|
||||
*/
|
||||
public abstract Valuation aggregate(List<Valuation> valuations, List<Double> weights);
|
||||
}
|
||||
Reference in New Issue
Block a user