import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;

public class ParseGpsFile {

    public static Map<String, String> ParseTLT(String GpsFileDataInput) {
        String[] GpsFileDataCS = GpsFileDataInput.split(","); // GpsFileDataC(omma)S(eparated)

        Map<String, String> dataMap = new LinkedHashMap<>();
        dataMap.put("VehicleType", GpsFileDataCS[0]);
        dataMap.put("VehicleLine", GpsFileDataCS[1]);
        dataMap.put("VehicleLatitude", GpsFileDataCS[3]);
        dataMap.put("VehicleLongitude", GpsFileDataCS[2]);
        dataMap.put("VehicleHeading", GpsFileDataCS[5]);
        dataMap.put("VehicleTAK", GpsFileDataCS[6]);
        String val = GpsFileDataCS[7].toLowerCase();   //
        String isLowGround;                            //
        if (Objects.equals(val, "z")) {             //
            isLowGround = "true";                      //   Parse from the stupid z=true,false=false system
        } else {                                       //   TLT uses to true=true,false=false system.
            isLowGround = "false";                     //
        }                                              //
        dataMap.put("IsVehicleLowGroundVehicle", isLowGround);
        dataMap.put("VehicleDestination", GpsFileDataCS[9]);
        return dataMap;
    }
}