String[] parts = name.split(SEPARATOR);
if (parts.length < 2) {
String msg = "When parsing height-vegetation-section-name: "
+ "Must contain a " + SEPARATOR;
throw new ConfigurationException(msg);
}
if (!(vegetationDefinitions.containsKey(parts[parts.length - 1]))) {
String msg = "When parsing height-vegetation-section-name: "
+ parts[parts.length - 1] + " is not a vegetation!";
throw new ConfigurationException(msg);
}
String tmpString = "";
for (int n = 0; n < parts.length - 1; n++) {
tmpString += parts[n];
}
String heightString = tmpString.toUpperCase();
Field.Height height;
try {
height = Enum.valueOf(Field.Height.class, heightString);
} catch (IllegalArgumentException e) {
String msg = "When parsing height-vegetation-section-name: "
+ tmpString + " is no valid height string!";
throw new ConfigurationException(msg);
}
}