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; }
//////////////////////////////////////////////////////////////// // 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; }
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); }
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); }
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; }