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.ahpsort.priority</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
<name>[bundle] Priority</name>
|
||||
</project>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>flintstones.entity.ahpsort.priority</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>1779484362555</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,11 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Priority
|
||||
Bundle-SymbolicName: flintstones.entity.ahpsort.priority
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Automatic-Module-Name: flintstones.entity.ahpsort.priority
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Require-Bundle: flintstones.helper.data,
|
||||
flintstones.entity.problemelement,
|
||||
flintstones.entity.ahpsort.referencepoint
|
||||
Export-Package: flintstones.entity.ahpsort.priority
|
||||
@@ -0,0 +1,4 @@
|
||||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
package flintstones.entity.ahpsort.priority;
|
||||
|
||||
import flintstones.entity.ahpsort.referencepoint.AHPSortReferencencePoint;
|
||||
import flintstones.entity.problemelement.entities.Alternative;
|
||||
import flintstones.entity.problemelement.entities.ProblemElement;
|
||||
import flintstones.entity.problemelement.entities.SortingProfile;
|
||||
import flintstones.helper.DoubleHelper;
|
||||
|
||||
/**
|
||||
* The Class AHPSortPriority.
|
||||
*/
|
||||
public class AHPSortPriority {
|
||||
|
||||
/** The alternative. */
|
||||
ProblemElement leftElement;
|
||||
|
||||
/** The profile. */
|
||||
ProblemElement[] rightElement;
|
||||
|
||||
/** The alternative priority. */
|
||||
double leftPriority;
|
||||
|
||||
/** The profile priority. */
|
||||
double[] rightPriority;
|
||||
|
||||
/**
|
||||
* Instantiates a new AHP sort priority.
|
||||
*
|
||||
* @param profile the profile
|
||||
* @param alternative the alternative
|
||||
* @param leftValue the left value
|
||||
* @param rightValue the right value
|
||||
*/
|
||||
public AHPSortPriority(SortingProfile[] profile, Alternative alternative, double leftValue, double[] rightValue) {
|
||||
this.rightElement = profile;
|
||||
this.leftElement = alternative;
|
||||
this.leftPriority = leftValue;
|
||||
this.rightPriority = rightValue;
|
||||
}
|
||||
|
||||
public AHPSortPriority(SortingProfile[] profile, AHPSortReferencencePoint refPoint, double leftValue,
|
||||
double[] rightValue) {
|
||||
this.rightElement = profile;
|
||||
this.leftElement = refPoint;
|
||||
this.leftPriority = leftValue;
|
||||
this.rightPriority = rightValue;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Instantiates a new AHP sort priority.
|
||||
// *
|
||||
// * @param profile the profile
|
||||
// * @param alternative the alternative
|
||||
// * @param values the values
|
||||
// */
|
||||
// public AHPSortPriority(SortingProfile[] profile, Alternative alternative, double[] values) {
|
||||
// this(profile, alternative, values[0], valores);
|
||||
// if (values.length != 2)
|
||||
// throw new RuntimeException("No");
|
||||
// }
|
||||
//
|
||||
// public AHPSortPriority(SortingProfile[] profile, AHPSortReferencencePoint refPoint, double[] values) {
|
||||
// this(profile, refPoint, values[0], values[1]);
|
||||
// if (values.length != 2)
|
||||
// throw new RuntimeException("No");
|
||||
// }
|
||||
|
||||
/**
|
||||
* Gets the alternative.
|
||||
*
|
||||
* @return the alternative
|
||||
*/
|
||||
public ProblemElement getLeftElement() {
|
||||
return leftElement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the profile.
|
||||
*
|
||||
* @return the profile
|
||||
*/
|
||||
public SortingProfile[] getProfile() {
|
||||
return (SortingProfile[]) rightElement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the alternative priority.
|
||||
*
|
||||
* @return the alternative priority
|
||||
*/
|
||||
public double getAlternativePriority() {
|
||||
return leftPriority;
|
||||
}
|
||||
|
||||
public double getReferencePointPriority() {
|
||||
return leftPriority;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the profile priority.
|
||||
*
|
||||
* @return the profile priority
|
||||
*/
|
||||
public double[] getProfilePriority() {
|
||||
return rightPriority;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return "( " + DoubleHelper.Draw(leftPriority) + ", " + rightPriority.toString() + " )";
|
||||
}
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
package flintstones.entity.ahpsort.priority;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedHashSet;
|
||||
|
||||
import flintstones.entity.problemelement.entities.ProblemElement;
|
||||
import flintstones.entity.problemelement.entities.SortingProfile;
|
||||
import flintstones.helper.data.HashMapList;
|
||||
import flintstones.helper.data.HashMatrix;
|
||||
|
||||
/**
|
||||
* The Class AHPSortPriorityManager.
|
||||
*/
|
||||
public class AHPSortPriorityManager {
|
||||
|
||||
/** The data. */
|
||||
private HashMapList<ProblemElement, AHPSortPriority> data = new HashMapList<>();
|
||||
private LinkedHashSet<SortingProfile> profiles = new LinkedHashSet<SortingProfile>();
|
||||
|
||||
/**
|
||||
* Instantiates a new AHP sort priority manager.
|
||||
*/
|
||||
public AHPSortPriorityManager() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the.
|
||||
*
|
||||
* @param prior the prior
|
||||
*/
|
||||
public void add(AHPSortPriority prior) {
|
||||
data.add(prior.getLeftElement(), prior);
|
||||
SortingProfile[] perfil = prior.getProfile();
|
||||
for (SortingProfile sortingProfile : perfil) {
|
||||
if (!profiles.contains(sortingProfile))
|
||||
profiles.add(sortingProfile);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the alternatives.
|
||||
*
|
||||
* @return the alternatives
|
||||
*/
|
||||
public ProblemElement[] getLeftElements() {
|
||||
return data.keySet().stream().toArray(ProblemElement[]::new);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the profiles.
|
||||
*
|
||||
* @return the profiles //
|
||||
*/
|
||||
public SortingProfile[] getProfiles() {
|
||||
return profiles.stream().toArray(SortingProfile[]::new);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the.
|
||||
*
|
||||
* @param a the a
|
||||
* @param p the p
|
||||
* @return the AHP sort priority
|
||||
*/
|
||||
|
||||
public AHPSortPriority get(ProblemElement a, int profileIndex) {
|
||||
return data.get(a).get(profileIndex);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
ProblemElement[] outer = data.keySet().stream().map(k -> k).toArray(ProblemElement[]::new);
|
||||
ProblemElement[] inner = profiles.stream().map(k -> (ProblemElement) k).toArray(ProblemElement[]::new);
|
||||
|
||||
Arrays.sort(outer, (a, b) -> a.getOrder() > b.getOrder() ? 1 : -1);
|
||||
Arrays.sort(inner, (a, b) -> a.getOrder() > b.getOrder() ? 1 : -1);
|
||||
|
||||
HashMatrix<ProblemElement, SortingProfile, AHPSortPriority> matrix = new HashMatrix<>();
|
||||
|
||||
for (ProblemElement o : outer)
|
||||
for (int i = 0; i < inner.length; i++)
|
||||
matrix.put(o, getProfiles()[i], get(o, i));
|
||||
|
||||
return matrix.toString();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user