assertEquals(id, dict.getIdFromValue(value)); assertEquals(value, dict.getValueFromId(id)); for (String s : notFound) { try { dict.getIdFromValue(s); fail("For not found value '" + s + "', IllegalArgumentException is expected"); } catch (IllegalArgumentException e) { int nullId = dict.getIdFromValue(null); assertNull(dict.getValueFromId(nullId));
assertEquals(id, dict.getIdFromValue(value)); assertEquals(value, dict.getValueFromId(id)); for (String s : notFound) { try { dict.getIdFromValue(s); fail("For not found value '" + s + "', IllegalArgumentException is expected"); } catch (IllegalArgumentException e) { int nullId = dict.getIdFromValue(null); assertNull(dict.getValueFromId(nullId)); int nullId2 = dict.getIdFromValueBytes(null, 0, 0);
int actualId = dict.getIdFromValue(value); assertTrue(actualId >= id); assertTrue(actualId > previousId);
@Test public void testAllNullValue() { ArrayList<String> strs = new ArrayList<String>(); strs.add(""); TrieDictionaryBuilder<String> builder = newDictBuilder(strs); TrieDictionary<String> dict = builder.build(0); assertEquals(1, dict.getSize()); assertEquals(0, dict.getIdFromValue("")); }
oldTrieBuilder.addValue(str); TrieDictionary<String> oldDict = oldTrieBuilder.build(0); keep |= oldDict.getIdFromValue(testData.get(0)); oldDictTotalBuildTime += (System.currentTimeMillis() - startTime); System.out.println("times:" + i);
public static void main(String[] args) throws Exception { TrieDictionaryBuilder<String> b = new TrieDictionaryBuilder<String>(new StringBytesConverter()); // b.addValue("part"); // b.print(); // b.addValue("part"); // b.print(); // b.addValue("par"); // b.print(); // b.addValue("partition"); // b.print(); // b.addValue("party"); // b.print(); // b.addValue("parties"); // b.print(); // b.addValue("paint"); // b.print(); b.addValue("-000000.41"); b.addValue("0000101.81"); b.addValue("6779331"); String t = "0000001.6131"; TrieDictionary<String> dict = b.build(0); System.out.println(dict.getIdFromValue(t, -1)); System.out.println(dict.getIdFromValue(t, 1)); } }
int actualId = dict.getIdFromValue(value); assertTrue(actualId >= id); assertTrue(actualId > previousId);