/** * This is the main entry point into the program. */ static public void main(String[] args) { System.out.println("Starting SimpleSearchStream"); // Create an input string containing the lyrics to the // do-re-mi song. String input = TestDataFactory.getInput(sINPUT_FILE, "@").get(0); // Get the list of words to find. List<String> wordsToFind = TestDataFactory.getWordList(sWORD_LIST_FILE); // Create an object that can be used to search for words in // the input. WordSearcher wordSearcher = new WordSearcher(input); // Print all matching words. wordSearcher.findAndPrintWords(wordsToFind); System.out.println("Ending SimpleSearchStream"); } }
/** * Warm up the fork-join pool to account for any instruction/data * caching effects. */ private static void warmUpForkJoinPool(SearchWithForkJoinTaskFactory consRef) throws IOException, URISyntaxException { System.out.println("Warming up the fork-join pool"); // This object is used to search a recursive directory // containing the complete works of William Shakespeare. List<CharSequence> inputList = TestDataFactory .getInput(sSHAKESPEARE_FOLDER, true); // Create the appropriate type of object. SearchWithForkJoinTask forkJoinTask = consRef.apply(inputList, mPhrasesToFind, true, true, true); @SuppressWarnings("unused") // Search the input looking for phrases that match. List<List<SearchResults>> listOfListOfSearchResults = ForkJoinPool.commonPool() .invoke(forkJoinTask); // Help the GC. //noinspection UnusedAssignment forkJoinTask = null; // Run the garbage collector after each test. System.gc(); }
TestDataFactory.getInput(sSHAKESPEARE_DATA_FILE,
TestDataFactory.getInput(sSHAKESPEARE_DATA_FILE,