private static void Skip(ref IntContext <T, C> context, out Option <T> next) { context.bd.DetectBacktrack(); if (context.count-- > 0) { if (context.needsMove) { context.chained.skip(ref context.chained.context, out context.chained.current); } else { context.needsMove = true; } } else if (context.chained.current.isSome) { context.chained.dispose(ref context.chained.context, out context.chained.current); } next = context.chained.current; if (!next.isSome) { context.bd.Release(); } }
private static void Remove(ref IntContext <T, C> context, out Option <T> next) { context.bd.DetectBacktrack(); context.needsMove = false; context.chained.remove(ref context.chained.context, out context.chained.current); Skip(ref context, out next); }
private static void Dispose(ref IntContext <T, C> context, out Option <T> next) { next = new Option <T>(); context.bd.Release(); context.chained.dispose(ref context.chained.context, out context.chained.current); }