test_class.declarator: tempDir
test_class.modifier: private
test_class.original_string: private String tempDir;
test_class.type: String
test_class.var_name: tempDir
test_class.file: imhotep-server/src/test/java/com/indeed/flamdex/simple/TestSimpleFlamdexDocWriter.java
test_class.identifier: TestSimpleFlamdexDocWriter
test_case.body: @Test
      public void testEmpty() throws IOException {
          new SimpleFlamdexDocWriter(tempDir, new SimpleFlamdexDocWriter.Config()).close();
          FlamdexReader r = SimpleFlamdexReader.open(tempDir);
          assertEquals(0, r.getNumDocs());
      }
test_case.class_method_signature: TestSimpleFlamdexDocWriter.testEmpty()
test_case.full_signature: @Test public void testEmpty()
test_case.identifier: testEmpty
test_case.invocations: close open assertEquals getNumDocs
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testEmpty()
focal_class.declarator: outputDirectory
focal_class.modifier: private final
focal_class.original_string: private final String outputDirectory;
focal_class.type: String
focal_class.var_name: outputDirectory
focal_class.declarator: docBufferSize
focal_class.modifier: private final
focal_class.original_string: private final int docBufferSize;
focal_class.type: int
focal_class.var_name: docBufferSize
focal_class.declarator: mergeFactor
focal_class.modifier: private final
focal_class.original_string: private final int mergeFactor;
focal_class.type: int
focal_class.var_name: mergeFactor
focal_class.declarator: segmentsOnDisk
focal_class.modifier: private final
focal_class.original_string: private final List<List<File>> segmentsOnDisk;
focal_class.type: List<List<File>>
focal_class.var_name: segmentsOnDisk
focal_class.declarator: currentBuffer = new MemoryFlamdex()
focal_class.modifier: private
focal_class.original_string: private MemoryFlamdex currentBuffer = new MemoryFlamdex();
focal_class.type: MemoryFlamdex
focal_class.var_name: currentBuffer
focal_class.declarator: currentSegment = "_0"
focal_class.modifier: private
focal_class.original_string: private String currentSegment = "_0";
focal_class.type: String
focal_class.var_name: currentSegment
focal_class.file: imhotep-server/src/main/java/com/indeed/flamdex/simple/SimpleFlamdexDocWriter.java
focal_class.identifier: SimpleFlamdexDocWriter
focal_class.interfaces: implements FlamdexDocWriter
focal_class.class_method_signature: SimpleFlamdexDocWriter.SimpleFlamdexDocWriter(String outputDirectory, Config config)
focal_class.full_signature: public  SimpleFlamdexDocWriter(String outputDirectory, Config config)
focal_class.identifier: SimpleFlamdexDocWriter
focal_class.modifiers: public
focal_class.parameters: (String outputDirectory, Config config)
focal_class.signature:  SimpleFlamdexDocWriter(String outputDirectory, Config config)
focal_class.class_method_signature: SimpleFlamdexDocWriter.createOutputDir(String outputDirectory)
focal_class.full_signature: private static void createOutputDir(String outputDirectory)
focal_class.identifier: createOutputDir
focal_class.modifiers: private static
focal_class.parameters: (String outputDirectory)
focal_class.return: void
focal_class.signature: void createOutputDir(String outputDirectory)
focal_class.class_method_signature: SimpleFlamdexDocWriter.addDocument(FlamdexDocument doc)
focal_class.full_signature: @Override public void addDocument(FlamdexDocument doc)
focal_class.identifier: addDocument
focal_class.modifiers: @Override public
focal_class.parameters: (FlamdexDocument doc)
focal_class.return: void
focal_class.signature: void addDocument(FlamdexDocument doc)
focal_class.class_method_signature: SimpleFlamdexDocWriter.flush()
focal_class.full_signature: private void flush()
focal_class.identifier: flush
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void flush()
focal_class.class_method_signature: SimpleFlamdexDocWriter.close()
focal_class.full_signature: @Override public void close()
focal_class.identifier: close
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void close()
focal_class.class_method_signature: SimpleFlamdexDocWriter.nextSegmentDirectory(String s)
focal_class.full_signature: private static String nextSegmentDirectory(String s)
focal_class.identifier: nextSegmentDirectory
focal_class.modifiers: private static
focal_class.parameters: (String s)
focal_class.return: String
focal_class.signature: String nextSegmentDirectory(String s)
focal_class.class_method_signature: SimpleFlamdexDocWriter.rmrf(final File file)
focal_class.full_signature: private static void rmrf(final File file)
focal_class.identifier: rmrf
focal_class.modifiers: private static
focal_class.parameters: (final File file)
focal_class.return: void
focal_class.signature: void rmrf(final File file)
focal_method.body: @Override
      public void close() throws IOException {
          flush();
          long numDocs = 0;
          final List<FlamdexReader> allReaders = Lists.newArrayList();
          for (final File file : Iterables.concat(Lists.reverse(segmentsOnDisk.subList(1, segmentsOnDisk.size())))) {
              final SimpleFlamdexReader reader = SimpleFlamdexReader.open(file.getAbsolutePath(), new SimpleFlamdexReader.Config().setWriteBTreesIfNotExisting(false));
              allReaders.add(reader);
              numDocs += reader.getNumDocs();
          }
          for (final File file : segmentsOnDisk.get(0)) {
              final FlamdexReader reader = MemoryFlamdex.streamer(new BufferedFileDataInputStream(file, ByteOrder.nativeOrder(), 65536));
              allReaders.add(reader);
              numDocs += reader.getNumDocs();
          }
  
          final FlamdexWriter w = new SimpleFlamdexWriter(outputDirectory, numDocs, true, true);
          SimpleFlamdexWriter.merge(allReaders, w);
          w.close();
  
          for (final FlamdexReader reader : allReaders) {
              reader.close();
          }
  
          for (final File file : Iterables.concat(segmentsOnDisk)) {
              rmrf(file);
          }
      }
focal_method.class_method_signature: SimpleFlamdexDocWriter.close()
focal_method.full_signature: @Override public void close()
focal_method.identifier: close
focal_method.invocations: flush newArrayList concat reverse subList size open getAbsolutePath setWriteBTreesIfNotExisting add getNumDocs get streamer nativeOrder add getNumDocs merge close close concat rmrf
focal_method.modifiers: @Override public
focal_method.parameters: ()
focal_method.return: void
focal_method.signature: void close()