public HyphenationTree() { stoplist = new HashMap<string, IList<object>>(23); // usually a small table classmap = new TernaryTree(); vspace = new ByteVector(); vspace.Alloc(1); // this reserves index 0, which we don't use }
public HyphenationTree() { m_stoplist = new JCG.Dictionary <string, IList <object> >(23); // usually a small table m_classmap = new TernaryTree(); m_vspace = new ByteVector(); m_vspace.Alloc(1); // this reserves index 0, which we don't use }
public HyphenationTree() { stoplist = new HashMap <string, IList <object> >(23); // usually a small table classmap = new TernaryTree(); vspace = new ByteVector(); vspace.Alloc(1); // this reserves index 0, which we don't use }
/// <summary> /// Packs the values by storing them in 4 bits, two values into a byte Values /// range is from 0 to 9. We use zero as terminator, so we'll add 1 to the /// value. /// </summary> /// <param name="values"> a string of digits from '0' to '9' representing the /// interletter values. </param> /// <returns> the index into the vspace array where the packed values are stored. </returns> protected virtual int PackValues(string values) { int i, n = values.Length; int m = (n & 1) == 1 ? (n >> 1) + 2 : (n >> 1) + 1; int offset = m_vspace.Alloc(m); byte[] va = m_vspace.Array; for (i = 0; i < n; i++) { int j = i >> 1; byte v = (byte)((values[i] - '0' + 1) & 0x0f); if ((i & 1) == 1) { va[j + offset] = (byte)(va[j + offset] | v); } else { va[j + offset] = (byte)(v << 4); // big endian } } va[m - 1 + offset] = 0; // terminator return(offset); }