/** * Flatten the trie into a byte array for a minimized memory footprint. * Lookup remains fast. Cost is inflexibility to modify (becomes immutable). * <p> * Flattened node structure is HEAD + NODEs, for each node: * - o byte, offset to child node, o = stats.mbpn_sizeChildOffset * - 1 bit, isLastChild flag, the 1st MSB of o * - 1 bit, isEndOfValue flag, the 2nd MSB of o * - c byte, number of values beneath, c = stats.mbpn_sizeNoValueBeneath * - 1 byte, number of value bytes * - n byte, value bytes */ public TrieDictionary<T> build(int baseId) { byte[] trieBytes = buildTrieBytes(baseId); TrieDictionary<T> r = new TrieDictionary<T>(trieBytes); return r; }
/** * Flatten the trie into a byte array for a minimized memory footprint. * Lookup remains fast. Cost is inflexibility to modify (becomes immutable). * * Flattened node structure is HEAD + NODEs, for each node: - o byte, offset * to child node, o = stats.mbpn_sizeChildOffset - 1 bit, isLastChild flag, * the 1st MSB of o - 1 bit, isEndOfValue flag, the 2nd MSB of o - c byte, * number of values beneath, c = stats.mbpn_sizeNoValueBeneath - 1 byte, * number of value bytes - n byte, value bytes */ public TrieDictionary<T> build(int baseId) { byte[] trieBytes = buildTrieBytes(baseId); TrieDictionary<T> r = new TrieDictionary<T>(trieBytes); return r; }
/** * Flatten the trie into a byte array for a minimized memory footprint. * Lookup remains fast. Cost is inflexibility to modify (becomes immutable). * * Flattened node structure is HEAD + NODEs, for each node: - o byte, offset * to child node, o = stats.mbpn_sizeChildOffset - 1 bit, isLastChild flag, * the 1st MSB of o - 1 bit, isEndOfValue flag, the 2nd MSB of o - c byte, * number of values beneath, c = stats.mbpn_sizeNoValueBeneath - 1 byte, * number of value bytes - n byte, value bytes */ public TrieDictionary<T> build(int baseId) { byte[] trieBytes = buildTrieBytes(baseId); TrieDictionary<T> r = new TrieDictionary<T>(trieBytes); return r; }
/** * Flatten the trie into a byte array for a minimized memory footprint. * Lookup remains fast. Cost is inflexibility to modify (becomes immutable). * <p> * Flattened node structure is HEAD + NODEs, for each node: * - o byte, offset to child node, o = stats.mbpn_sizeChildOffset * - 1 bit, isLastChild flag, the 1st MSB of o * - 1 bit, isEndOfValue flag, the 2nd MSB of o * - c byte, number of values beneath, c = stats.mbpn_sizeNoValueBeneath * - 1 byte, number of value bytes * - n byte, value bytes */ public TrieDictionary<T> build(int baseId) { byte[] trieBytes = buildTrieBytes(baseId); TrieDictionary<T> r = new TrieDictionary<T>(trieBytes); return r; }