List of usage examples for org.apache.commons.collections4.trie PatriciaTrie PatriciaTrie
public PatriciaTrie()
From source file:de.khiem.offsite.tree.tri.Main.java
void test1() { PatriciaTrie<O> t = new PatriciaTrie<>(); AtomicLong id = new AtomicLong(); D r = new D(id.incrementAndGet()); //1 r.children.add(new M(id.incrementAndGet())); //1.2 r.children.add(new M(id.incrementAndGet())); //1.3 r.children.add(new F(id.incrementAndGet())); //1.4 D f = new D(id.incrementAndGet()); //1.5 f.children.add(new F(id.incrementAndGet())); //1.5.6 f.children.add(new M(id.incrementAndGet()));//1.5.7 r.children.add(f);//from w w w .j a v a 2 s . c o m add(t, r, ""); FT ft = new FT(r); search(t, "1"); System.out.println("FT: " + ft.findByKey("1")); System.out.println("=============="); search(t, "1.2"); System.out.println("FT: " + ft.findByKey("1.2")); System.out.println("=============="); search(t, "1.3"); System.out.println("FT: " + ft.findByKey("1.3")); System.out.println("=============="); search(t, "1.4"); System.out.println("FT: " + ft.findByKey("1.4")); System.out.println("=============="); search(t, "1.5"); System.out.println("FT: " + ft.findByKey("1.5")); System.out.println("=============="); search(t, "1.5.6"); System.out.println("FT: " + ft.findByKey("1.5.6")); System.out.println("=============="); search(t, "1.5.7"); System.out.println("FT: " + ft.findByKey("1.5.7")); System.out.println("=================="); //System.out.println("from 1, 3 layers:" + ft.findSubs("1", 3)); System.out.println("from 1, 1 layers:" + ft.findSubs("1", 1)); //System.out.println("from 1.5, 1 layers:" + ft.findSubs("1.5", 1)); //System.out.println("from 1.5, 2 layers:" + ft.findSubs("1.5", 2)); /* searchWithId(t, 1l); searchWithId(t, 2l); searchWithId(t, 3l); searchWithId(t, 4l); searchWithId(t, 5l); searchWithId(t, 6l); searchWithId(t, 7l); */ }
From source file:com.salesforce.ide.apex.internal.core.tooling.systemcompletions.model.Namespace.java
void beforeUnmarshal(Unmarshaller unmarshaller, Object parent) { typeTrie = new PatriciaTrie<>(); }
From source file:com.salesforce.ide.apex.internal.core.tooling.systemcompletions.model.Type.java
void beforeUnmarshal(Unmarshaller unmarshaller, Object parent) { constructorTrie = new PatriciaTrie<>(); methodTrie = new PatriciaTrie<>(); propertyTrie = new PatriciaTrie<>(); }
From source file:com.salesforce.ide.apex.internal.core.tooling.systemcompletions.model.Completions.java
void beforeUnmarshal(Unmarshaller unmarshaller, Object parent) { namespaceTrie = new PatriciaTrie<>(); }
From source file:gr.demokritos.biographs.indexing.databases.TrieDatabase.java
/** * Creates a blank TrieDatabase object. */ public TrieDatabase() { super(); trieIndex = new PatriciaTrie<List<String>>(); }
From source file:gr.demokritos.biographs.indexing.databases.TrieIndex.java
/** * Creates a blank TrieIndex object. */ public TrieIndex() { super(); trieIndex = new PatriciaTrie<List<TrieEntry>>(); }
From source file:com.github.tteofili.p2h.Par2HierUtils.java
/** * transforms paragraph vectors into hierarchical vectors * @param iterator iterator over docs/* w ww . jav a 2s . c o m*/ * @param lookupTable the paragraph vector table * @param labels the labels * @param k the no. of centroids * @return a map doc->hierarchical vector */ static Map<String, INDArray> getPar2Hier(LabelAwareIterator iterator, WeightLookupTable<VocabWord> lookupTable, List<String> labels, int k, Method method) { Collections.sort(labels); LabelsSource labelsSource = iterator.getLabelsSource(); PatriciaTrie<String> trie = new PatriciaTrie<>(); for (String label : labels) { trie.put(label, label); } Map<String, INDArray> hvs = new TreeMap<>(); // for each doc for (String node : labelsSource.getLabels()) { Par2HierUtils.getPar2HierVector(lookupTable, trie, node, k, hvs, method); } return hvs; }
From source file:gr.demokritos.biographs.indexing.databases.TrieDatabase.java
/** * Creates a new TrieDatabase object for maintaining * a database in a given directory.//from ww w . j av a 2 s .co m * @param path the directory in which the database resides */ public TrieDatabase(String path) { super(path); trieIndex = new PatriciaTrie<List<String>>(); }
From source file:cherry.foundation.telno.AreaCodeTableFactory.java
/** * ( (6?)??????) ??//from www . j a va2 s . c o m * * @return ( (6?)??????) * @throws InvalidFormatException ???? * @throws IOException ?? */ @Override public Trie<String, Integer> getObject() throws InvalidFormatException, IOException { Trie<String, Integer> trie = new PatriciaTrie<>(); for (Resource r : resources) { try (InputStream in = r.getInputStream()) { Map<String, Pair<String, String>> map = soumuExcelParser.parse(in); for (Map.Entry<String, Pair<String, String>> entry : map.entrySet()) { trie.put(entry.getKey(), entry.getValue().getLeft().length()); } } } return trie; }
From source file:gr.demokritos.biographs.indexing.databases.TrieIndex.java
/** * Creates a new TrieIndex object for maintaining * a database in a given directory./*from www. j a v a 2s .com*/ * @param path the directory in which the database resides */ public TrieIndex(String path) { super(path); trieIndex = new PatriciaTrie<List<TrieEntry>>(); }