sonarqube adjustments

This commit is contained in:
Armin Wolf 2020-04-05 19:55:51 +02:00
parent 53fc4359f8
commit d7a8b10244
6 changed files with 41 additions and 53 deletions

View File

@ -4,8 +4,11 @@
plugins { plugins {
id 'java' id 'java'
id "org.sonarqube" version "2.7"
} }
apply plugin: 'org.sonarqube'
repositories { repositories {
mavenLocal() mavenLocal()
mavenCentral() mavenCentral()
@ -29,3 +32,10 @@ group = 'de.wwu.awolf'
version = '1.0.0' version = '1.0.0'
sourceCompatibility = '11' sourceCompatibility = '11'
sonarqube {
properties {
property "sonar.projectName", "${rootProject.name}"
property "sonar.projectKey", "$project.group:$rootProject.name"
}
}

View File

@ -13,10 +13,10 @@ import java.util.Objects;
*/ */
public class Line implements Comparable<Line> { public class Line implements Comparable<Line> {
private final double epsilon = 0.00001; private static final double epsilon = 0.00001;
private static final Double min = 9999d;
private static final Double max = -9999d;
private final Double MAX = 9999d;
private final Double MIN = -9999d;
private Double m; private Double m;
@ -40,10 +40,10 @@ public class Line implements Comparable<Line> {
this.m = m; this.m = m;
this.b = b; this.b = b;
this.x1 = MIN; this.x1 = max;
this.y1 = (MIN * m) + b; this.y1 = (max * m) + b;
this.x2 = MAX * 0.5; this.x2 = min * 0.5;
this.y2 = ((MAX * 0.5) * m) + b; this.y2 = ((min * 0.5) * m) + b;
this.id = id; this.id = id;
} }
@ -57,10 +57,10 @@ public class Line implements Comparable<Line> {
this.m = m; this.m = m;
this.b = b; this.b = b;
this.x1 = calculateX1(MIN); this.x1 = calculateX1(max);
this.y1 = calculateY1(MIN); this.y1 = calculateY1(max);
this.x2 = calculateX2(MAX * 0.5); this.x2 = calculateX2(min * 0.5);
this.y2 = calculateY2(MAX * 0.5); this.y2 = calculateY2(min * 0.5);
} }
/** /**

View File

@ -12,13 +12,14 @@ import java.util.Set;
*/ */
public class LineModel { public class LineModel {
private Double max;
private Double min;
private Set<Line> lines; private Set<Line> lines;
private Double xMinimum; private Double xMinimum;
private Double xMaximum; private Double xMaximum;
private Double yMinimum; private Double yMinimum;
private Double yMaximum; private Double yMaximum;
private Double MIN;
private Double MAX;
private int size; private int size;
/** /**
@ -33,8 +34,8 @@ public class LineModel {
yMinimum = Double.MAX_VALUE; yMinimum = Double.MAX_VALUE;
yMaximum = Double.MIN_VALUE; yMaximum = Double.MIN_VALUE;
MIN = 0d; min = 0d;
MAX = 0d; max = 0d;
} }
@ -45,16 +46,16 @@ public class LineModel {
*/ */
public void addLine(Line line) { public void addLine(Line line) {
this.lines.add(line); this.lines.add(line);
MIN = line.getM() <= MIN ? line.getM() : MIN; min = line.getM() <= min ? line.getM() : min;
MAX = line.getM() >= MAX ? line.getM() : MAX; max = line.getM() >= max ? line.getM() : max;
} }
public Double getMIN() { public Double getMin() {
return MIN; return min;
} }
public Double getMAX() { public Double getMax() {
return MAX; return max;
} }
/** /**

View File

@ -9,6 +9,7 @@ import de.wwwu.awolf.presenter.util.Logging;
import de.wwwu.awolf.view.controller.AlgorithmTabController; import de.wwwu.awolf.view.controller.AlgorithmTabController;
import de.wwwu.awolf.view.services.DataService; import de.wwwu.awolf.view.services.DataService;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader; import javafx.fxml.FXMLLoader;
import javafx.scene.Parent; import javafx.scene.Parent;
import javafx.scene.control.*; import javafx.scene.control.*;
@ -30,8 +31,10 @@ public class ViewController {
private static final String TITLE = "Beta JavaFX"; private static final String TITLE = "Beta JavaFX";
private Parent pane; private Parent pane;
public TabPane tabPane; @FXML
public MenuBar menuBar; private TabPane tabPane;
@FXML
private MenuBar menuBar;
private Map<Algorithm.Type, AlgorithmTabController> algorithmTabControllers; private Map<Algorithm.Type, AlgorithmTabController> algorithmTabControllers;
public Map<Algorithm.Type, AlgorithmTabController> getAlgorithmTabControllers() { public Map<Algorithm.Type, AlgorithmTabController> getAlgorithmTabControllers() {

View File

@ -88,10 +88,10 @@ public class AlgorithmTabController {
if (pLine != null) { if (pLine != null) {
lineSerie.getData().clear(); lineSerie.getData().clear();
Double x1 = pLine.calculateX1(model.getMIN()); Double x1 = pLine.calculateX1(model.getMin());
Double y1 = pLine.calculateY1(model.getMIN()); Double y1 = pLine.calculateY1(model.getMin());
Double x2 = pLine.calculateX2(model.getMAX()); Double x2 = pLine.calculateX2(model.getMax());
Double y2 = pLine.calculateY2(model.getMAX()); Double y2 = pLine.calculateY2(model.getMax());
lineSerie.getData().add(new XYChart.Data<>(x1, y1)); lineSerie.getData().add(new XYChart.Data<>(x1, y1));
lineSerie.getData().add(new XYChart.Data<>(x2, y2)); lineSerie.getData().add(new XYChart.Data<>(x2, y2));

View File

@ -4,15 +4,10 @@ import de.wwwu.awolf.model.Line;
import de.wwwu.awolf.presenter.algorithms.Algorithm; import de.wwwu.awolf.presenter.algorithms.Algorithm;
import de.wwwu.awolf.presenter.algorithms.AlgorithmHandler; import de.wwwu.awolf.presenter.algorithms.AlgorithmHandler;
import org.junit.Before; import org.junit.Before;
import org.junit.Test;
import java.util.HashSet; import java.util.HashSet;
import java.util.List;
import java.util.Set; import java.util.Set;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
/** /**
* Implementierung verschiedener Algorithmen zur Berechnung von Ausgleichsgeraden. * Implementierung verschiedener Algorithmen zur Berechnung von Ausgleichsgeraden.
* *
@ -41,25 +36,4 @@ public class LeastMedianOfSquaresEstimatorTest {
} }
@Test
public void geEjValues() throws Exception {
Double[] expected = {36d, 50d, 60d, 74d, 108d};
List<Double> actual = lms.getEjValues(1d);
assertArrayEquals(expected, actual.toArray());
}
@Test
public void upperBound() throws Exception {
Line expected = new Line(5, 5, 146, 210);
assertEquals(expected.getX1(), line.getX1(), 0.01);
assertEquals(expected.getX2(), line.getX2(), 0.01);
assertEquals(expected.getY1(), line.getY1(), 0.01);
assertEquals(expected.getY2(), line.getY2(), 0.01);
}
} }