Пример #1
0
 private static void Dispose(ref SelectSlinqContext <U, UC, T, C> context, out Option <U> next)
 {
     next = new Option <U>();
     context.bd.Release();
     context.chained.dispose(ref context.chained.context, out context.chained.current);
     context.selected.dispose(ref context.selected.context, out context.selected.current);
 }
Пример #2
0
        private static void Remove(ref SelectSlinqContext <U, UC, T, C> context, out Option <U> next)
        {
            context.bd.DetectBacktrack();

            context.needsMove = false;
            context.selected.remove(ref context.selected.context, out context.selected.current);
            Skip(ref context, out next);
        }
Пример #3
0
        private static void Skip(ref SelectSlinqContext <U, UC, T, C> context, out Option <U> next)
        {
            context.bd.DetectBacktrack();

            if (context.needsMove)
            {
                context.selected.skip(ref context.selected.context, out context.selected.current);
            }
            else
            {
                context.needsMove = true;
            }

            if (!context.selected.current.isSome && context.chained.current.isSome)
            {
                context.chained.skip(ref context.chained.context, out context.chained.current);
                while (context.chained.current.isSome)
                {
                    context.selected = context.selector(context.chained.current.value);
                    if (context.selected.current.isSome)
                    {
                        break;
                    }
                    else
                    {
                        context.chained.skip(ref context.chained.context, out context.chained.current);
                    }
                }
            }

            next = context.selected.current;

            if (!next.isSome)
            {
                context.bd.Release();
            }
        }