private static Bitset[] CreateBitsets(OutputModelFactory factory,
IntervalSet set,
int wordSize,
bool useZeroOffset)
{
IList<Bitset> bitsetList = new List<Bitset>();
foreach (int ttype in set.ToArray())
{
Bitset current = bitsetList.Count > 0 ? bitsetList[bitsetList.Count - 1] : null;
if (current == null || ttype > (current.shift + wordSize - 1))
{
current = new Bitset();
if (useZeroOffset && ttype >= 0 && ttype < wordSize - 1)
{
current.shift = 0;
}
else
{
current.shift = ttype;
}
bitsetList.Add(current);
}
current.ttypes.Add(factory.GetTarget().GetTokenTypeAsTargetLabel(factory.GetGrammar(), ttype));
}
return bitsetList.ToArray();
}