示例#1
0
 protected SMModel(PkgInt classTable, int classFactor, PkgInt stateTable, int[] charLenTable, string name)
 {
     this.classTable   = classTable;
     this.classFactor  = classFactor;
     this.stateTable   = stateTable;
     this.charLenTable = charLenTable;
     this.name         = name;
 }
示例#2
0
        public SMState NextState(byte c)
        {
            //for each byte we get its class , if it is first byte, we also get byte length
            int byteCls = PkgInt.GETFROMPCK(c, mModel.classTable);

            if (mCurrentState == SMState.Start)
            {
                mCurrentBytePos = 0;
                mCurrentCharLen = mModel.charLenTable[byteCls];
            }
            //from byte's class and stateTable, we get its next state
            mCurrentState = (SMState)PkgInt.GETFROMPCK((int)mCurrentState * ((int)mModel.classFactor) + byteCls,
                                                       mModel.stateTable);
            mCurrentBytePos++;
            return(mCurrentState);
        }
示例#3
0
 public static int GETFROMPCK(int i, PkgInt c)
 {
     return(((c.data[(i) >> (int)c.idxsft]) >> ((i & (int)c.sftmsk) << (int)c.bitsft)) & (int)c.unitmsk);
 }