From e5c252ae99d2055d6182076a64d5418f1db1f94c Mon Sep 17 00:00:00 2001 From: TheDarkDesync <82680013+TheDarkDesync@users.noreply.github.com> Date: Tue, 1 Feb 2022 12:55:29 +0100 Subject: [PATCH] [fix] Sprache (#45) * [fix] language in doc * [fix] typo DataPoit Co-authored-by: Joshua Jeschek <64850647+joshuajeschek@users.noreply.github.com> * [fix] typo DataPoint agane Co-authored-by: Joshua Jeschek <64850647+joshuajeschek@users.noreply.github.com> * [fix] typo Datapoint copy paste Co-authored-by: Joshua Jeschek <64850647+joshuajeschek@users.noreply.github.com> * [fix] typo DataPoint copy paste II Co-authored-by: Joshua Jeschek <64850647+joshuajeschek@users.noreply.github.com> Co-authored-by: Joshua Jeschek <64850647+joshuajeschek@users.noreply.github.com> --- .../java/github/weichware10/util/Logger.java | 6 +-- .../github/weichware10/util/ToolType.java | 2 +- .../util/config/CodeChartsConfiguration.java | 4 -- .../weichware10/util/config/ConfigLoader.java | 10 ++-- .../weichware10/util/config/ConfigWriter.java | 4 +- .../util/config/Configuration.java | 4 -- .../util/config/EyeTrackingConfiguration.java | 2 - .../util/config/ZoomMapsConfiguration.java | 7 +-- .../weichware10/util/data/DataPoint.java | 20 +++---- .../weichware10/util/data/TrialData.java | 52 +++++-------------- .../weichware10/util/db/Configurations.java | 6 +-- .../weichware10/util/db/DataBaseClient.java | 6 +-- .../weichware10/util/db/Datapoints.java | 4 +- .../weichware10/util/db/Permissions.java | 4 +- .../github/weichware10/util/db/Trials.java | 22 ++++---- .../weichware10/util/gui/LogController.java | 2 - 16 files changed, 56 insertions(+), 99 deletions(-) diff --git a/src/main/java/github/weichware10/util/Logger.java b/src/main/java/github/weichware10/util/Logger.java index eab2768..f64f08e 100644 --- a/src/main/java/github/weichware10/util/Logger.java +++ b/src/main/java/github/weichware10/util/Logger.java @@ -42,16 +42,16 @@ public class Logger { public static final PrintStream PRINSTREAM = new PrintStream(logStream, true); /** - * Cannot be instantiated. + * Kann nicht instanziiert werden. */ private Logger() { throw new IllegalStateException("Cannot be instantiated"); } /** - * sets logfile. + * setzt log-Datei. * - * @param filename - the file + * @param filename - die Datei */ public static void setLogfile(String filename) { if (filename == null) { diff --git a/src/main/java/github/weichware10/util/ToolType.java b/src/main/java/github/weichware10/util/ToolType.java index 77ba0c7..69681fe 100644 --- a/src/main/java/github/weichware10/util/ToolType.java +++ b/src/main/java/github/weichware10/util/ToolType.java @@ -1,7 +1,7 @@ package github.weichware10.util; /** -* Tools of the Toolbox. +* Tools der Toolbox. */ public enum ToolType { ZOOMMAPS, EYETRACKING, CODECHARTS diff --git a/src/main/java/github/weichware10/util/config/CodeChartsConfiguration.java b/src/main/java/github/weichware10/util/config/CodeChartsConfiguration.java index 866a390..37c9be5 100644 --- a/src/main/java/github/weichware10/util/config/CodeChartsConfiguration.java +++ b/src/main/java/github/weichware10/util/config/CodeChartsConfiguration.java @@ -102,8 +102,6 @@ public CodeChartsConfiguration(String stringId, List strings, int[] init this.defaultVertical = defaultVertical; } - // --- GETTERS --- - public String getStringId() { return stringId; } @@ -148,8 +146,6 @@ public int getDefaultVertical() { return defaultVertical; } - // --- OVERRIDES --- - @Override public boolean equals(Object obj) { if (this == obj) { diff --git a/src/main/java/github/weichware10/util/config/ConfigLoader.java b/src/main/java/github/weichware10/util/config/ConfigLoader.java index 92d063e..5ba9322 100644 --- a/src/main/java/github/weichware10/util/config/ConfigLoader.java +++ b/src/main/java/github/weichware10/util/config/ConfigLoader.java @@ -15,7 +15,7 @@ public final class ConfigLoader { /** - * Cannot be instantiated. + * Kann nicht instanziiert werden. */ private ConfigLoader() { throw new IllegalStateException("Cannot be instantiated"); @@ -31,7 +31,7 @@ public static Configuration fromJson(String location) { try { ObjectMapper mapper = new ObjectMapper(); Configuration configuration; - // read from file + // aus Datei lesen configuration = mapper.readValue(new File(location), Configuration.class); return configuration; } catch (StreamReadException e) { @@ -54,14 +54,14 @@ public static Configuration fromJson(String location) { * @since v1.0 */ public static Configuration fromDataBase(String trialId, DataBaseClient dataBaseClient) { - // get configId from database + // configId von Datenbank abrufen final String configId = dataBaseClient.trials.getConfigId(trialId); - // trial not found or error + // trial nicht gefunden oder Fehler if (configId == null) { return null; } - // get config from database + // Konfiguration von Datenbank abrufen Configuration configuration = dataBaseClient.configurations.get(configId); configuration.trialId = trialId; return configuration; diff --git a/src/main/java/github/weichware10/util/config/ConfigWriter.java b/src/main/java/github/weichware10/util/config/ConfigWriter.java index 7e69dc9..d877310 100644 --- a/src/main/java/github/weichware10/util/config/ConfigWriter.java +++ b/src/main/java/github/weichware10/util/config/ConfigWriter.java @@ -19,7 +19,7 @@ public final class ConfigWriter { /** - * Cannot be instantiated. + * Kann nicht instanziiert werden. */ private ConfigWriter() { throw new IllegalStateException("Cannot be instantiated"); @@ -34,7 +34,7 @@ private ConfigWriter() { * @since v0.2 */ public static boolean toJson(String location, Configuration configuration) { - // only write to JSON files + // nur als JSON schreiben if (!location.endsWith(".json")) { return false; } diff --git a/src/main/java/github/weichware10/util/config/Configuration.java b/src/main/java/github/weichware10/util/config/Configuration.java index 5019a45..110cce4 100644 --- a/src/main/java/github/weichware10/util/config/Configuration.java +++ b/src/main/java/github/weichware10/util/config/Configuration.java @@ -67,8 +67,6 @@ public Configuration(String configId, String question, String imageUrl, this.zoomMapsConfiguration = zoomMapsConfiguration; } - // --- GETTERS --- - public ToolType getToolType() { return toolType; } @@ -109,8 +107,6 @@ public ZoomMapsConfiguration getZoomMapsConfiguration() { return zoomMapsConfiguration; } - // --- OVERRIDES --- - @Override public boolean equals(Object obj) { if (this == obj) { diff --git a/src/main/java/github/weichware10/util/config/EyeTrackingConfiguration.java b/src/main/java/github/weichware10/util/config/EyeTrackingConfiguration.java index 52c6236..303032f 100644 --- a/src/main/java/github/weichware10/util/config/EyeTrackingConfiguration.java +++ b/src/main/java/github/weichware10/util/config/EyeTrackingConfiguration.java @@ -8,8 +8,6 @@ public class EyeTrackingConfiguration { protected float pollIntervall = 4.20f; - // GETTER - public float getPollIntervall() { return pollIntervall; } diff --git a/src/main/java/github/weichware10/util/config/ZoomMapsConfiguration.java b/src/main/java/github/weichware10/util/config/ZoomMapsConfiguration.java index b116b7f..95d9ea9 100644 --- a/src/main/java/github/weichware10/util/config/ZoomMapsConfiguration.java +++ b/src/main/java/github/weichware10/util/config/ZoomMapsConfiguration.java @@ -9,8 +9,7 @@ public class ZoomMapsConfiguration { protected double imageViewHeight = 400; /** - * leerer Konstruktor. Wird für Jackson gebraucht (json writer) - * smooth criminal. + * leerer Konstruktor der für Jackson benötigt wird (json writer). */ public ZoomMapsConfiguration() { // leer @@ -29,8 +28,6 @@ public ZoomMapsConfiguration(double speed, double imageViewWidth, double imageVi this.imageViewHeight = imageViewHeight; } - // --- GETTER --- - public double getSpeed() { return speed; } @@ -43,8 +40,6 @@ public double getImageViewHeight() { return imageViewHeight; } - // --- OVERRIDES --- - @Override public boolean equals(Object obj) { if (this == obj) { diff --git a/src/main/java/github/weichware10/util/data/DataPoint.java b/src/main/java/github/weichware10/util/data/DataPoint.java index 90d1517..cbee84e 100644 --- a/src/main/java/github/weichware10/util/data/DataPoint.java +++ b/src/main/java/github/weichware10/util/data/DataPoint.java @@ -6,7 +6,7 @@ import javafx.geometry.Rectangle2D; /** - * Stores a single DataPoint. + * Speichert einen einzelnen Datenpunkt. * * @since v0.2 */ @@ -19,8 +19,8 @@ public class DataPoint { /** * Konstruktor für Jackson. * - * @param dataId - the id of the dataPoint - * @param timeOffset - the time since the trial started + * @param dataId - die ID des dataPoints + * @param timeOffset - die Zeit seit Versuchstart * @param viewport - aktueller Ausschnitt beim ZoomBild * * @since v1.0 @@ -42,10 +42,10 @@ public DataPoint(@JsonProperty("dataId") int dataId, } /** - * Stores a single DataPoint without depth. (ZOOMMAPS) + * Speichert einen einzelnen Datenpunkt ohne Tiefe (ZOOMMAPS). * - * @param dataId - the id of the dataPoint - * @param timeOffset - the time since the trial started + * @param dataId - die ID des dataPoints + * @param timeOffset - die Zeit seit Versuchstart * @param viewport - aktueller Ausschnitt beim ZoomBild * * @since v0.2 @@ -58,11 +58,11 @@ public DataPoint(int dataId, int timeOffset, Rectangle2D viewport) { } /** - * Stores a single DataPoint with depth (CODECHARTS). + * Speichert einen einzelnen Datenpunkt mit Tiefe (CODECHARTS). * - * @param dataId - the id of the dataPoint - * @param timeOffset - the time since the trial started - * @param viewport - aktuell angeschautes Raster. + * @param dataId - die ID des dataPoints + * @param timeOffset - die Zeit seit Versuchstart + * @param viewport - aktuell angeschautes Raster * @param depth - Rastertiefe * * @since v0.3 diff --git a/src/main/java/github/weichware10/util/data/TrialData.java b/src/main/java/github/weichware10/util/data/TrialData.java index 9a8919c..c6f82ec 100644 --- a/src/main/java/github/weichware10/util/data/TrialData.java +++ b/src/main/java/github/weichware10/util/data/TrialData.java @@ -22,9 +22,9 @@ import org.joda.time.DateTime; /** - * Stores the TrialData for the different tools internally. + * Speichert die TrialData für die verschiedenen Tools intern. * - *

also used to transfer Data + *

auch für die Datenübertragung genutzt * * @since v0.2 */ @@ -40,9 +40,9 @@ public class TrialData { /** * Konstruktor für Jackson. * - * @param toolType - the tooltype of the stored data - * @param trialId - the id of the trial - * @param configId - the configuration of the stored data + * @param toolType - Tool-Typ des Versuchs + * @param trialId - ID des Versuchs + * @param configId - Konfiguration des Versuchs * @param startTime - Startzeitpunkt des Versuchs * * @since v1.0 @@ -61,11 +61,11 @@ public TrialData(@JsonProperty("toolType") ToolType toolType, } /** - * Stores the TrialData for the different tools internally. + * Speichert die TrialData für die verschiedenen Tools intern. * - * @param toolType - the tooltype of the stored data - * @param trialId - the id of the trial - * @param configId - the configuration of the stored data + * @param toolType - Tool-Typ des Versuchs + * @param trialId - ID des Versuchs + * @param configId - Konfiguration des Versuchs * * @since v0.2 */ @@ -77,37 +77,14 @@ public TrialData(ToolType toolType, String trialId, String configId) { this.dataPoints = new ArrayList(); } - // --- GETTERS --- - - /** - * get the stored dataPoints. - * - * @return the stored dataPoints - * - * @since v0.2 - */ public List getData() { return dataPoints; } - /** - * get the answer. - * - * @return the answer - * - * @since v0.3 - */ public String getAnswer() { return answer; } - // --- SETTERS --- - - /** - * set the answer. - * - * @param answer - the answer - */ public void setAnswer(String answer) { this.answer = answer; } @@ -129,8 +106,7 @@ public DateTime getStartTime() { } /** - * Add a DataPoint for CodeCharts. - * + * Fügt ein Datenpunkt hinzu (CodeCharts). * * @since v0.2 */ @@ -148,7 +124,7 @@ public void addDataPoint(Rectangle2D viewport, int depth) { } /** - * Add a DataPoint for ZoomMaps. + * Fügt ein Datenpunkt hinzu (ZoomMaps). * * @param viewport - aktueller Ausschnitt beim ZoomBild * @@ -179,7 +155,7 @@ public static TrialData fromJson(String location) { try { ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new JodaModule()); - // read from file + // aus Datei lesen trialData = mapper.readValue(new File(location), TrialData.class); } catch (StreamReadException e) { Logger.info("An error occured while loading a trial", e, true); @@ -201,7 +177,7 @@ public static TrialData fromJson(String location) { * @since v1.0 */ public static boolean toJson(String location, TrialData trialData) { - // only write to JSON files + // nur als JSON schreiben if (!location.endsWith(".json")) { return false; } @@ -230,8 +206,6 @@ public static boolean toJson(String location, TrialData trialData) { return false; // Schreiben war nicht erfolgreich } - // --- OVERRIDES --- - @Override public String toString() { return String.format(""" diff --git a/src/main/java/github/weichware10/util/db/Configurations.java b/src/main/java/github/weichware10/util/db/Configurations.java index cc1491d..94df76b 100644 --- a/src/main/java/github/weichware10/util/db/Configurations.java +++ b/src/main/java/github/weichware10/util/db/Configurations.java @@ -22,7 +22,7 @@ public class Configurations { /** * Erstellt eine neue Verbindung zur Configurations-Tabelle. * - * @param dataBaseClient - übergeordneter DataBadeClient + * @param dataBaseClient - übergeordneter DataBaseClient */ protected Configurations(DataBaseClient dataBaseClient) { this.dataBaseClient = dataBaseClient; @@ -44,7 +44,7 @@ public Configuration get(String configId) { Statement st = null; ResultSet rs = null; - // get resultset + // ResultSet bekommen try { conn = DriverManager.getConnection(dataBaseClient.url, dataBaseClient.props); st = conn.createStatement(); @@ -161,7 +161,7 @@ public String set(Configuration configuration) { if (configuration.getToolType() == ToolType.CODECHARTS) { CodeChartsConfiguration ccConfig = configuration.getCodeChartsConfiguration(); - // strings setzen + // Strings setzen if (dataBaseClient.strings.sizeOf(ccConfig.getStringId()) == 0) { dataBaseClient.strings.set(ccConfig.getStringId(), ccConfig.getStrings()); } diff --git a/src/main/java/github/weichware10/util/db/DataBaseClient.java b/src/main/java/github/weichware10/util/db/DataBaseClient.java index 44682d7..a6869e0 100644 --- a/src/main/java/github/weichware10/util/db/DataBaseClient.java +++ b/src/main/java/github/weichware10/util/db/DataBaseClient.java @@ -76,17 +76,17 @@ public DataBaseClient(String url, String user, String password, String schema) { * @return Existenzboolean */ private boolean tableExists(String table) { - // query + // Abfrage final String queryFormat = """ SELECT table_schema, table_name FROM information_schema.tables WHERE table_schema='%s' AND table_name='%s'; """; final String query = String.format(queryFormat, schema, table); - // result + // Resultate boolean exists = false; - // database objects + // Datenbank Objekte Connection conn = null; Statement st = null; ResultSet rs = null; diff --git a/src/main/java/github/weichware10/util/db/Datapoints.java b/src/main/java/github/weichware10/util/db/Datapoints.java index 12107b0..9baa075 100644 --- a/src/main/java/github/weichware10/util/db/Datapoints.java +++ b/src/main/java/github/weichware10/util/db/Datapoints.java @@ -49,7 +49,7 @@ public List get(String trialId) { st = conn.createStatement(); rs = st.executeQuery(query); while (rs.next()) { - // bei zoommaps versuchen + // bei ZoomMaps versuchen Map viewport = new HashMap<>(); viewport.put("minX", rs.getDouble("viewportmin_x")); viewport.put("minY", rs.getDouble("viewportmin_y")); @@ -109,7 +109,7 @@ public void set(List dataPoints, String trialId) { pst.setInt(2, dp.dataId); pst.setInt(3, dp.timeOffset); - // nur codecharts hat depth + // nur CodeCharts hat depth if (dp.depth == null) { pst.setNull(8, java.sql.Types.INTEGER); } else { diff --git a/src/main/java/github/weichware10/util/db/Permissions.java b/src/main/java/github/weichware10/util/db/Permissions.java index 2f60145..f383ded 100644 --- a/src/main/java/github/weichware10/util/db/Permissions.java +++ b/src/main/java/github/weichware10/util/db/Permissions.java @@ -64,7 +64,7 @@ public Permissions(DataBaseClient dataBaseClient) { * @return Berechtigungs-Liste */ private Set getPermissions(String table) { - // query + // Abfrage // Beschränkung auf interessante Werte final String queryF = """ SELECT DISTINCT privilege_type @@ -130,7 +130,7 @@ private boolean permissionsSatisfies(Collection desired, } private boolean satisfiesAdmin() { - // has every interesting permission + // hat alle Rechte return satisfies( Arrays.asList(Permission.values()), Arrays.asList(Permission.values()), diff --git a/src/main/java/github/weichware10/util/db/Trials.java b/src/main/java/github/weichware10/util/db/Trials.java index 8423dd9..a619558 100644 --- a/src/main/java/github/weichware10/util/db/Trials.java +++ b/src/main/java/github/weichware10/util/db/Trials.java @@ -43,7 +43,7 @@ public String getConfigId(String trialId) { Statement st = null; ResultSet rs = null; - // get resultset + // ResultSet bekommen try { conn = DriverManager.getConnection(dataBaseClient.url, dataBaseClient.props); st = conn.createStatement(); @@ -147,7 +147,7 @@ public boolean set(TrialData trialData) { pst.setString(2, trialData.getAnswer()); pst.setString(3, trialData.trialId); pst.executeUpdate(); - // DATAPOINTS setzen + // DataPoints setzen dataBaseClient.datapoints.set(trialData.getData(), trialData.trialId); success = true; } catch (SQLException e) { @@ -227,7 +227,7 @@ public List add(String configId, int amount) { Connection conn = null; PreparedStatement pst = null; - // Verbindungs try + // Verbindungs-Versuch try { conn = DriverManager.getConnection(dataBaseClient.url, dataBaseClient.props); pst = conn.prepareStatement(queryF); @@ -244,7 +244,7 @@ public List add(String configId, int amount) { trialId = Util.generateId("tri_", 7); } - // INSERT try + // Einfügungs-Versuch try { pst.setString(1, trialId); pst.setString(2, configId); @@ -286,7 +286,7 @@ public List add(String configId, int amount) { public List getList(String configId, ToolType toolType, DateTime minTime, DateTime maxTime, int amount) { - // QUERY + // Abfrage final String queryF = """ SELECT t.trialid, t.configid, c.tooltype, t.starttime, t.answer FROM %s.trials AS t @@ -299,13 +299,13 @@ public List getList(String configId, ToolType toolType, LIMIT %d; """; - // only query for minTime if provided + // Abfrage nur für minTime, falls bereitgestellt final String minTimeQuery = (minTime != null) ? String.format("t.starttime >= timestamp '%s'", new Timestamp(minTime.getMillis()).toString()) : "true"; - // only query for maxTime if provided + //Abfrage nur für maxTime, falls bereitgestellt final String maxTimeQuery = (maxTime != null) ? String.format("t.starttime <= timestamp '%s'", new Timestamp(maxTime.getMillis()).toString()) @@ -313,16 +313,16 @@ public List getList(String configId, ToolType toolType, final String query = String.format(queryF, dataBaseClient.schema, - (configId != null) ? configId : '%', // match every configId - (toolType != null) ? toolType.toString() : '%', // match every tooltype + (configId != null) ? configId : '%', // jede configId passt + (toolType != null) ? toolType.toString() : '%', // jeder tooltype passt minTimeQuery, maxTimeQuery, (amount > 0) ? amount : 50); - // RESULT + // Ergebnis List result = new ArrayList(); - // DATABASE OBJECTS + // Datenbankobjekte Connection conn = null; Statement st = null; ResultSet rs = null; diff --git a/src/main/java/github/weichware10/util/gui/LogController.java b/src/main/java/github/weichware10/util/gui/LogController.java index 3ff800c..6596bf9 100644 --- a/src/main/java/github/weichware10/util/gui/LogController.java +++ b/src/main/java/github/weichware10/util/gui/LogController.java @@ -22,8 +22,6 @@ public class LogController extends AbsSceneController { private ResourceBundle resources; @FXML private URL location; - - @FXML private TextField logInput; @FXML