Wraps up the index generation process and writes all remaining statements
e.g. concerning UNCOMPRESSED-Indexes on the created tables.

@throws IOException
if an error occurred while writing to the file
169608
public void finish() throws IOException{

		writer.write("CREATE INDEX articleIdx ON revisions(ArticleID);\r\n");
		writer.write("ALTER TABLE index_articleID_rc_ts ENABLE KEYS;\r\n");
		writer.write("ALTER TABLE index_revisionID ENABLE KEYS;\r\n");
		writer.write("ALTER TABLE index_chronological ENABLE KEYS;\r\n");
		writer.flush();

	}
428201
private void send()
		throws IOException, SQLException
	{

		this.indexWriter.write(articleIndex);
		this.indexWriter.write(revisionIndex);
		this.indexWriter.write(chronoIndex);
	}
675186
public void writeTo (@Nonnull @WillNotClose final OutputStream aOS) throws IOException
  {
    // we may only need to check if this is closed if we are working with a file
    // but we should force the habit of closing whether we are working with
    // a file or memory.
    if (!m_bClosed)
      throw new IOException ("This stream is not closed");

    if (isInMemory ())
    {
      m_aMemoryOS.writeTo (aOS);
    }
    else
    {
      final InputStream aIS = FileHelper.getInputStream (m_aOutputFile);
      StreamHelper.copyInputStreamToOutputStream (aIS, aOS);
    }
  }
925471
@Override protected void postProcessing() {
        if (argOptions.hasOption("saveVectors")) {
            String fileName = argOptions.getStringOption("saveVectors");
            LOGGER.info("saving index vectors to " + fileName);
            IndexVectorUtil.save(isa.getWordToIndexVector(), 
                                 new File(fileName));
        }        
    }
1080513
public void write(DataOutput out) throws IOException {
    out.writeBoolean(corrupt);
    out.writeLong(offset);
    b.write(out);
    out.writeInt(locs.length);
    for (int i = 0; i < locs.length; i++) {
      locs[i].write(out);
    }
  }
365728
public void writeTable(VoltTable table) throws IOException {
        int len = table.getSerializedSize();
        growIfNeeded(len);
        table.flattenToBuffer(buffer.b());
    }
1075895
public void write(DataOutput out) throws IOException {
    out.writeInt(VERSION);
    out.writeInt(this.nbHash);
    out.writeByte(this.hashType);
    out.writeInt(this.vectorSize);
  }
23238
public void dump() throws IOException {
    FileWriter out = new FileWriter(outFile, true);
    try {
      dump(out);
    } finally {
      out.close();
    }
  }
417568
public void write(DataOutput out) throws IOException {
    WritableUtils.writeVInt(out, values.length);
    WritableUtils.writeVLong(out, written);
    for (int i = 0; i < values.length; ++i) {
      Text.writeString(out, values[i].getClass().getName());
    }
    for (int i = 0; i < values.length; ++i) {
      if (has(i)) {
        values[i].write(out);
      }
    }
  }
388136
private synchronized void initQueryBuilder() throws IOException {
        if (queryBuilder == null) {
            indexReader = DirectoryReader.open(indexDirectory);
            indexSearcher = new IndexSearcher(indexReader);
            queryBuilder = new QueryBuilder(writer.getAnalyzer());
        }
    }
1204417
public void finish() throws IOException
    {
        ensureNotFinished();
        flushBufferedData();
        compressedBuffer[MAGIC_LENGTH] = (byte) (COMPRESSION_METHOD_RAW | compressionLevel);
        writeIntLE(0, compressedBuffer, MAGIC_LENGTH + 1);
        writeIntLE(0, compressedBuffer, MAGIC_LENGTH + 5);
        writeIntLE(0, compressedBuffer, MAGIC_LENGTH + 9);
        assert MAGIC_LENGTH + 13 == HEADER_LENGTH;
        out.write(compressedBuffer, 0, HEADER_LENGTH);
        finished = true;
        out.flush();
    }
875197
public void save() throws IOException {
        final Table previousTable = this.contentElement.getLastTable();
        if (previousTable != null) previousTable.flush();

        this.observer.update(new FinalizeFlusher(this.contentElement, this.settingsElement));
    }
77598
public void process(DocumentAndOp doc, Analyzer analyzer) throws IOException {
    if (doc.getOp() == DocumentAndOp.Op.DELETE
        || doc.getOp() == DocumentAndOp.Op.UPDATE) {
      deleteList.add(doc.getTerm());

    }

    if (doc.getOp() == DocumentAndOp.Op.INSERT
        || doc.getOp() == DocumentAndOp.Op.UPDATE) {

      if (writer == null) {
        // analyzer is null because we specify an analyzer with addDocument
        writer = createWriter();
      }

      writer.addDocument(doc.getDocument(), analyzer);
      numDocs++;
    }

  }
1336031
private void recordIndex(int index) {
        stateLock.writeLock().lock();
        try {
            int insertionPoint = -Arrays.binarySearch(effectiveIndex, index) - 1;
            System.arraycopy(effectiveIndex, insertionPoint, effectiveIndex, insertionPoint + 1, effectiveIndex.length - insertionPoint - 1);
            effectiveIndex[insertionPoint] = index;
        } finally {
            stateLock.writeLock().unlock();
        }
    }
1189550
@SuppressWarnings("unchecked")
    private void processSpace() throws IOException {
        compressedDocumentsWriter.close();        

        // Generate the reverse index-to-term mapping.  We will need this for
        // assigning specific senses to each term
        String[] indexToTerm = new String[termToIndex.size()];
        for (Map.Entry<String,Integer> e : termToIndex.entrySet())
            indexToTerm[e.getValue()] = e.getKey();
        
        // Compute how many terms were in the corpus.  We will need this for
        // determining the log-likelihood for all co-occurrences.
        int corpusSize = 0;
        for (AtomicInteger i : termCounts)
            corpusSize += i.get();
        final int uniqueTerms = cooccurrenceMatrix.rows();

        LOGGER.info("calculating term features");
        // Create a set for each term that contains the term indices that are
        // determined to be features for the term, i.e. not all co-occurrences
        // will count as the features.  The feature set for each term is
        // determined by computing the log-likelihood for each co-occurrence and
        // only keeping those terms whos l-l value is above a certain threshold.
        final BitSet[] termFeatures = new BitSet[wordIndexCounter];        
        for (int termIndex = 0; termIndex < uniqueTerms; ++termIndex) {
            String term = indexToTerm[termIndex];            
            termFeatures[termIndex] = calculateTermFeatures(term, corpusSize);
        }

        LOGGER.info("reprocessing corpus to generate feature vectors");
        
        // Set up the concurrent data structures so we can process the documents
        // concurrently
        final BlockingQueue<Runnable> workQueue =
            new LinkedBlockingQueue<Runnable>();
        for (int i = 0; i < Runtime.getRuntime().availableProcessors(); ++i) {
            Thread t = new WorkerThread(workQueue);
            t.start();
        }
        final Semaphore termsProcessed = new Semaphore(0); 
        
        for (int termIndex = 0; termIndex < uniqueTerms; ++termIndex) {
            
            final String term = indexToTerm[termIndex];
            final int i = termIndex;
            workQueue.offer(new Runnable() {
                    public void run() {
                        try {
                        LOGGER.fine(String.format(
                            "processing term %6d/%d: %s", i, uniqueTerms,term));
                        Matrix contexts = getTermContexts(i, termFeatures[i]);
                        senseInduce(term, contexts);
                        } catch (IOException ioe) {
                            ioe.printStackTrace();
                        } finally {
                            termsProcessed.release();
                        }                       
                    }
                });
        }
        
        // Wait until all the documents have been processed
        try {
            termsProcessed.acquire(uniqueTerms);
        } catch (InterruptedException ie) {
            throw new Error("interrupted while waiting for terms to " +
                            "finish reprocessing", ie);
        }        
        LOGGER.info("finished reprocessing all terms");
    }
22698
public void flushTables(final XMLUtil util, final ZipUTF8Writer writer) throws IOException {
        this.ensureContentBegin(util, writer);
        final int lastTableIndex = this.tables.size() - 1;
        if (lastTableIndex < 0)
            return;

        int tableIndex = this.flushPosition.getTableIndex();

        Table table = this.tables.get(tableIndex);
        table.flushRemainingRowsFrom(util, writer, this.flushPosition.getLastRowIndex() + 1);
        tableIndex++;
        while (tableIndex <= lastTableIndex) {
            table = this.tables.get(tableIndex);
            table.appendXMLToContentEntry(util, writer);
            tableIndex++;
        }
    }
1053799
private void writes() {
    int index = random.nextInt();
    for (;;) {
      Integer key = ints[index++ & MASK];
      cache.put(key, Boolean.TRUE);
      calls.increment();
    }
  }