예제 #1
0
        private static void Remove(ref JoinContext <U, K, T2, T, C> context, out Option <U> next)
        {
            context.bd.DetectBacktrack();

            context.needsMove = false;
            context.chained.remove(ref context.chained.context, out context.chained.current);

            context.inner = context.chained.current.isSome ?
                            context.lookup.GetValues(context.outerSelector(context.chained.current.value)).head :
                            null;

            Skip(ref context, out next);
        }
예제 #2
0
        private static void Skip(ref JoinContext <U, K, T2, T, C> context, out Option <U> next)
        {
            context.bd.DetectBacktrack();

            if (context.needsMove)
            {
                context.inner = context.inner.next;
            }
            else
            {
                context.needsMove = true;
            }

            if (context.inner == null && context.chained.current.isSome)
            {
                context.chained.skip(ref context.chained.context, out context.chained.current);
                while (context.chained.current.isSome)
                {
                    context.inner = context.lookup.GetValues(context.outerSelector(context.chained.current.value)).head;
                    if (context.inner == null)
                    {
                        context.chained.skip(ref context.chained.context, out context.chained.current);
                    }
                    else
                    {
                        break;
                    }
                }
            }

            if (context.chained.current.isSome)
            {
                next = new Option <U>(context.resultSelector(context.chained.current.value, context.inner.value));
            }
            else
            {
                next = new Option <U>();
                context.bd.Release();
                if (context.release)
                {
                    context.lookup.DisposeInBackground();
                }
            }
        }