Merge branch 'dev' into code-cleanup

This commit is contained in:
Erwin de Haan
2019-01-11 12:50:36 +01:00
345 changed files with 2991 additions and 3236 deletions

View File

@@ -22,7 +22,7 @@
* Shy Shalom <shooshX@gmail.com>
* Kohei TAKETA <k-tak@void.in> (Java port)
* Rudi Pettazzi <rudi.pettazzi@gmail.com> (C# port)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
@@ -48,8 +48,8 @@ namespace UniversalDetector.Core
private SMModel model;
private int currentCharLen;
private int currentBytePos;
public CodingStateMachine(SMModel model)
public CodingStateMachine(SMModel model)
{
this.currentState = SMModel.START;
this.model = model;
@@ -57,24 +57,24 @@ namespace UniversalDetector.Core
public int NextState(byte b)
{
// for each byte we get its class, if it is first byte,
// for each byte we get its class, if it is first byte,
// we also get byte length
int byteCls = model.GetClass(b);
if (currentState == SMModel.START) {
if (currentState == SMModel.START) {
currentBytePos = 0;
currentCharLen = model.charLenTable[byteCls];
}
// from byte's class and stateTable, we get its next state
// from byte's class and stateTable, we get its next state
currentState = model.stateTable.Unpack(
currentState * model.ClassFactor + byteCls);
currentBytePos++;
return currentState;
}
public void Reset()
{
currentState = SMModel.START;
public void Reset()
{
currentState = SMModel.START;
}
public int CurrentCharLen => currentCharLen;