Exemplo n.º 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;
 }
Exemplo n.º 2
0
 ////////////////////////////////////////////////////////////////
 // methods
 ////////////////////////////////////////////////////////////////
 public 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;
 }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
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);
 }
Exemplo n.º 5
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;
 }