/** * Print out the search results. */ private void printResults(String test, List<List<SearchResults>> listOfListOfSearchResults) { System.out.println(test + ": The search returned " + listOfListOfSearchResults.stream() .mapToInt(list -> list.stream().mapToInt(SearchResults::size).sum()) .sum() + " phrase matches for " + getInput().size() + " input strings"); // Print out the titles. if (Options.getInstance().isVerbose()) printPhrases(listOfListOfSearchResults); }
/** * This is the entry point into the test driver program. */ public static void main(String[] args) throws Throwable { System.out.println("Starting SearchStreamGangTest"); // Parse the command-line arguments. Options.getInstance().parseArgs(args); // All the input is initialized here. List<List<CharSequence>> inputData = new ArrayList<List<CharSequence>>() { { // Create a list of input from the complete works of // William Shakespeare. add(TestDataFactory // Split input by input separator from Options singleton. .getSharedInput(sSHAKESPEARE_DATA_FILE, Options.getInstance().getInputSeparator())); } }; // Get the list of input phases to find. List<String> phaseList = TestDataFactory.getPhraseList(sPHASE_LIST_FILE); // Create/run StreamGangs to search for the phases to find. runTests(phaseList, inputData); System.out.println("Ending SearchStreamGangTest"); }