test_class.file: app/src/test/java/org/hwyl/sexytopo/control/io/thirdparty/survex/SurvexImporterTest.java
test_class.identifier: SurvexImporterTest
test_case.body: @Test
      public void testCommentInstructionParsing() {
          Leg[] legs = SurvexImporter.parseAnyPromotedLegs(
                  "{from: 1 0 0, 1.0 0.0 0.0, 1.0 0.0 0.0}");
          Assert.assertEquals(3, legs.length);
          for (Leg leg : legs) {
              Assert.assertEquals(leg.getDistance(), 1.0);
              Assert.assertEquals(leg.getAzimuth(), 0.0);
              Assert.assertEquals(leg.getInclination(), 0.0);
          }
      }
test_case.class_method_signature: SurvexImporterTest.testCommentInstructionParsing()
test_case.full_signature: @Test public void testCommentInstructionParsing()
test_case.identifier: testCommentInstructionParsing
test_case.invocations: parseAnyPromotedLegs assertEquals assertEquals getDistance assertEquals getAzimuth assertEquals getInclination
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testCommentInstructionParsing()
focal_class.declarator: COMMENT_INSTRUCTION_REGEX = Pattern.compile("(\\{.*?\\})")
focal_class.modifier: public static final
focal_class.original_string: public static final Pattern COMMENT_INSTRUCTION_REGEX = Pattern.compile("(\\{.*?\\})");
focal_class.type: Pattern
focal_class.var_name: COMMENT_INSTRUCTION_REGEX
focal_class.file: app/src/main/java/org/hwyl/sexytopo/control/io/thirdparty/survex/SurvexImporter.java
focal_class.identifier: SurvexImporter
focal_class.class_method_signature: SurvexImporter.toSurvey(File file)
focal_class.full_signature: @Override public Survey toSurvey(File file)
focal_class.identifier: toSurvey
focal_class.modifiers: @Override public
focal_class.parameters: (File file)
focal_class.return: Survey
focal_class.signature: Survey toSurvey(File file)
focal_class.class_method_signature: SurvexImporter.parse(String text, Survey survey)
focal_class.full_signature: public static void parse(String text, Survey survey)
focal_class.identifier: parse
focal_class.modifiers: public static
focal_class.parameters: (String text, Survey survey)
focal_class.return: void
focal_class.signature: void parse(String text, Survey survey)
focal_class.class_method_signature: SurvexImporter.addLegToSurvey(
              Survey survey, Map<String, Station> nameToStation, String[] fields, String comment)
focal_class.full_signature: private static void addLegToSurvey(
              Survey survey, Map<String, Station> nameToStation, String[] fields, String comment)
focal_class.identifier: addLegToSurvey
focal_class.modifiers: private static
focal_class.parameters: (
              Survey survey, Map<String, Station> nameToStation, String[] fields, String comment)
focal_class.return: void
focal_class.signature: void addLegToSurvey(
              Survey survey, Map<String, Station> nameToStation, String[] fields, String comment)
focal_class.class_method_signature: SurvexImporter.retrieveOrCreateStation(Map<String, Station> nameToStation,
                                                     String name, String comment)
focal_class.full_signature: private static Station retrieveOrCreateStation(Map<String, Station> nameToStation,
                                                     String name, String comment)
focal_class.identifier: retrieveOrCreateStation
focal_class.modifiers: private static
focal_class.parameters: (Map<String, Station> nameToStation,
                                                     String name, String comment)
focal_class.return: Station
focal_class.signature: Station retrieveOrCreateStation(Map<String, Station> nameToStation,
                                                     String name, String comment)
focal_class.class_method_signature: SurvexImporter.extractCommentInstructions(String comment)
focal_class.full_signature: private static String extractCommentInstructions(String comment)
focal_class.identifier: extractCommentInstructions
focal_class.modifiers: private static
focal_class.parameters: (String comment)
focal_class.return: String
focal_class.signature: String extractCommentInstructions(String comment)
focal_class.class_method_signature: SurvexImporter.parseAnyPromotedLegs(String instructions)
focal_class.full_signature: public static Leg[] parseAnyPromotedLegs(String instructions)
focal_class.identifier: parseAnyPromotedLegs
focal_class.modifiers: public static
focal_class.parameters: (String instructions)
focal_class.return: Leg[]
focal_class.signature: Leg[] parseAnyPromotedLegs(String instructions)
focal_class.class_method_signature: SurvexImporter.canHandleFile(File file)
focal_class.full_signature: @Override public boolean canHandleFile(File file)
focal_class.identifier: canHandleFile
focal_class.modifiers: @Override public
focal_class.parameters: (File file)
focal_class.return: boolean
focal_class.signature: boolean canHandleFile(File file)
focal_class.superclass: extends Importer
focal_method.body: public static Leg[] parseAnyPromotedLegs(String instructions) {
          try {
              List<Leg> legs = new ArrayList<>();
  
              instructions = instructions.replace("{", "");
              instructions = instructions.replace("}", "");
              if (instructions.contains("from:")) {
                  instructions = instructions.replace("from:", "");
              } else {
                  throw new Exception("Not an instruction we understand");
              }
  
              String[] legStrings = instructions.split(",");
  
              for (String legString : legStrings) {
                  legString = legString.trim();
                  String[] fieldStrings = legString.split(" ");
                  double distance = Double.parseDouble(fieldStrings[0].trim());
                  double azimuth = Double.parseDouble(fieldStrings[1].trim());
                  double inclination = Double.parseDouble(fieldStrings[2].trim());
                  legs.add(new Leg(distance, azimuth, inclination));
              }
  
              return legs.toArray(new Leg[]{});
          } catch (Exception exception) {
              Log.e("Error parsing promoted leg (ignoring and carrying on): " + exception);
              return new Leg[]{}; // seems to be corrupted... feature not mission-critical so bail
          }
      }
focal_method.class_method_signature: SurvexImporter.parseAnyPromotedLegs(String instructions)
focal_method.full_signature: public static Leg[] parseAnyPromotedLegs(String instructions)
focal_method.identifier: parseAnyPromotedLegs
focal_method.invocations: replace replace contains replace split trim split parseDouble trim parseDouble trim parseDouble trim add toArray e
focal_method.modifiers: public static
focal_method.parameters: (String instructions)
focal_method.return: Leg[]
focal_method.signature: Leg[] parseAnyPromotedLegs(String instructions)