From f90aed7bbbeba9b3a0eb5cde6d2c578c169cadfc Mon Sep 17 00:00:00 2001 From: Daniel Grigencha Date: Thu, 5 Dec 2024 04:51:55 +0100 Subject: [PATCH] Updated 'Color' enum. Updated the 'Color' enum by adjusting the JavaDocs and adding a new static method 'getColor(int)' --- .../src/main/java/pp/mdga/game/Color.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Projekte/mdga/model/src/main/java/pp/mdga/game/Color.java b/Projekte/mdga/model/src/main/java/pp/mdga/game/Color.java index 76d4e17b..0fd652c8 100644 --- a/Projekte/mdga/model/src/main/java/pp/mdga/game/Color.java +++ b/Projekte/mdga/model/src/main/java/pp/mdga/game/Color.java @@ -3,8 +3,8 @@ import com.jme3.network.serializing.Serializable; /** - * This enumeration will be used to show the four different TSK which can be picked from a player. - * In Addition, the NONE color will be used to show a none color. + * This enumeration represents the four different TSK colors that a player can choose. + * Additionally, the NONE color indicates the absence of a color. */ @Serializable public enum Color { @@ -58,4 +58,19 @@ public Color next() { return colors[nextIndex]; } + + /** + * This method will be used to return the color of the given index. + * + * @param i as the index of the color as an Integer. + * @return a Color enumeration. + */ + public static Color getColor(int i) { + for (Color color : Color.values()) { + if (color.ordinal() == i) { + return color; + } + } + return null; + } }