mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-28 14:57:12 +00:00
re-consolidating ORC icon stuff into BoatClassMasterdata for now; major refactoring would be required otherwise
This commit is contained in:
1 parent
bdfb763037
commit
a7a52fbee8
3 files changed
+10
-60
No files matched your search
+7
-1
@@ -59,7 +59,13 @@ public enum BoatClassMasterdata {
|
||||
FLYING_DUTCHMAN ("Flying Dutchman", true, 6.10, 1.80, BoatHullType.MONOHULL, true),
|
||||
DYAS("Dyas", true, 7.15, 1.95, BoatHullType.MONOHULL, true),
|
||||
INTERNATIONAL_14("International 14", true, 4.27, 1.83, BoatHullType.MONOHULL, true, "I14"),
|
||||
OPEN_BIC("O'pen BIC", true, 2.75, 1.14, BoatHullType.MONOHULL, false, "OpenBIC");
|
||||
OPEN_BIC("O'pen BIC", true, 2.75, 1.14, BoatHullType.MONOHULL, false, "OpenBIC"),
|
||||
|
||||
// multi-class "boat classes"; to be replaced at some later point in time by something like a RegattaClass
|
||||
ORC ("ORC", true, 13.83, 3.91, BoatHullType.MONOHULL, true),
|
||||
ORC_CLUB ("ORC Club", true, 13.83, 3.91, BoatHullType.MONOHULL, true),
|
||||
ORC_INTERNATIONAL ("ORC International", true, 13.83, 3.91, BoatHullType.MONOHULL, true, "ORC Int.");
|
||||
|
||||
|
||||
private final String displayName;
|
||||
private final String[] alternativeNames;
|
||||
|
||||
-55
@@ -1,55 +0,0 @@
|
||||
package com.sap.sailing.domain.common;
|
||||
|
||||
|
||||
/**
|
||||
* Some masterdata for the different handicap systems
|
||||
* @author Frank
|
||||
*
|
||||
*/
|
||||
public enum HandicapSystemMasterdata {
|
||||
ORC ("ORC"),
|
||||
ORC_CLUB ("ORC Club"),
|
||||
ORC_INTERNATIONAL ("ORC International", "ORC Int.");
|
||||
|
||||
private final String displayName;
|
||||
private final String[] alternativeNames;
|
||||
|
||||
private HandicapSystemMasterdata(String displayName, String... alternativeNames) {
|
||||
this.displayName = displayName;
|
||||
this.alternativeNames = alternativeNames;
|
||||
}
|
||||
|
||||
private HandicapSystemMasterdata(String displayName) {
|
||||
this.displayName = displayName;
|
||||
this.alternativeNames = null;
|
||||
}
|
||||
|
||||
public static HandicapSystemMasterdata resolveHandicapSystem(String handicapSystemName) {
|
||||
String handicapSystemToResolve = unifyHandicapSystemName(handicapSystemName);
|
||||
for (HandicapSystemMasterdata handicapSystem : values()) {
|
||||
if (unifyHandicapSystemName(handicapSystem.displayName).equals(handicapSystemToResolve)) {
|
||||
return handicapSystem;
|
||||
} else if (handicapSystem.alternativeNames != null) {
|
||||
for (String name : handicapSystem.alternativeNames) {
|
||||
if (unifyHandicapSystemName(name).equals(handicapSystemToResolve)) {
|
||||
return handicapSystem;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String unifyHandicapSystemName(String handicapSystemName) {
|
||||
return handicapSystemName == null ? null : handicapSystemName.toUpperCase().replaceAll("\\s+","");
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
public String[] getAlternativeNames() {
|
||||
return alternativeNames == null ? new String[0] : alternativeNames;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user