29 lines
880 B
Java
29 lines
880 B
Java
package SuMoC.backend.trip;
|
|
|
|
public enum Modality {
|
|
IDLE,
|
|
WALKING,
|
|
BICYCLE,
|
|
ESCOOTER,
|
|
BUS,
|
|
TRAM,
|
|
TRAIN,
|
|
CAR,
|
|
MOTORCYCLE,
|
|
TAXI;
|
|
|
|
public static Modality fromCartaString(String cartaType) {
|
|
return switch (cartaType.toLowerCase()) {
|
|
case "tram", "subway", "metro" -> TRAM;
|
|
case "rail", "monorail" -> TRAIN;
|
|
case "bus", "trolleybus" -> BUS;
|
|
case "ferry", "cablecar", "gondola", "funicular" ->
|
|
throw new UnsupportedOperationException("Transport type needs to be added to backend: " + cartaType);
|
|
// these are to dervive modality from carta step type
|
|
case "walkingstep" -> WALKING;
|
|
case "cyclingstep" -> BICYCLE;
|
|
default -> throw new IllegalArgumentException("Unknown CARTA modality: " + cartaType);
|
|
};
|
|
}
|
|
}
|