merge development into test #26

Merged
j23f0712 merged 95 commits from development into dev/test 2024-12-01 21:02:48 +01:00
Showing only changes of commit 3467dd2f04 - Show all commits

View File

@@ -26,16 +26,33 @@ public enum Color {
*/
NONE;
/**
* This method will be used to return a Color enumeration depending on the given index parameter.
*
* @param index as the index of the color inside the values as an Integer.
* @return a Color enumeration.
*/
public static Color getColorByIndex(int index) {
if (index < 0 || index >= values().length) {
throw new IllegalArgumentException("");
}
return values()[index];
}
/**
* This method will be used to calculate the next color inside the sequence.
*
* @return color as a Color Enumeration.
*/
public Color next() {
if (this.next() == NONE) {
return AIRFORCE;
Color[] colors = values();
int nextIndex = (this.ordinal() + 1) % colors.length;
if (colors[nextIndex] == NONE) {
nextIndex = (nextIndex + 1) % colors.length;
}
return values()[(ordinal() + 1) % values().length];
return colors[nextIndex];
}
}