private void UpdateCatcher(CatcherInterval interval, bool create) { if (create) { CreateCatcher(interval); } else { RemoveCatcher(interval); } }
private void RemoveCatcher(CatcherInterval interval) { if (interval.L < -1) { return; } Catcher catcher; if (!catchers.TryGetValue(interval, out catcher)) { throw new InvalidProgramStateException(string.Format("Can't find catcher for interval: {0}", interval)); } catcher.RemoveTime = Text.Length; }
private void CreateCatcher(CatcherInterval interval) { if (interval.L < -1) { return; } var n = interval.L + 1 + S * interval.Length; Catcher catcher; var i = interval.R; var j = Math.Max(i, n - 1 - (new RationalNumber(S) / E * interval.Length).Ceil()); if (!catchers.TryGetValue(interval, out catcher)) { catcher = new Catcher(Text, i, j, E, DetectEqual, interval.Length); catcher.WarmUp(j + 2, Text.Length); catchers[interval] = catcher; } catcher.RemoveTime = -1; }