public void showLocalFiles() { System.out.println("Local files:"); ArrayList<String> files = Configuration.getMyFiles(); Iterator<String> fileIterator = files.iterator(); while (fileIterator.hasNext()) { String temp = fileIterator.next(); System.out.println(temp); } }
// Check for the availability of files in local machine public ArrayList<String> searchQueryInLocal(String query) { ArrayList<String> files = Configuration.getMyFiles(); ArrayList<String> output = new ArrayList<String>(); String queryLC = query.toLowerCase(); Iterator<String> fileIterator = files.iterator(); while (fileIterator.hasNext()) { String temp = fileIterator.next(); String lowercase2 = temp.toLowerCase(); String[] words = lowercase2.split(" "); for (int i = 0; i < words.length; i++) { if (queryLC.matches(words[i])) { output.add(temp); break; } } // if (lowercase2.contains(queryLC)) { // output.add(temp); // } } return output; }