From e7f3679e0f8bf0436eda5e8a91ed53574749ef55 Mon Sep 17 00:00:00 2001 From: Georg Reisinger Date: Wed, 30 Dec 2020 14:39:20 +0100 Subject: [PATCH] EnumHelper + setDeck /deck + getDeck /deck + getDeckPlain + /deck?format=plain + started Trading --- .../reisinger/server/helper/EnumHelper.java | 2 + .../at/reisinger/server/msg/MsgHandler.java | 89 ------------------- 2 files changed, 2 insertions(+), 89 deletions(-) create mode 100644 src/main/java/at/reisinger/server/helper/EnumHelper.java delete mode 100644 src/main/java/at/reisinger/server/msg/MsgHandler.java diff --git a/src/main/java/at/reisinger/server/helper/EnumHelper.java b/src/main/java/at/reisinger/server/helper/EnumHelper.java new file mode 100644 index 0000000..df59604 --- /dev/null +++ b/src/main/java/at/reisinger/server/helper/EnumHelper.java @@ -0,0 +1,2 @@ +package at.reisinger.server.helper;public class EnumHelper { +} diff --git a/src/main/java/at/reisinger/server/msg/MsgHandler.java b/src/main/java/at/reisinger/server/msg/MsgHandler.java deleted file mode 100644 index f9f609a..0000000 --- a/src/main/java/at/reisinger/server/msg/MsgHandler.java +++ /dev/null @@ -1,89 +0,0 @@ -package at.reisinger.server.msg; - -import at.reisinger.server.objects.Msg; - -import java.util.HashMap; - -/** - * Der Speicher der Nachrichten - * Mit hilfe einer HashMap werden die MsgId und die Msg selbst gespeichert - * @author Georg Reisinger - */ -public class MsgHandler { - private HashMap msgHashMap; - private int lastID; - - /** - * Erstellt den MsgHandler mit standart Test Messages - */ - public MsgHandler(){ - msgHashMap = new HashMap(); - addMsg("Hallo"); - addMsg("Wie"); - addMsg("Geht"); - addMsg("Es"); - addMsg("Dir?"); - - } - - /** - * Ermitelt die nächste freie Id - * @return Next ID - */ - private int nextId(){ - return this.lastID + 1; - } - - /** - * Msg hinzufügen - * @param msg Message Text - */ - public int addMsg(String msg){ - int id = nextId(); - msgHashMap.put(id, msg); - this.lastID = id; - return id; - } - - /** - * Msg löschen - * @param id Message Id - */ - public String delMsg(int id){ - return msgHashMap.remove(id); - } - - /** - * Msg bearbeiten - * @param id Message Id - * @param msg Message Text - */ - public String editMsg(int id, String msg){ - return msgHashMap.replace(id, msg); - } - - /** - * Msg als Objekt holen - * @param id Message Id - * @return Message als Msg Objekt - */ - public Msg getMsg(int id){ - return new Msg(id, msgHashMap.get(id)); - } - - /** - * Alle Nachrichten werden in den Format Key, Value besorgt - * bsp: key: 1 value: Nachricht - * @return Alle nachrichten in einem String - */ - public String getAllMsg(){ - String returnStr = ""; - // Print keys and values - for (Integer i : msgHashMap.keySet()) { - String item = "key: " + i + " value: " + msgHashMap.get(i) + "\n"; - returnStr += item; - } - System.out.println(returnStr); - return returnStr; - } -}