public EnumeratorType getEnuemratorType() { return indexDeligate.getEnuemratorType(); }
@Override public void runCommand() throws Exception { if (LOG.isInfoEnabled()) LOG.info("Running filtering."); if (LOG.isDebugEnabled()) LOG.debug(this); if (filterFeatureMinFreq > 0) { addFeaturesMinimumFrequency(filterFeatureMinFreq); } if (filterFeaturePattern != null) { addFeaturesPattern(filterFeaturePattern); } if (filterFeatureWhitelist != null) { addFeaturesWhitelist( com.google.common.io.Files.readLines(filterFeatureWhitelist, getCharset())); } if (filterEntryMinFreq > 0) { addEntryMinimumFrequency(filterEntryMinFreq); } if (filterEntryPattern != null) { addEntryPattern(filterEntryPattern); } if (filterEntryWhitelist != null) { addEntryWhitelist(com.google.common.io.Files.readLines(filterEntryWhitelist, getCharset())); } if (filterEventMinFreq > 0) { addEventMinimumFrequency(filterEventMinFreq); } checkState(); activeEventsFile = inputEventsFile; activeEntriesFile = inputEntriesFile; activeFeaturesFile = inputFeaturesFile; progress.addProgressListener( new ProgressListener() { @Override public void progressChanged(ProgressEvent progressEvent) { LOG.info(progressEvent.getSource().getProgressReport()); } }); progress.setState(State.RUNNING); progress.setProgressPercent(0); // Run the filters forwards then backwards. Each filtering step may // introduce additionaly filters for the other files, so continue // looping until there is no work remaining. Depending on filters this // very unlikely to take more than 3 passes int passCount = 0; int opCount = 0; while (entryFilterRequired || eventFilterRequired || featureFilterRequired) { // if (entryFilterRequired || eventFilterRequired) { progress.setMessage("Running filtering pass (#" + (++passCount) + ")."); if (entryFilterRequired) { filterEntries(); ++opCount; progress.setProgressPercent( 100 * opCount / (opCount + 3 + (entryFilterRequired ? 1 : 0) + (eventFilterRequired ? 1 : 0) + (featureFilterRequired ? 1 : 0))); } if (eventFilterRequired) { filterEvents(); ++opCount; progress.setProgressPercent( 100 * opCount / (opCount + 3 + (entryFilterRequired ? 1 : 0) + (eventFilterRequired ? 1 : 0) + (featureFilterRequired ? 1 : 0))); } if (featureFilterRequired) { filterFeatures(); ++opCount; progress.setProgressPercent( 100 * opCount / (opCount + 3 + (entryFilterRequired ? 1 : 0) + (eventFilterRequired ? 1 : 0) + (featureFilterRequired ? 1 : 0))); } // } // // if (featureFilterRequired || eventFilterRequired) { // // progress.setMessage("Running backwards filtering pass (#" + (++passCount) + // ")."); // // if (featureFilterRequired) { // filterFeatures(); // ++opCount; // progress.setProgressPercent(100 * opCount / (opCount // + (entryFilterRequired ? 1 : 0) // + (eventFilterRequired ? 1 : 0) // + (featureFilterRequired ? 1 : 0))); // } if (eventFilterRequired) { filterEvents(); ++opCount; progress.setProgressPercent( 100 * opCount / (opCount + 3 + (entryFilterRequired ? 1 : 0) + (eventFilterRequired ? 1 : 0) + (featureFilterRequired ? 1 : 0))); } if (entryFilterRequired) { filterEntries(); ++opCount; progress.setProgressPercent( 100 * opCount / (opCount + 3 + (entryFilterRequired ? 1 : 0) + (eventFilterRequired ? 1 : 0) + (featureFilterRequired ? 1 : 0))); } // } } // Finished filtering so copy the results files to the outputs. progress.setMessage("Copying final entries file."); outputEntriesFile.delete(); if (!activeEntriesFile.renameTo(outputEntriesFile)) { com.google.common.io.Files.copy(activeEntriesFile, outputEntriesFile); if (!activeEntriesFile.equals(inputEntriesFile)) activeEntriesFile.delete(); } ++opCount; progress.startAdjusting(); progress.setProgressPercent( 100 * opCount / (opCount + 2 + (entryFilterRequired ? 1 : 0) + (eventFilterRequired ? 1 : 0) + (featureFilterRequired ? 1 : 0))); progress.setMessage("Copying finaly events file."); progress.endAdjusting(); outputEventsFile.delete(); if (!activeEventsFile.renameTo(outputEventsFile)) { com.google.common.io.Files.copy(activeEventsFile, outputEventsFile); if (!activeEventsFile.equals(inputEventsFile)) activeEventsFile.delete(); } ++opCount; progress.startAdjusting(); progress.setProgressPercent( 100 * opCount / (opCount + 1 + (entryFilterRequired ? 1 : 0) + (eventFilterRequired ? 1 : 0) + (featureFilterRequired ? 1 : 0))); progress.setMessage("Copying final features file."); progress.endAdjusting(); outputFeaturesFile.delete(); if (!activeFeaturesFile.renameTo(outputFeaturesFile)) { com.google.common.io.Files.copy(activeFeaturesFile, outputFeaturesFile); if (!activeFeaturesFile.equals(inputFeaturesFile)) activeFeaturesFile.delete(); } ++opCount; progress.setProgressPercent( 100 * opCount / (opCount + 0 + (entryFilterRequired ? 1 : 0) + (eventFilterRequired ? 1 : 0) + (featureFilterRequired ? 1 : 0))); if (indexDeligate.isEnumeratorOpen()) { indexDeligate.saveEnumerator(); indexDeligate.closeEnumerator(); } progress.setState(State.COMPLETED); }
public File getEntryEnumeratorFile() { return indexDeligate.getEntryEnumeratorFile(); }
public void setEnumeratorType(EnumeratorType type) { indexDeligate.setEnumeratorType(type); }
public boolean isEnumeratedEntries() { return indexDeligate.isEnumeratedEntries(); }
public File getFeatureEnumeratorFile() { return indexDeligate.getFeatureEnumeratorFile(); }
public boolean isEnumeratedFeatures() { return indexDeligate.isEnumeratedFeatures(); }
public void setEntryEnumeratorFile(File entryEnumeratorFile) { indexDeligate.setEntryEnumeratorFile(entryEnumeratorFile); }
public void setEnumeratedEntries(boolean enumeratedEntries) { indexDeligate.setEnumeratedEntries(enumeratedEntries); }
public void setEnumeratedFeatures(boolean enumeratedFeatures) { indexDeligate.setEnumeratedFeatures(enumeratedFeatures); }
public void setFeatureEnumeratorFile(File featureEnumeratorFile) { indexDeligate.setFeatureEnumeratorFile(featureEnumeratorFile); }