test_class.file: app/src/test/java/org/hwyl/sexytopo/control/io/thirdparty/xvi/XviImporterTest.java
test_class.identifier: XviImporterTest
test_case.body: @Test
      public void testGetSimpleBlockContents() throws Exception {
          String simpleText = "set Command {foo}";
          String contents = XviImporter.getBlockContents(simpleText, "set Command");
          Assert.assertEquals("foo", contents);
      }
test_case.class_method_signature: XviImporterTest.testGetSimpleBlockContents()
test_case.full_signature: @Test public void testGetSimpleBlockContents()
test_case.identifier: testGetSimpleBlockContents
test_case.invocations: getBlockContents assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetSimpleBlockContents()
focal_class.declarator: instance = new XviImporter()
focal_class.modifier: private static
focal_class.original_string: private static XviImporter instance = new XviImporter();
focal_class.type: XviImporter
focal_class.var_name: instance
focal_class.file: app/src/main/java/org/hwyl/sexytopo/control/io/thirdparty/xvi/XviImporter.java
focal_class.identifier: XviImporter
focal_class.class_method_signature: XviImporter.toSurvey(File file)
focal_class.full_signature: public Survey toSurvey(File file)
focal_class.identifier: toSurvey
focal_class.modifiers: public
focal_class.parameters: (File file)
focal_class.return: Survey
focal_class.signature: Survey toSurvey(File file)
focal_class.class_method_signature: XviImporter.getSketch(File file)
focal_class.full_signature: public static Sketch getSketch(File file)
focal_class.identifier: getSketch
focal_class.modifiers: public static
focal_class.parameters: (File file)
focal_class.return: Sketch
focal_class.signature: Sketch getSketch(File file)
focal_class.class_method_signature: XviImporter.canHandleFile(File file)
focal_class.full_signature: public boolean canHandleFile(File file)
focal_class.identifier: canHandleFile
focal_class.modifiers: public
focal_class.parameters: (File file)
focal_class.return: boolean
focal_class.signature: boolean canHandleFile(File file)
focal_class.class_method_signature: XviImporter.parseGrid(String contents)
focal_class.full_signature: public Grid parseGrid(String contents)
focal_class.identifier: parseGrid
focal_class.modifiers: public
focal_class.parameters: (String contents)
focal_class.return: Grid
focal_class.signature: Grid parseGrid(String contents)
focal_class.class_method_signature: XviImporter.parseSketchlineBlock(double scale, String contents)
focal_class.full_signature: public static Set<PathDetail> parseSketchlineBlock(double scale, String contents)
focal_class.identifier: parseSketchlineBlock
focal_class.modifiers: public static
focal_class.parameters: (double scale, String contents)
focal_class.return: Set<PathDetail>
focal_class.signature: Set<PathDetail> parseSketchlineBlock(double scale, String contents)
focal_class.class_method_signature: XviImporter.parseBlockEntries(String content)
focal_class.full_signature: public static List<String> parseBlockEntries(String content)
focal_class.identifier: parseBlockEntries
focal_class.modifiers: public static
focal_class.parameters: (String content)
focal_class.return: List<String>
focal_class.signature: List<String> parseBlockEntries(String content)
focal_class.class_method_signature: XviImporter.parseSketchEntry(double scale, String entry)
focal_class.full_signature: public static PathDetail parseSketchEntry(double scale, String entry)
focal_class.identifier: parseSketchEntry
focal_class.modifiers: public static
focal_class.parameters: (double scale, String entry)
focal_class.return: PathDetail
focal_class.signature: PathDetail parseSketchEntry(double scale, String entry)
focal_class.class_method_signature: XviImporter.getBlockContents(String text, String command)
focal_class.full_signature: public static String getBlockContents(String text, String command)
focal_class.identifier: getBlockContents
focal_class.modifiers: public static
focal_class.parameters: (String text, String command)
focal_class.return: String
focal_class.signature: String getBlockContents(String text, String command)
focal_class.superclass: extends Importer
focal_method.body: public static String getBlockContents(String text, String command) throws Exception {
  
          outer:
          for (int i = 0; i < text.length(); i++) {
  
              // keep trying to match the command string
              for (int j = 0; j < command.length(); j++) {
                  char text_current = text.charAt(i + j);
                  char command_current = command.charAt(j);
                  if (text_current != command_current) {
                      continue outer;
                  }
              }
  
              i += command.length();
              // from here we're at the end of a matched command string
  
              // eat up any whitespace
              while (Character.isWhitespace(text.charAt(i))) {
                  i++;
              }
  
              // hopefully we've found an opening { block now
              if (text.charAt(i) == '{') {
                  i++;
              } else {
                  continue outer; // otherwise try to match again...
              }
  
              int openBraces = 1;
              int startOfContent = i;
  
              for(; i < text.length(); i++) {
                  if (text.charAt(i) == '{') {
                      openBraces++;
                  } else if (text.charAt(i) == '}') {
                      openBraces--;
                  }
  
                  if (openBraces == 0) {
                      int endOfContent = i;
                      String content = text.substring(startOfContent, endOfContent);
                      return content;
                  }
  
              }
  
              throw new Exception("Malformed text: could not match braces");
  
          }
  
          throw new Exception("Could not match command in text");
      }
focal_method.class_method_signature: XviImporter.getBlockContents(String text, String command)
focal_method.full_signature: public static String getBlockContents(String text, String command)
focal_method.identifier: getBlockContents
focal_method.invocations: length length charAt charAt length isWhitespace charAt charAt length charAt charAt substring
focal_method.modifiers: public static
focal_method.parameters: (String text, String command)
focal_method.return: String
focal_method.signature: String getBlockContents(String text, String command)