Skip to content
Snippets Groups Projects
Commit 878b5ac7 authored by Andrey Ruzhanskiy's avatar Andrey Ruzhanskiy
Browse files

Make branch checkstyle ready

parent 9008df07
No related branches found
No related tags found
1 merge request!40feat/line rasterizer 31
......@@ -253,7 +253,7 @@ public final class App {
PrintDirector printD = new PrintDirector(PrinterCapability.valueOf(indexV4Printer.getProperty("mode").toString().toUpperCase()), indexV4Printer);
Iterator<MatrixData<Boolean>> itera = canvas.getPageIterator();
itera.next();
while(itera.hasNext()) {
while (itera.hasNext()) {
MatrixData<Boolean> page = itera.next();
printD.print(page);
}
......
......@@ -2,7 +2,6 @@ package de.tudresden.inf.mci.brailleplot.diagrams;
import de.tudresden.inf.mci.brailleplot.datacontainers.PointList;
import de.tudresden.inf.mci.brailleplot.datacontainers.PointListContainer;
import de.tudresden.inf.mci.brailleplot.rendering.Renderable;
import java.util.Objects;
......
......@@ -8,7 +8,6 @@ import de.tudresden.inf.mci.brailleplot.layout.RasterCanvas;
import de.tudresden.inf.mci.brailleplot.layout.Rectangle;
import de.tudresden.inf.mci.brailleplot.point.Point2DDouble;
import de.tudresden.inf.mci.brailleplot.printabledata.MatrixData;
import de.tudresden.inf.mci.brailleplot.rendering.language.BrailleLanguage;
import java.util.ArrayList;
import java.util.HashMap;
......
......@@ -15,6 +15,10 @@ public class BrailleText implements Renderable {
private String mContent;
private Rectangle mArea;
/**
* Getter for the associated language used in this braille text.
* @return String containing the language
*/
public String getLanguage() {
return mLanguage;
}
......@@ -32,7 +36,7 @@ public class BrailleText implements Renderable {
mLanguage = "de-g0.utb";
}
public BrailleText(final String content, final Rectangle area, BrailleLanguage.Language language) {
public BrailleText(final String content, final Rectangle area, final BrailleLanguage.Language language) {
setText(content);
setArea(area);
mLanguage = BrailleLanguage.getCorrectLanguage(language);
......
......@@ -42,7 +42,7 @@ public class LineChartRasterizer implements Rasterizer<LineChart> {
private double mDpiX;
private double mDpiY;
@SuppressWarnings("magicnumber")
private int offset = 3;
private int mOffset = 3;
private Rectangle mCellLineArea;
private boolean printOnSamePaper = false; // If you want to print on the same paper, change this variable to true.
......@@ -272,14 +272,14 @@ public class LineChartRasterizer implements Rasterizer<LineChart> {
* For example: 2.5 -> a, 3.0 -> b and so on.
* @return A map containing the correct number of labels which will be needed to address all datapoints in {@link LineChart}.
*/
@SuppressWarnings("finalparameters")
@SuppressWarnings({"finalparameters", "magicnumber"})
private Map<Integer, String> setCorrectLabelsforY(final double rangeOfYValues, final int numberOfTicks, double dpi, Map<String, String> yLabelsForLegend) {
Objects.requireNonNull(yLabelsForLegend, "The given map for setting the correct labels for the y-axis was null!");
double min = mDiagram.getData().getMinY();
Map<Integer, String> result = new HashMap<>();
double tmpDpi = dpi;
// According to a not representative study the y axis should start with a on the highest value, to the lowest.
// According to a not representative study the y axis should start with 'a' on the highest value, not the lowest.
// So we need to calculate an offset and decrement the letter
// Works currently only with letters represented in ASCII
int datapoints = (int) ceil(rangeOfYValues / dpi);
......@@ -472,8 +472,8 @@ public class LineChartRasterizer implements Rasterizer<LineChart> {
private Rectangle calculateXAxis() throws InsufficientRenderingAreaException {
Objects.requireNonNull(mCellLineArea, "The given Rectangle for the x axis to be removed from was null!");
try {
Rectangle result = mCellLineArea.removeFromBottom(offset);
result.removeFromLeft(offset);
Rectangle result = mCellLineArea.removeFromBottom(mOffset);
result.removeFromLeft(mOffset);
return result;
} catch (Rectangle.OutOfSpaceException e) {
throw new InsufficientRenderingAreaException("Not enough space to build the X-Axis for the line chart!");
......@@ -489,7 +489,7 @@ public class LineChartRasterizer implements Rasterizer<LineChart> {
private Rectangle calculateYAxis() throws InsufficientRenderingAreaException {
Objects.requireNonNull(mCellLineArea, "The given Rectangle for the y axis to be removed from was null!");
try {
return mCellLineArea.removeFromLeft(offset);
return mCellLineArea.removeFromLeft(mOffset);
} catch (Rectangle.OutOfSpaceException e) {
throw new InsufficientRenderingAreaException("Not enough space to build the Y-Axis for the line chart!");
}
......
package de.tudresden.inf.mci.brailleplot.rendering.language;
/**
* Helper class for braillelanguage
* Helper class for braillelanguage.
* @author Andrey Ruzhanskiy
* @version 27.09.2019
*/
// If we want to use this class, it has to be public
@SuppressWarnings("HideUtilityClassConstructor")
public class BrailleLanguage {
public static String getCorrectLanguage(Language language){
/**
* Method to get the correct name of the table for the given enum.
* @param language Enum, for which the table is to be known.
* @return String containing the name of the table.
*/
public static String getCorrectLanguage(final Language language) {
switch (language) {
case GERMAN_VOLLSCHRIFT:
case DE_VOLLSCHRIFT:
......@@ -18,11 +26,14 @@ public class BrailleLanguage {
case GERMAN_KURZSCHRIFT:
case DE_KURZSCHRIFT:
return "de-g2.ctb";
default: throw new RuntimeException("Unsupported language given as braillelanguage! \"" + language.toString() + "\"");
}
throw new RuntimeException("Unsupported language given as braillelanguage! \"" + language.toString() + "\"");
}
/**
* Enum describing the current supported braille languages and grammars.
*/
public enum Language {
DE_KURZSCHRIFT,
DE_BASISSCHRIFT,
......
/**
* This package contains the language helper class and the braille language declaration.
*/
package de.tudresden.inf.mci.brailleplot.rendering.language;
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment