Esempio n. 1
0
        // =================================================================================
        // access to the words
        // =================================================================================

        /// <exclude/>
        /// <summary>
        /// Uses the column map to map the character to a column number, then passes
        /// the row and column number to the other version of at()
        /// </summary>
        ///
        /// <param name="row">The current state</param>
        /// <param name="ch">The character whose column we're interested in</param>
        /// <returns>The new state to transition to</returns>
        public short At(int row, char ch)
        {
            int col = columnMap.ElementAt(ch);

            return(At(row, col));
        }
Esempio n. 2
0
        /// <exclude/>
        public void ReadDictionaryFile(DataInputStream ins0)
        {
            int l;

            // read in the version number (right now we just ignore it)
            ins0.ReadInt();

            // read in the column map (this is serialized in its internal form:
            // an index array followed by a data array)
            l = ins0.ReadInt();
            char[] temp = new char[l];
            for (int i = 0; i < temp.Length; i++)
            {
                temp[i] = (char)ins0.ReadShort();
            }
            l = ins0.ReadInt();
            sbyte[] temp2 = new sbyte[l];
            for (int i_0 = 0; i_0 < temp2.Length; i_0++)
            {
                temp2[i_0] = ins0.ReadByte();
            }
            columnMap = new CompactByteArray(temp, temp2);

            // read in numCols and numColGroups
            numCols = ins0.ReadInt();
            /* numColGroups = */ ins0.ReadInt();

            // read in the row-number index
            l        = ins0.ReadInt();
            rowIndex = new short[l];
            for (int i_1 = 0; i_1 < rowIndex.Length; i_1++)
            {
                rowIndex[i_1] = ins0.ReadShort();
            }

            // load in the populated-cells bitmap: index first, then bitmap list
            l = ins0.ReadInt();
            rowIndexFlagsIndex = new short[l];
            for (int i_2 = 0; i_2 < rowIndexFlagsIndex.Length; i_2++)
            {
                rowIndexFlagsIndex[i_2] = ins0.ReadShort();
            }
            l             = ins0.ReadInt();
            rowIndexFlags = new int[l];
            for (int i_3 = 0; i_3 < rowIndexFlags.Length; i_3++)
            {
                rowIndexFlags[i_3] = ins0.ReadInt();
            }

            // load in the row-shift index
            l = ins0.ReadInt();
            rowIndexShifts = new sbyte[l];
            for (int i_4 = 0; i_4 < rowIndexShifts.Length; i_4++)
            {
                rowIndexShifts[i_4] = ins0.ReadByte();
            }

            // finally, load in the actual state table
            l     = ins0.ReadInt();
            table = new short[l];
            for (int i_5 = 0; i_5 < table.Length; i_5++)
            {
                table[i_5] = ins0.ReadShort();
            }

            // this data structure is only necessary for testing and debugging
            // purposes
            reverseColumnMap = new char[numCols];
            for (char c = (char)(0); c < 0xffff; c++)
            {
                int col = columnMap.ElementAt(c);
                if (col != 0)
                {
                    reverseColumnMap[col] = c;
                }
            }

            // close the stream
            ins0.Close();
        }