From 8b38f68021e0c10fe159e772f176b7419ca8b6e3 Mon Sep 17 00:00:00 2001 From: FloriN <lisa.nicomisch@tutamail.com> Date: Mon, 2 Dec 2019 16:05:40 +0100 Subject: [PATCH] Doku Threads, App, Main --- src/main/java/projekt/enigma/App.java | 24 ++++++++++++------- src/main/java/projekt/enigma/Main.java | 4 ++-- .../projekt/enigma/threads/ThreadApp.java | 10 +++++--- .../enigma/threads/ThreadFunkraum.java | 22 +++++++---------- 4 files changed, 34 insertions(+), 26 deletions(-) diff --git a/src/main/java/projekt/enigma/App.java b/src/main/java/projekt/enigma/App.java index 84a5b30..43b97bd 100644 --- a/src/main/java/projekt/enigma/App.java +++ b/src/main/java/projekt/enigma/App.java @@ -10,19 +10,24 @@ import java.io.IOException; /** * JavaFX App + * Startklasse fuer JavaFX Application, durch die Erweiterung um die Klasse Application. + * Baut die Benutzeroberflaeche in ihren Grundstrukturen auf. */ public class App extends Application { /** * TODO Dokumentieren + * + * scene : Scene : deklariert die Scene der GUI */ private static Scene scene; /** * TODO Dokumentieren + * setzt die fxml-Datei * - * @param fxml - * @throws IOException + * @param fxml : String : Ort der fxml + * @throws IOException : wirft Exception, wenn die Datei nicht gefunden/geladen werden konnte */ static void setRoot(String fxml) throws IOException { scene.setRoot(loadFXML(fxml)); @@ -30,10 +35,11 @@ public class App extends Application { /** * TODO Dokumentieren + * laedt die fxml-Datei * - * @param fxml - * @return - * @throws IOException + * @param fxml : String : Ort der fxml + * @return fxml wird geladen + * @throws IOException : wirft Exception, wenn die Datei nicht gefunden/geladen werden konnte */ private static Parent loadFXML(String fxml) throws IOException { FXMLLoader fxmlLoader = new FXMLLoader(App.class.getResource(fxml + ".fxml")); @@ -42,8 +48,9 @@ public class App extends Application { /** * TODO Dokumentieren + * Standard-main-Methode, die die erweiterte Klasse Application startet * - * @param args + * @param args : String[] : Terminalparameter */ public static void main(String[] args) { Application.launch(); @@ -51,9 +58,10 @@ public class App extends Application { /** * TODO Dokumentieren + * Deklariert und initialisiert die Stage. * - * @param stage - * @throws IOException + * @param stage : Stage : Aufbau der Stage in der Scene + * @throws IOException : wirft Exception, wenn die Datei nicht gefunden/geladen werden konnte */ @Override public void start(Stage stage) throws IOException { diff --git a/src/main/java/projekt/enigma/Main.java b/src/main/java/projekt/enigma/Main.java index 31b558d..ec28c83 100644 --- a/src/main/java/projekt/enigma/Main.java +++ b/src/main/java/projekt/enigma/Main.java @@ -10,9 +10,9 @@ public class Main { public static void main(String[] args) throws SQLException { Thread app = new Thread(new ThreadApp()); -// Thread funk = new Thread(new ThreadFunkraum()); + Thread funk = new Thread(new ThreadFunkraum()); app.start(); -// funk.start(); + funk.start(); } } diff --git a/src/main/java/projekt/enigma/threads/ThreadApp.java b/src/main/java/projekt/enigma/threads/ThreadApp.java index 47cbfb2..faae51d 100644 --- a/src/main/java/projekt/enigma/threads/ThreadApp.java +++ b/src/main/java/projekt/enigma/threads/ThreadApp.java @@ -2,14 +2,18 @@ package projekt.enigma.threads; import projekt.enigma.App; -import java.sql.SQLException; - +/** + * Thread fuer die Benutzeroberflaeche, wird durch das Interface Runnable erweitert + */ public class ThreadApp implements Runnable { private String[] args; + /** + * Ueberschriebene Funktion - fuehrt die Klasse App aus + */ @Override public void run() { - System.out.println("ThreadApp" + Thread.currentThread()); + System.out.println("ThreadApp " + Thread.currentThread()); App app = new App(); app.main(args); diff --git a/src/main/java/projekt/enigma/threads/ThreadFunkraum.java b/src/main/java/projekt/enigma/threads/ThreadFunkraum.java index b4a978d..7ef5014 100644 --- a/src/main/java/projekt/enigma/threads/ThreadFunkraum.java +++ b/src/main/java/projekt/enigma/threads/ThreadFunkraum.java @@ -1,26 +1,22 @@ package projekt.enigma.threads; -import org.apache.http.HttpException; import projekt.enigma.model.Codierer; import projekt.enigma.model.Funkraum; -import java.io.IOException; - +/** + * Thread fuer den Funkraum, wird durch das Interface Runnable erweitert + */ public class ThreadFunkraum implements Runnable { String kenngruppe = new Codierer().getKenngruppe(); -// String funkspruch; + + /** + * Ueberschriebene Funktion - fuehrt die Klasse Funkraum aus und startet + */ @Override public void run() { Funkraum funkraum = new Funkraum(); - System.out.println("Threadfunkraum" + Thread.currentThread()); + System.out.println("Threadfunkraum" + Thread.currentThread()); funkraum.empfangeFunkspruch(kenngruppe); - -// try { -// funkraum.sendeFunkspruch(funkspruch, kenngruppe); -// } catch (HttpException he) { -// System.err.println("Error"); -// } catch (IOException io) { -// System.err.println("Error"); -// } } } + -- GitLab