Back to project page Profiterole.
The source code is released under:
Apache License
If you think the Android project Profiterole listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package profiterole.waffle; /*from w w w . j a va 2s . c o m*/ //import java.util.ArrayList; //import java.util.HashMap; //import java.util.LinkedList; //import java.util.List; public class InvertedIndex { // public class ServiceInvertedIndex { // // // TODO problems // // 1. at the file name and from file name original file b/c currently the inverted index is per job // // and not per original file <== currently the tests are per file // // // List<HashMap<String, Integer>> jobs; // // public ServiceInvertedIndex(List<HashMap<String, Integer>> maps) { // this.jobs = maps; // } // // // // /////////////////////////// Inverted Index // // public List<HashMap<String, Integer>> doInvertedIndex(String element) { // // List<HashMap<String, Integer>> sets = new LinkedList<HashMap<String, Integer>>(); // // if (element == null) { // return sets; // } // // for (HashMap<String, Integer> set : jobs) { // if (set.containsKey(element)) { // sets.add(set); // } // } // // return sets; // } // // public List<HashMap<String, Integer>> doInvertedIndex(List<String> elements) { // // http://en.wikipedia.org/wiki/Inverted_index // List<HashMap<String, Integer>> result = new LinkedList<HashMap<String, Integer>>(); // // if (elements == null || elements.isEmpty()) { // return result; // } // // for (String word : elements) { // // 1. for each word finds its sets // List<HashMap<String, Integer>> current = doInvertedIndex(word); // // 2. dooes iterative intersection change intersection method to // // accept result list as parameter // result = intersection(result, current); // } // return result; // } // // /** // * return new list which is the intersection of the two argument lists // * // * @param list1 // * @param list2 // * @return // */ // public <T> List<T> intersection(List<T> list1, List<T> list2) { // List<T> list = new ArrayList<T>(); // // for (T t : list1) { // if (list2.contains(t)) { // list.add(t); // } // } // // return list; // } // // } }