@Test public void dictionaryContainTest() { ArrayList<String> str = new ArrayList<String>(); str.add("part"); str.add("part"); str.add("par"); str.add("partition"); str.add("party"); str.add("parties"); str.add("paint"); TrieDictionaryBuilder<String> b = newDictBuilder(str); int baseId = new Random().nextInt(100); TrieDictionary<String> dict = b.build(baseId); str.add("py"); b = newDictBuilder(str); baseId = new Random().nextInt(100); TrieDictionary<String> dict2 = b.build(baseId); assertEquals(true, dict2.contains(dict)); assertEquals(false, dict.contains(dict2)); }
@Override public boolean contains(Dictionary other) { if (other.getSize() > this.getSize()) { return false; } for (int i = other.getMinId(); i <= other.getMaxId(); ++i) { T v = (T) other.getValueFromId(i); if (!this.containsValue(v)) { return false; } } return true; }
TrieDictionary extends CacheDictionary<T> { @Override public boolean contains(Dictionary other) { if (other.getSize() > this.getSize()) { return false; } for (int i = other.getMinId(); i <= other.getMaxId(); ++i) { T v = (T) other.getValueFromId(i); if (!this.containsValue(v)) { return false; } } return true; } }
TrieDictionary extends CacheDictionary<T> { @Override public boolean contains(Dictionary other) { if (other.getSize() > this.getSize()) { return false; } for (int i = other.getMinId(); i <= other.getMaxId(); ++i) { T v = (T) other.getValueFromId(i); if (!this.containsValue(v)) { return false; } } return true; } TrieDictionary();  TrieDictionary(byte[] trieBytes); }
TrieDictionary extends CacheDictionary<T> { @Override public boolean contains(Dictionary other) { if (other.getSize() > this.getSize()) { return false; } for (int i = other.getMinId(); i <= other.getMaxId(); ++i) { T v = (T) other.getValueFromId(i); if (!this.containsValue(v)) { return false; } } return true; } TrieDictionary();  TrieDictionary(byte[] trieBytes); @Override int getMinId(); @Override int getMaxId(); @Override int getSizeOfId(); @Override int getSizeOfValue(); int getStorageSizeInBytes(); @Override void write(DataOutput out); @Override void readFields(DataInput in); @Override List<T> enumeratorValues(); @Override void dump(PrintStream out); @Override int hashCode(); @Override boolean equals(Object o); @Override boolean contains(Dictionary other); static void main(String[] args); }
TrieDictionary extends CacheDictionary<T> { @Override public boolean contains(Dictionary other) { if (other.getSize() > this.getSize()) { return false; } for (int i = other.getMinId(); i <= other.getMaxId(); ++i) { T v = (T) other.getValueFromId(i); if (!this.containsValue(v)) { return false; } } return true; } TrieDictionary();  TrieDictionary(byte[] trieBytes); @Override int getMinId(); @Override int getMaxId(); @Override int getSizeOfId(); @Override int getSizeOfValue(); int getStorageSizeInBytes(); @Override void write(DataOutput out); @Override void readFields(DataInput in); @Override List<T> enumeratorValues(); @Override void dump(PrintStream out); @Override int hashCode(); @Override boolean equals(Object o); @Override boolean contains(Dictionary other); static void main(String[] args); static final byte[] MAGIC; static final int MAGIC_SIZE_I; static final int BIT_IS_LAST_CHILD; static final int BIT_IS_END_OF_VALUE; }