Beispiel #1
0
        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();
            }
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
 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);
 }