From ae881bd8ac450d4ff19c4cc20b21b86e46b16ce1 Mon Sep 17 00:00:00 2001 From: MikeZyeman Date: Fri, 5 Nov 2021 11:10:19 +0100 Subject: [PATCH] Generated TextLogik, renamed SystemInput to TextInput --- src/SystemInput.java | 21 --------------------- src/TextEditor.java | 25 +------------------------ src/TextInput.java | 10 ++++++++++ src/TextLogik.java | 24 ++++++++++++++++++++++++ 4 files changed, 35 insertions(+), 45 deletions(-) delete mode 100644 src/SystemInput.java create mode 100644 src/TextInput.java create mode 100644 src/TextLogik.java diff --git a/src/SystemInput.java b/src/SystemInput.java deleted file mode 100644 index ad1ca04..0000000 --- a/src/SystemInput.java +++ /dev/null @@ -1,21 +0,0 @@ -import java.util.Scanner; - -public class SystemInput { - - private Scanner scanner; - - public SystemInput() { - scanner = new Scanner(""); - } - - /** - * Method: CheckForInput - */ - public String[] checkForInput() { - - return new String[] { - "Test" - }; - } - -} diff --git a/src/TextEditor.java b/src/TextEditor.java index a65579e..b263df5 100644 --- a/src/TextEditor.java +++ b/src/TextEditor.java @@ -1,31 +1,8 @@ public class TextEditor { - private SystemInput sysInput; - private Text text; public static void main(String[] args) { - TextEditor t = new TextEditor(); - } - - public TextEditor() { - sysInput = new SystemInput(); - text = new Text(); - String command[]; - - do { - command = sysInput.checkForInput(); - - switch (command[0]) { - case "ADD": - break; - case "REMOVE": - break; - default: - System.out.println("Command not found. Try again"); - break; - } - - } while ("exit".equals(command[0])); + TextLogik tl = new TextLogik(); } } diff --git a/src/TextInput.java b/src/TextInput.java new file mode 100644 index 0000000..e28015d --- /dev/null +++ b/src/TextInput.java @@ -0,0 +1,10 @@ +import java.util.Scanner; + +public class TextInput { + + private static Scanner sc = new Scanner(""); + + public static String[] checkForInput() { + return sc.nextLine().split(""); + } +} diff --git a/src/TextLogik.java b/src/TextLogik.java new file mode 100644 index 0000000..3064b61 --- /dev/null +++ b/src/TextLogik.java @@ -0,0 +1,24 @@ +public class TextLogik { + private Text text; + + public TextLogik() { + text = new Text(); + String command[]; + + do { + command = TextInput.checkForInput(); + + switch (command[0]) { + case "ADD": + break; + case "REMOVE": + break; + default: + System.out.println("Command not found. Try again"); + break; + } + + } while ("exit".equals(command[0])); + } + +}