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.ahp.ui</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
<name>[bundle] Ui</name>
|
||||
</project>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>flintstones.entity.ahp.ui</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>1779484362554</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,25 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Ui
|
||||
Bundle-SymbolicName: flintstones.entity.ahp.ui
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Automatic-Module-Name: flintstones.entity.ahp.ui
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-11
|
||||
Require-Bundle: org.eclipse.e4.core.contexts,
|
||||
javax.inject,
|
||||
flintstones.model.problemelement.service,
|
||||
flintstones.valuation.ahp.ui,
|
||||
org.eclipse.swt,
|
||||
flintstones.entity.problemelement.ui,
|
||||
flintstones.entity.ahppreferences,
|
||||
flintstones.entity.preferences.preferencecollection,
|
||||
flintstones.entity.problemelement,
|
||||
flintstones.entity.ahp,
|
||||
flintstones.helper.debug,
|
||||
flintstones.model.ui.service,
|
||||
org.eclipse.jface,
|
||||
flintstones.model.ahppreferences.service,
|
||||
org.eclipse.e4.core.di,
|
||||
flintstones.helper.data,
|
||||
flintstones.helper.html
|
||||
Export-Package: flintstones.entity.ahp.ui
|
||||
@@ -0,0 +1,4 @@
|
||||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.
|
||||
@@ -0,0 +1,50 @@
|
||||
package flintstones.entity.ahp.ui;
|
||||
|
||||
import org.eclipse.jface.dialogs.Dialog;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import flintstones.entity.ahp.AHPMatrix;
|
||||
import flintstones.entity.problemelement.entities.ProblemElement;
|
||||
import flintstones.helper.html.HtmlMatrix;
|
||||
import flintstones.model.ui.service.UiService;
|
||||
|
||||
public class AHPMatrixDialog extends Dialog {
|
||||
|
||||
AHPMatrix matrix;
|
||||
public AHPMatrixDialog(Shell parentShell, AHPMatrix m) {
|
||||
super(parentShell);
|
||||
this.matrix = m;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Control createDialogArea(Composite parent) {
|
||||
|
||||
Composite base = new Composite(parent,0);
|
||||
UiService.setGridLayout(base, 1);
|
||||
UiService.setGridDataAuto(base);
|
||||
|
||||
ProblemElement[] items = matrix.getRows();
|
||||
int l = items.length;
|
||||
String[][] data = new String[l][l];
|
||||
|
||||
for(int i = 0; i < l; i++ ) {
|
||||
for(int j = 0; j < l; j++ ) {
|
||||
data[i][j] = matrix.getLabel(items[i],items[j]);
|
||||
}
|
||||
}
|
||||
|
||||
HtmlMatrix hMatrix = new HtmlMatrix(base, data);
|
||||
hMatrix.render();
|
||||
|
||||
return parent;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Point getInitialSize() {
|
||||
return new Point(450, 300);
|
||||
}
|
||||
}
|
||||
+484
@@ -0,0 +1,484 @@
|
||||
package flintstones.entity.ahp.ui;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
|
||||
import org.eclipse.e4.core.contexts.IEclipseContext;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.CLabel;
|
||||
import org.eclipse.swt.custom.ScrolledComposite;
|
||||
import org.eclipse.swt.events.MouseAdapter;
|
||||
import org.eclipse.swt.events.MouseEvent;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.graphics.Cursor;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Group;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
|
||||
import flintstones.entity.ahp.AHPConsistency;
|
||||
import flintstones.entity.ahp.AHPMatrix;
|
||||
import flintstones.entity.ahppreferences.PreferenceBuild;
|
||||
import flintstones.entity.preferences.preferencecollection.PreferenceCollection;
|
||||
import flintstones.entity.problemelement.entities.ProblemElement;
|
||||
import flintstones.entity.problemelement.entities.ProblemElementHelper;
|
||||
import flintstones.entity.problemelement.ui.widget.ProblemElementSelector;
|
||||
import flintstones.entity.problemelement.ui.widget.listener.IProblemElementChangedListener;
|
||||
import flintstones.helper.DoubleHelper;
|
||||
import flintstones.model.ahppreferences.service.IProblemPreferencesService;
|
||||
import flintstones.model.problemelement.service.IProblemElementService;
|
||||
import flintstones.model.ui.service.UiService;
|
||||
import flintstones.valuation.ahp.ui.AHPValuationPanel;
|
||||
import flintstones.valuation.ahp.ui.IAHPValuationPanelClickListener;
|
||||
|
||||
/**
|
||||
* The Class PreferencesRatingPart.
|
||||
*/
|
||||
public class PreferencesRatingPart implements IAHPValuationPanelClickListener {
|
||||
|
||||
@Inject
|
||||
IEclipseContext context;
|
||||
|
||||
@Inject
|
||||
IProblemPreferencesService ppreferencesService;
|
||||
|
||||
@Inject
|
||||
IProblemElementService problemService;
|
||||
|
||||
AHPValuationPanel panel;
|
||||
|
||||
Label consistencyLabel;
|
||||
|
||||
ProblemElementSelector mainCombo;
|
||||
|
||||
ProblemElementSelector otherCombo;
|
||||
|
||||
/** The size check. */
|
||||
CLabel sizeCheck;
|
||||
CLabel showAHP;
|
||||
|
||||
/** The max ratio. */
|
||||
Double MAX_RATIO = 0.100001;
|
||||
|
||||
/**
|
||||
* Instantiates a new preferences rating part.
|
||||
*/
|
||||
public PreferencesRatingPart() {
|
||||
}
|
||||
|
||||
/** The current build. */
|
||||
// Changing parts
|
||||
private PreferenceBuild currentBuild;
|
||||
|
||||
/** The manager. */
|
||||
// Fixed parts
|
||||
PreferenceCollection manager;
|
||||
|
||||
/**
|
||||
* Inits the preferences rating part.
|
||||
*
|
||||
* @param parent the parent
|
||||
* @param domain the domain
|
||||
* @param builds the builds
|
||||
*/
|
||||
public void initPreferencesRatingPart(Composite parent, PreferenceBuild[] builds) {
|
||||
|
||||
manager = null;
|
||||
if (builds != null && builds.length > 0) {
|
||||
PreferenceBuild any = builds[0];
|
||||
manager = ppreferencesService.get(
|
||||
any.getMainType(), //
|
||||
any.getOtherType(), //
|
||||
any.getLeftType(), //
|
||||
any.getRightType());
|
||||
}
|
||||
|
||||
if (manager == null)
|
||||
manager = new PreferenceCollection(builds);
|
||||
|
||||
currentBuild = builds[0];
|
||||
|
||||
createRow1(parent, getAllMainElements(builds), getAllOtherElements(builds));
|
||||
createRow2(parent);
|
||||
|
||||
if (currentBuild.isAHP()) {
|
||||
drawSizeCheck(currentBuild.getLeftElements().toArray(new ProblemElement[0]));
|
||||
drawShowAHP();
|
||||
}
|
||||
refresh();
|
||||
|
||||
}
|
||||
|
||||
private void drawShowAHP() {
|
||||
showAHP.setImage(UiService.getImage("ahpmatrix.png").createImage());
|
||||
showAHP.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseDown(MouseEvent e) {
|
||||
|
||||
PreferenceBuild build = manager.getBuild(getComboMainElement(), getComboOtherElement());
|
||||
AHPMatrix m = build.getAHPMatrix();
|
||||
new AHPMatrixDialog(Display.getCurrent().getActiveShell(), m).open();
|
||||
}
|
||||
});
|
||||
|
||||
showAHP.addListener(SWT.MouseMove, new Listener() {
|
||||
public void handleEvent(Event event) {
|
||||
final Cursor cursor = new Cursor(Display.getDefault(), SWT.CURSOR_HAND);
|
||||
showAHP.setCursor(cursor);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the all main elements.
|
||||
*
|
||||
* @param builds the builds
|
||||
* @return the all main elements
|
||||
*/
|
||||
public ProblemElement[] getAllMainElements(PreferenceBuild[] builds) {
|
||||
HashSet<ProblemElement> arr = new HashSet<>();
|
||||
for (int i = 0; i < builds.length; i++)
|
||||
arr.add(builds[i].getMain());
|
||||
return arr.stream().toArray(ProblemElement[]::new);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the all other elements.
|
||||
*
|
||||
* @param builds the builds
|
||||
* @return the all other elements
|
||||
*/
|
||||
public ProblemElement[] getAllOtherElements(PreferenceBuild[] builds) {
|
||||
HashSet<ProblemElement> arr = new HashSet<>();
|
||||
for (int i = 0; i < builds.length; i++)
|
||||
arr.add(builds[i].getOther());
|
||||
return arr.stream().toArray(ProblemElement[]::new);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the row 1.
|
||||
*
|
||||
* @param parent the parent
|
||||
* @param experts the experts
|
||||
* @param criterions the criterions
|
||||
*/
|
||||
private void createRow1(Composite parent, ProblemElement[] experts, ProblemElement[] criterions) {
|
||||
|
||||
experts = ProblemElementHelper.getAsUserOrdered(experts);
|
||||
criterions = ProblemElementHelper.getAsUserOrdered(criterions);
|
||||
|
||||
Composite row1 = new Composite(parent, 0);
|
||||
UiService.setGridLayout(row1, 3, false);
|
||||
UiService.setGridData(row1, 9, 0, true, false);
|
||||
|
||||
Group g = new Group(row1, 0);
|
||||
g.setText("Controls");
|
||||
UiService.setGridLayout(g, 9, false);
|
||||
UiService.setGridData(g, 9, 0, true, false);
|
||||
|
||||
if (!currentBuild.isMainGeneric()) {
|
||||
Label expertLabel = new Label(g, 0);
|
||||
mainCombo = new ProblemElementSelector(g, experts);
|
||||
mainCombo.setListener(new IProblemElementChangedListener() {
|
||||
@Override
|
||||
public void problemElementChanged(ProblemElement pe) {
|
||||
refresh();
|
||||
}
|
||||
});
|
||||
expertLabel.setText(currentBuild.getMainType());
|
||||
|
||||
UiService.setFont(expertLabel, UiService.FONT_SECTION_TITLE);
|
||||
}
|
||||
|
||||
if (!currentBuild.isOtherGeneric()) {
|
||||
Label criterionLabel = new Label(g, 0);
|
||||
otherCombo = new ProblemElementSelector(g, criterions);
|
||||
otherCombo.setListener(new IProblemElementChangedListener() {
|
||||
@Override
|
||||
public void problemElementChanged(ProblemElement pe) {refresh();}
|
||||
});
|
||||
criterionLabel.setText(currentBuild.getOtherType());
|
||||
|
||||
UiService.setFont(criterionLabel, UiService.FONT_SECTION_TITLE);
|
||||
}
|
||||
|
||||
Label consistencyTitle = new Label(g, 0);
|
||||
consistencyTitle.setText("CR: ");
|
||||
|
||||
consistencyLabel = new Label(g, 0);
|
||||
consistencyLabel.setText("0.0 ");
|
||||
UiService.setFont(consistencyTitle, UiService.FONT_SECTION_TITLE);
|
||||
|
||||
showAHP = new CLabel(row1, 0);
|
||||
UiService.setGridData(showAHP, 1, 0, false, false);
|
||||
|
||||
sizeCheck = new CLabel(row1, 0);
|
||||
UiService.setGridData(sizeCheck, 1, 0, false, false);
|
||||
|
||||
if (currentBuild.getLeftType().equals(currentBuild.getRightType())) {
|
||||
Button hideSame = new Button(g,SWT.CHECK);
|
||||
hideSame.setText("Hide same");
|
||||
hideSame.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
panel.show(!hideSame.getSelection());
|
||||
refresh();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw size check.
|
||||
*
|
||||
* @param alternatives the alternatives
|
||||
*/
|
||||
private void drawSizeCheck(ProblemElement[] alternatives) {
|
||||
|
||||
int num = alternatives.length;
|
||||
boolean isValid = num >= 2 && num <= 10;
|
||||
|
||||
Image labelImage = isValid ? UiService.getIcon("status_right").createImage()
|
||||
: UiService.getIcon("status_wrong").createImage();
|
||||
String sizeCheckText = num + " alternatives";
|
||||
|
||||
if (num < 2)
|
||||
sizeCheckText += " (at least 2)";
|
||||
if (num > 10)
|
||||
sizeCheckText += " (at most 10)";
|
||||
|
||||
sizeCheck.setText(sizeCheckText);
|
||||
sizeCheck.setImage(labelImage);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the row 2.
|
||||
*
|
||||
* @param parent the parent
|
||||
* @param domain the domain
|
||||
*/
|
||||
private void createRow2(Composite parent) {
|
||||
|
||||
ScrolledComposite c1 = new ScrolledComposite(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
|
||||
UiService.setGridLayout(c1, 1);
|
||||
UiService.setGridData(c1, 9, 9, true, true);
|
||||
|
||||
c1.setExpandHorizontal(true);
|
||||
c1.setExpandVertical(true);
|
||||
c1.addListener(SWT.Resize, event -> {
|
||||
int width = c1.getClientArea().width;
|
||||
c1.setMinSize(parent.computeSize(width, SWT.DEFAULT));
|
||||
});
|
||||
|
||||
Composite row2 = new Composite(c1, 0);
|
||||
UiService.setGridLayout(row2, 1);
|
||||
UiService.setGridData(row2, 9, 0, true, false);
|
||||
|
||||
c1.setContent(row2);
|
||||
|
||||
panel = new AHPValuationPanel(row2);
|
||||
ContextInjectionFactory.inject(panel, context);
|
||||
|
||||
setButtonListener(panel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the button listener.
|
||||
*
|
||||
* @param panel the new button listener
|
||||
*/
|
||||
protected void setButtonListener(AHPValuationPanel panel) {
|
||||
panel.setButtonOnClickListener(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh.
|
||||
*/
|
||||
protected void refresh() {
|
||||
|
||||
currentBuild = manager.getBuild(getComboMainElement(), getComboOtherElement());
|
||||
int[][] mat = currentBuild.get();
|
||||
|
||||
panel.clear();
|
||||
panel.setButtonOnClickListener(this);
|
||||
panel.base1(currentBuild.getLeftElements().toArray(new ProblemElement[0]), currentBuild.getRightElements().toArray(new ProblemElement[0]), mat);
|
||||
|
||||
refreshCriterionCombo();
|
||||
refreshExpertCombo();
|
||||
|
||||
if (mat != null)
|
||||
refreshConsistencyLabel();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the combo main element.
|
||||
*
|
||||
* @return the combo main element
|
||||
*/
|
||||
private ProblemElement getComboMainElement() {
|
||||
if(currentBuild != null) {
|
||||
if (currentBuild.isMainGeneric())
|
||||
return currentBuild.getMain();
|
||||
}
|
||||
|
||||
return mainCombo.getSelectedElement();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the combo other element.
|
||||
*
|
||||
* @return the combo other element
|
||||
*/
|
||||
private ProblemElement getComboOtherElement() {
|
||||
|
||||
if(currentBuild != null) {
|
||||
if (currentBuild.isOtherGeneric())
|
||||
return currentBuild.getOther();
|
||||
}
|
||||
|
||||
return otherCombo.getSelectedElement();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current other element.
|
||||
*
|
||||
* @return the current other element
|
||||
*/
|
||||
protected ProblemElement getCurrentOtherElement() {
|
||||
return currentBuild.getOther();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current main element.
|
||||
*
|
||||
* @return the current main element
|
||||
*/
|
||||
protected ProblemElement getCurrentMainElement() {
|
||||
|
||||
return currentBuild.getMain();
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh consistency label.
|
||||
*/
|
||||
protected void refreshConsistencyLabel() {
|
||||
|
||||
if (!currentBuild.isAHP()) {
|
||||
consistencyLabel.setText("0,0");
|
||||
return;
|
||||
}
|
||||
|
||||
if(currentBuild.getLeftElements().size() * currentBuild.getRightElements().size() < 5) {
|
||||
consistencyLabel.setText("0,0");
|
||||
return ;
|
||||
}
|
||||
|
||||
AHPMatrix mat = currentBuild.getAHPMatrix();
|
||||
AHPConsistency consistencyChecker = new AHPConsistency();
|
||||
double ratio = consistencyChecker.getConsistencyRatio(mat);
|
||||
consistencyLabel.setText(DoubleHelper.Draw(ratio));
|
||||
|
||||
refreshCriterionCombo();
|
||||
refreshExpertCombo();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh expert combo.
|
||||
*/
|
||||
protected void refreshExpertCombo() {
|
||||
|
||||
if (currentBuild.isMainGeneric())
|
||||
return;
|
||||
|
||||
boolean everyCriterionOk = otherCombo.getStatus();
|
||||
mainCombo.getSelectedElement();
|
||||
mainCombo.setStatus(mainCombo.getSelectedElement(), everyCriterionOk);
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh criterion combo.
|
||||
*/
|
||||
protected void refreshCriterionCombo() {
|
||||
|
||||
if (currentBuild.isOtherGeneric()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!currentBuild.isMainGeneric()) {
|
||||
ProblemElement[] otherElements = manager.getAllOtherElements();
|
||||
for (int i = 0; i < otherElements.length; i++) {
|
||||
|
||||
ProblemElement main = getComboMainElement();
|
||||
ProblemElement other = otherElements[i];
|
||||
|
||||
boolean status = getStatusFor(main, other);
|
||||
otherCombo.setStatus(other, status);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the status for.
|
||||
*
|
||||
* @param main the main
|
||||
* @param other the other
|
||||
* @return the status for
|
||||
*/
|
||||
private boolean getStatusFor(ProblemElement main, ProblemElement other) {
|
||||
|
||||
PreferenceBuild build = manager.getBuild(main, other);
|
||||
if (build.isAHP()) {
|
||||
AHPMatrix mat = build.getAHPMatrix();
|
||||
|
||||
if (mat == null)
|
||||
return false;
|
||||
|
||||
AHPConsistency consistencyChecker = new AHPConsistency();
|
||||
double ratio = consistencyChecker.getConsistencyRatio(mat);
|
||||
|
||||
return ratio > MAX_RATIO ? false : true;
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see flintstones.valuation.ahp.ui.IAHPValuationPanelClickListener#onClick(
|
||||
* flintstones.entity.problemelement.entities.ProblemElement,
|
||||
* flintstones.entity.problemelement.entities.ProblemElement,
|
||||
* flintstones.domain.ahp.AHPDomain, int)
|
||||
*/
|
||||
@Override
|
||||
public void onClick(ProblemElement left, ProblemElement right, int position) {
|
||||
|
||||
if (left.getType().equals(right.getType()))
|
||||
currentBuild.setDiagonal(left, right, position);
|
||||
else
|
||||
currentBuild.set(left, right, position);
|
||||
|
||||
ppreferencesService.addOrUpdate(manager);
|
||||
|
||||
panel.select(left, right, position);
|
||||
refreshConsistencyLabel();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user