public void BreakWords(char[] charBuff, int startAt)
{
//conver to char buffer
int j = charBuff.Length;
textLength = j;
visitor.LoadText(charBuff, 0);
//----------------------------------------
BreakingEngine currentEngine = breakingEngine = SelectEngine(charBuff[startAt]);
//----------------------------------------
//select breaking engine
for (; ;)
{
//----------------------------------------
currentEngine.BreakWord(visitor, charBuff, startAt, charBuff.Length - startAt);
switch (visitor.State)
{
default: throw new NotSupportedException();
case VisitorState.End:
//ok
return;
case VisitorState.OutOfRangeChar:
{
//find proper breaking engine for current char
BreakingEngine anotherEngine = SelectEngine(visitor.Char);
if (anotherEngine == currentEngine)
{
throw new NotSupportedException();
}
else
{
currentEngine = anotherEngine;
startAt = visitor.CurrentIndex;
}
}
break;
}
}
}