public static TypeOfTrain getTypeOfTrain(String type) { TypeOfTrain newType; if (type.Equals(EC)) { newType = TypeOfTrain.EC; } else if (IC.Equals(type)) { newType = TypeOfTrain.IC; } else if (EN.Equals(type)) { newType = TypeOfTrain.EN; } else if (Ex.Equals(type)) { newType = TypeOfTrain.Ex; } else if (Os.Equals(type)) { newType = TypeOfTrain.Os; } else if (R.Equals(type)) { newType = TypeOfTrain.R; } else if (SC.Equals(type)) { newType = TypeOfTrain.SC; } else if (Sp.Equals(type)) { newType = TypeOfTrain.Sp; } else { newType = TypeOfTrain.Os; } return(newType); }