class OldStyleLoader {

    public static void parse(String text, Survey survey) throws Exception {

        Map<String, Station> nameToStation = new HashMap<>();

        Station origin = survey.getOrigin();
        nameToStation.put(origin.getName(), origin);

        String[] lines = text.split("\n");
        for (String line : lines) {
            line = line.trim();
            if (line.equals("") || line.startsWith("*")) {
                continue;
            }

            String comment = "";
            if (line.contains("; ")) {
                comment = line.substring(line.indexOf("; ") + 2);
                comment = comment.replaceAll("\\\\n", "\n");
                line = line.substring(0, line.indexOf("; "));
            }

            String[] fields = line.trim().split("\t");
            addLegToSurvey(survey, nameToStation, fields, comment);
        }
    }

}