public int FindPopCount(int symbol, int sp, int count)
{
var n = this.SEQ.Count;
var pc = 0;
var i = 0;
while (pc < count && sp < n) {
if (this.SEQ [sp] == symbol) {
++pc;
}
++sp;
++i;
}
if (pc != count) {
throw new IndexOutOfRangeException(String.Format ("symbol: {0}, sp: {1}, count: {2}, pc: {3}, i: {4}",
symbol, sp, count, pc, i));
}
return sp - 1;
}