예제 #1
0
        internal Tuple <IIndex <a>, VectorConstruction, VectorConstruction> makeTwoSeriesConstructions <a>(a[] spec_0, FSharpList <Tuple <long, long>[]> spec_1, VectorConstruction v1, VectorConstruction v2, FSharpOption <bool> ordered)
        {
            Tuple <a[], FSharpList <Tuple <long, long>[]> > tuple1 = new Tuple <a[], FSharpList <Tuple <long, long>[]> >(spec_0, spec_1);
            LinearIndexBuilder linearIndexBuilder = this;
            Tuple <a[], FSharpList <Tuple <long, long>[]> > tuple2 = tuple1;
            IEnumerable <VectorConstruction> vectors = IEnumerable <VectorConstruction> .Cons(v1, IEnumerable <VectorConstruction> .Cons(v2, IEnumerable <VectorConstruction> .get_Empty()));

            FSharpOption <bool> ordered1 = ordered;

            a[] keys = tuple2.Item1;
            FSharpList <Tuple <long, long>[]> relocations = tuple2.Item2;
            Tuple <IIndex <a>, IEnumerable <VectorConstruction> > tuple3 = linearIndexBuilder.makeSeriesConstructions <a>(keys, relocations, vectors, ordered1);

            if (tuple3.Item2.get_TailOrNull() != null)
            {
                IEnumerable <VectorConstruction> fsharpList = tuple3.Item2;
                if (fsharpList.get_TailOrNull().get_TailOrNull() != null)
                {
                    IEnumerable <VectorConstruction> tailOrNull = fsharpList.get_TailOrNull();
                    if (tailOrNull.get_TailOrNull().get_TailOrNull() == null)
                    {
                        VectorConstruction headOrDefault1 = tailOrNull.get_HeadOrDefault();
                        VectorConstruction headOrDefault2 = fsharpList.get_HeadOrDefault();
                        return(new Tuple <IIndex <a>, VectorConstruction, VectorConstruction>(tuple3.Item1, headOrDefault2, headOrDefault1));
                    }
                }
            }
            throw Operators.Failure("makeTwoSeriesConstructions: Expected two vectors");
        }
예제 #2
0
        Tuple <IIndex <K>, VectorConstruction> IIndexBuilder.Merge <K>(FSharpList <Tuple <IIndex <K>, VectorConstruction> > constructions, VectorListTransform transform)
        {
            bool flag = ListModule.ForAll <Tuple <IIndex <K>, VectorConstruction> >((Func <M0, bool>) new LinearIndex.allOrdered <K>(), (FSharpList <M0>)constructions);
            Func <IComparer <K>, Tuple <Tuple <K[], FSharpList <Tuple <long, long>[]> >, FSharpOption <bool> > > Func1 = (Func <IComparer <K>, Tuple <Tuple <K[], FSharpList <Tuple <long, long>[]> >, FSharpOption <bool> > >) new LinearIndex.mergeOrdered <K>(constructions);
            Func <Unit, Tuple <Tuple <K[], FSharpList <Tuple <long, long>[]> >, FSharpOption <bool> > >          Func2 = (Func <Unit, Tuple <Tuple <K[], FSharpList <Tuple <long, long>[]> >, FSharpOption <bool> > >) new LinearIndex.mergeUnordered <K>(constructions);
            Tuple <Tuple <K[], FSharpList <Tuple <long, long>[]> >, FSharpOption <bool> > tuple1;

            if (flag)
            {
                Comparer <K> comparer = ((Tuple <IIndex <K>, VectorConstruction>)ListModule.Head <Tuple <IIndex <K>, VectorConstruction> >((FSharpList <M0>)constructions)).Item1.Comparer;
                Tuple <Tuple <K[], FSharpList <Tuple <long, long>[]> >, FSharpOption <bool> > tuple2;
                try
                {
                    tuple2 = Func1.Invoke((IComparer <K>)comparer);
                }
                catch (object ex)
                {
                    if ((Exception)ex is ComparisonFailedException)
                    {
                        tuple2 = Func2.Invoke((Unit)null);
                    }
                    else
                    {
                        throw;
                    }
                }
                tuple1 = tuple2;
            }
            else
            {
                tuple1 = Func2.Invoke((Unit)null);
            }
            Tuple <Tuple <K[], FSharpList <Tuple <long, long>[]> >, FSharpOption <bool> > tuple3 = tuple1;
            FSharpOption <bool> fsharpOption = tuple3.Item2;
            Tuple <K[], FSharpList <Tuple <long, long>[]> > tuple4 = tuple3.Item1;
            IEnumerable <VectorConstruction> fsharpList1           = (IEnumerable <VectorConstruction>)ListModule.Map <Tuple <IIndex <K>, VectorConstruction>, VectorConstruction>((Func <M0, M1>) new LinearIndex.vectors <K>(), (FSharpList <M0>)constructions);
            LinearIndexBuilder linearIndexBuilder = this;
            Tuple <K[], FSharpList <Tuple <long, long>[]> > tuple5 = tuple4;
            IEnumerable <VectorConstruction> vectors = fsharpList1;
            FSharpOption <bool> ordered = fsharpOption;

            K[] keys = tuple5.Item1;
            FSharpList <Tuple <long, long>[]> relocations = tuple5.Item2;
            Tuple <IIndex <K>, IEnumerable <VectorConstruction> > tuple6 = linearIndexBuilder.makeSeriesConstructions <K>(keys, relocations, vectors, ordered);
            IEnumerable <VectorConstruction> fsharpList2 = tuple6.Item2;
            IIndex <K> newIndex = tuple6.Item1;

            return(new Tuple <IIndex <K>, VectorConstruction>(newIndex, VectorConstruction.NewCombine((Lazy <long>)LazyExtensions.Create <long>((Func <Unit, M0>) new LinearIndex.DeedleIndicesIIndexBuilderMerge <K>(newIndex)), fsharpList2, transform)));
        }