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.method.common.phase.collectweights</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
<name>[bundle] Collectweights</name>
|
||||
</project>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>flintstones.method.common.phase.collectweights</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>1779484362638</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>
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
||||
+7
@@ -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
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
||||
@@ -0,0 +1,19 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Collectweights
|
||||
Bundle-SymbolicName: flintstones.method.common.phase.collectweights;singleton:=true
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Automatic-Module-Name: flintstones.method.common.phase.collectweights
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Require-Bundle: javax.inject,
|
||||
flintstones.entity.method.phase.ui,
|
||||
flintstones.helper.extensionpoint,
|
||||
javax.annotation,
|
||||
flintstones.entity.method.phase,
|
||||
flintstones.method.decision.common.phase.collectweights;bundle-version="1.0.0",
|
||||
flintstones.model.method.phase.service,
|
||||
org.eclipse.e4.core.contexts,
|
||||
org.apache.commons.lang,
|
||||
flintstones.entity.problemelement,
|
||||
flintstones.helper.data
|
||||
Export-Package: flintstones.method.common.phase.collectweights
|
||||
@@ -0,0 +1,6 @@
|
||||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
plugin.xml,\
|
||||
schema/
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension-point id="flintstones.method.phase.collectWeights" name="Collect Weights ExtensionP" schema="schema/flintstones.method.phase.collectWeights.exsd"/>
|
||||
<extension
|
||||
point="flintstones.phasemethod.extensionpoint">
|
||||
<phase
|
||||
uid="flintstones.method.common.phase.collectweights"
|
||||
implementation="flintstones.method.common.phase.collectweights.CollectWeightsModel">
|
||||
</phase>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="flintstones.method.common.phase.collectweights" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.schema plugin="flintstones.method.common.phase.collectweights" id="flintstones.method.phase.collectWeights.extension" name="Collect Weights Extension Point"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter description of this extension point.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<element name="extension">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.element />
|
||||
</appinfo>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<choice>
|
||||
<element ref="phase"/>
|
||||
</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="phase">
|
||||
<complexType>
|
||||
<attribute name="uid" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute kind="identifier" basedOn="flintstones.phasemethod.extensionpoint/phase/@uid"/>
|
||||
</appinfo>
|
||||
</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>
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
package flintstones.method.common.phase.collectweights;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
import org.eclipse.e4.core.contexts.IEclipseContext;
|
||||
import flintstones.entity.method.phase.PhaseMethod;
|
||||
import flintstones.entity.method.phase.ui.PhaseMethodUI;
|
||||
import flintstones.entity.problemelement.entities.FakeProblemElement;
|
||||
import flintstones.entity.problemelement.entities.ProblemElement;
|
||||
import flintstones.helper.data.HashMatrix;
|
||||
import flintstones.helper.extensionpoint.BaseRegistry;
|
||||
import flintstones.helper.extensionpoint.ExtensionRegistry;
|
||||
import flintstones.model.method.phase.IPhaseMethodService;
|
||||
|
||||
public class CollectWeightsModel extends PhaseMethod {
|
||||
|
||||
@Inject
|
||||
IPhaseMethodService phaseService;
|
||||
|
||||
@Inject
|
||||
IEclipseContext context;
|
||||
|
||||
PhaseMethodUI expertUI;
|
||||
PhaseMethodUI criterionUI;
|
||||
|
||||
HashMap<String, PhaseMethodUI> cachedPhases = new HashMap<>();
|
||||
|
||||
BaseRegistry basereg;
|
||||
|
||||
@PostConstruct
|
||||
private void init() {
|
||||
basereg = new BaseRegistry("flintstones.method.phase.collectWeights");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Collect Weights";
|
||||
}
|
||||
|
||||
public void reExport(PhaseMethod phaseModel) {
|
||||
|
||||
String[] exportedKeys = phaseModel.getExportedKeys(false);
|
||||
for(String key : exportedKeys)
|
||||
exportData(key, phaseModel.getExportedData(key));
|
||||
|
||||
}
|
||||
|
||||
public void deleteExport(PhaseMethod phaseModel) {
|
||||
|
||||
String[] exportedKeys = phaseModel.getExportedKeys(false);
|
||||
for(String key : exportedKeys)
|
||||
deleteData(key);
|
||||
|
||||
}
|
||||
|
||||
public void setCriterionPhase(PhaseMethodUI ui) {
|
||||
if(criterionUI != null) {
|
||||
deleteExport(criterionUI.getModel());
|
||||
}
|
||||
criterionUI = ui;
|
||||
reExport(ui.getModel());
|
||||
}
|
||||
|
||||
public void setExpertPhase(PhaseMethodUI ui) {
|
||||
if(expertUI != null) {
|
||||
deleteExport(expertUI.getModel());
|
||||
}
|
||||
expertUI = ui;
|
||||
reExport(ui.getModel());
|
||||
}
|
||||
|
||||
public PhaseMethodUI getExpertPhase() {
|
||||
return expertUI;
|
||||
}
|
||||
|
||||
public PhaseMethodUI getCriterionPhase() {
|
||||
return criterionUI;
|
||||
}
|
||||
|
||||
public String[] getCriterionWeightCollectorLabels() {
|
||||
|
||||
if(cachedPhases.isEmpty()) {
|
||||
ExtensionRegistry[] regs = basereg.getAllRegistries();
|
||||
PhaseMethodUI[] uis = new PhaseMethodUI[regs.length];
|
||||
int x = 0;
|
||||
for(ExtensionRegistry reg : regs)
|
||||
uis[x++] = phaseService.createPhase(reg.getAttribute(PhaseMethod.Fields.uid));
|
||||
|
||||
Arrays.stream(uis).forEach( k -> cachedPhases.put(k.getModel().getName(), k) );
|
||||
}
|
||||
|
||||
return cachedPhases.values().stream().map(k -> k.getModel().getName()).toArray(String[]::new);
|
||||
|
||||
}
|
||||
|
||||
public String getPhaseIdBy(String name) {
|
||||
return cachedPhases.get(name).getModel().getId();
|
||||
}
|
||||
|
||||
|
||||
public void export(String key, HashMatrix<ProblemElement, ProblemElement, Double> weights) {
|
||||
|
||||
if(weights.size() == 1) {
|
||||
ProblemElement first = weights.keySet().iterator().next();
|
||||
if(first.getType().equals(FakeProblemElement.Type)) {
|
||||
|
||||
}
|
||||
exportData(key,weights.get(first));
|
||||
} else {
|
||||
exportData(key, weights);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void deleteExport(String key) {
|
||||
this.deleteData(key);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user