TherionImporter extends Importer { public static void updateCentreline(List<String> lines, Survey survey) throws Exception { List<String> block = getContentsOfBeginEndBlock(lines, "centreline"); List<String> sanitisedCentrelineData = new LinkedList<>(); List<String> sanitisedElevationDirectionData = new LinkedList<>(); boolean inDataBlock = false; for (String line: block) { String trimmed = line.trim(); if (trimmed.equals("")) { continue; } if (trimmed.startsWith("data")) { inDataBlock = true; continue; } else if (!inDataBlock) { continue; } if (trimmed.startsWith("extend")) { sanitisedElevationDirectionData.add(trimmed); } else { sanitisedCentrelineData.add(trimmed); } } String centrelineText = TextTools.join("\n", sanitisedCentrelineData); SurvexImporter.parse(centrelineText, survey); handleElevationDirectionData(sanitisedElevationDirectionData, survey); }  Survey toSurvey(File directory); static String getSurveyName(File file); boolean canHandleFile(File directory); static void updateCentreline(List<String> lines, Survey survey); static List<String> getContentsOfBeginEndBlock(List<String> lines, String tag);  }
@Test public void testElevationDirectionExtraction() throws Exception { Survey survey = new Survey("Test"); TherionImporter.updateCentreline(LINES, survey); Station stationTwo = survey.getStationByName("2"); Direction stationTwoDirection = stationTwo.getExtendedElevationDirection(); Assert.assertEquals(Direction.LEFT, stationTwoDirection); Station stationThree = survey.getStationByName("3"); Direction stationThreeDirection = stationThree.getExtendedElevationDirection(); Assert.assertEquals(Direction.LEFT, stationThreeDirection); Station stationFive = survey.getStationByName("5"); Direction stationFiveDirection = stationFive.getExtendedElevationDirection(); Assert.assertEquals(Direction.RIGHT, stationFiveDirection); }