Esempio n. 1
0
        internal Tuple <LinearIndex <a>, VectorConstruction> asLinearIndex <a>(IIndex <a> index, VectorConstruction vector)
        {
            LinearIndex <a> linearIndex = index as LinearIndex <a>;

            if (linearIndex != null)
            {
                return(new Tuple <LinearIndex <a>, VectorConstruction>(linearIndex, vector));
            }
            IEnumerable <Tuple <long, long> > tuples = (IEnumerable <Tuple <long, long> >)SeqModule.MapIndexed <KeyValuePair <a, long>, Tuple <long, long> >((Func <int, Func <M0, M1> >) new LinearIndex.relocs <a>(), (IEnumerable <M0>)index.Mappings);
            VectorConstruction vectorConstruction    = VectorConstruction.NewRelocate(vector, index.KeyCount, tuples);

            return(new Tuple <LinearIndex <a>, VectorConstruction>(new LinearIndex <a>(System.Array.AsReadOnly <a>(ArrayModule.OfSeq <a>((IEnumerable <a>)SeqModule.Map <KeyValuePair <a, long>, a>((Func <M0, M1>) new LinearIndex.clo <a>(), (IEnumerable <M0>)index.Mappings))), LinearIndexBuilder.Instance, (FSharpOption <bool>)null), vectorConstruction));
        }
Esempio n. 2
0
        Tuple <IIndex <g>, VectorConstruction> IIndexBuilder.OrderIndex <g>(Tuple <IIndex <g>, VectorConstruction> _arg2)
        {
            Tuple <IIndex <g>, VectorConstruction> tuple = _arg2;
            VectorConstruction vectorConstruction        = tuple.Item2;
            IIndex <g>         index = tuple.Item1;

            g[] array = ArrayModule.OfSeq <g>((IEnumerable <M0>)index.Keys);
            ArrayModule.SortInPlaceWith <g>((Func <M0, Func <M0, int> >) new LinearIndex.DeedleIndicesIIndexBuilderOrderIndex <g>(index), array);
            IIndex <g> newIndex = (IIndex <g>) new LinearIndex <g>(System.Array.AsReadOnly <g>(array), (IIndexBuilder)this, FSharpOption <bool> .Some(true));
            IEnumerable <Tuple <long, long> > tuples = (IEnumerable <Tuple <long, long> >) new LinearIndex.relocations <g>(index, newIndex, new KeyValuePair <g, long>(), (Tuple <g, long>)null, new long(), default(g), (IEnumerator <KeyValuePair <g, long> >)null, 0, (Tuple <long, long>)null);

            return(new Tuple <IIndex <g>, VectorConstruction>(newIndex, VectorConstruction.NewRelocate(vectorConstruction, newIndex.KeyCount, tuples)));
        }
Esempio n. 3
0
        Tuple <IIndex <a>, VectorConstruction> IIndexBuilder.GetAddressRange <a>(Tuple <IIndex <a>, VectorConstruction> _arg11, RangeRestriction <long> range)
        {
            Tuple <IIndex <a>, VectorConstruction> tuple = _arg11;
            VectorConstruction vectorConstruction1       = tuple.Item2;
            IIndex <a>         index1  = tuple.Item1;
            IIndexBuilder      builder = (IIndexBuilder)this;
            FSharpChoice <Tuple <long, long>, IRangeRestriction <long> > fsharpChoice = range.AsAbsolute(index1.KeyCount);

            if (fsharpChoice is FSharpChoice <Tuple <long, long>, IRangeRestriction <long> > .Choice1Of2)
            {
                FSharpChoice <Tuple <long, long>, IRangeRestriction <long> > .Choice1Of2 choice1Of2 = (FSharpChoice <Tuple <long, long>, IRangeRestriction <long> > .Choice1Of2)fsharpChoice;
                long num1 = choice1Of2.get_Item().Item1;
                if (choice1Of2.get_Item().Item2 < num1)
                {
                    long num2 = choice1Of2.get_Item().Item1;
                    long num3 = choice1Of2.get_Item().Item2;
                    return(new Tuple <IIndex <a>, VectorConstruction>((IIndex <a>) new LinearIndex <a>(ReadOnlyCollection.empty <a>(), builder, FSharpOption <bool> .Some(true)), VectorConstruction.NewEmpty(0L)));
                }
            }
            if (!(fsharpChoice is FSharpChoice <Tuple <long, long>, IRangeRestriction <long> > .Choice2Of2))
            {
                FSharpChoice <Tuple <long, long>, IRangeRestriction <long> > .Choice1Of2 choice1Of2 = (FSharpChoice <Tuple <long, long>, IRangeRestriction <long> > .Choice1Of2)fsharpChoice;
                long startAddress         = choice1Of2.get_Item().Item1;
                long endAddress           = choice1Of2.get_Item().Item2;
                VectorConstruction range1 = VectorConstruction.NewGetRange(vectorConstruction1, RangeRestriction <long> .NewFixed(startAddress, endAddress));
                return(new Tuple <IIndex <a>, VectorConstruction>((IIndex <a>) new LinearRangeIndex <a>(index1, startAddress, endAddress), range1));
            }
            IRangeRestriction <long> indices = ((FSharpChoice <Tuple <long, long>, IRangeRestriction <long> > .Choice2Of2)fsharpChoice).get_Item();
            IEnumerable <a>          @as     = (IEnumerable <a>) new LinearIndex.newKeys <a>(index1, indices, new long(), (IEnumerator <long>)null, 0, default(a));
            IIndex <a> index2 = builder.Create <a>(@as, (FSharpOption <bool>)null);

            LinearIndex.relocations relocations59218 = new LinearIndex.relocations();
            long   lo  = 0;
            long   hi  = index2.KeyCount - 1L;
            object obj = lo > hi ? (object)new LinearIndex.relocations(lo, hi, 1L, (Func <long, Func <long, bool> >) new LinearIndex.relocations()) : (object)new LinearIndex.relocations(lo, hi, 1L, (Func <long, Func <long, bool> >) new LinearIndex.relocations());
            IEnumerable <Tuple <long, long> > tuples = (IEnumerable <Tuple <long, long> >)SeqModule.Zip <long, long>((IEnumerable <M0>)SeqModule.Map <long, long>((Func <M0, M1>)relocations59218, (IEnumerable <M0>)obj), (IEnumerable <M1>)indices);
            VectorConstruction vectorConstruction2   = VectorConstruction.NewRelocate(vectorConstruction1, index2.KeyCount, tuples);

            return(new Tuple <IIndex <a>, VectorConstruction>(index2, vectorConstruction2));
        }
Esempio n. 4
0
        Tuple <IIndex <b>, VectorConstruction> IIndexBuilder.LookupLevel <b>(Tuple <IIndex <b>, VectorConstruction> _arg9, ICustomLookup <b> searchKey)
        {
            Tuple <IIndex <b>, VectorConstruction> tuple = _arg9;
            VectorConstruction vectorConstruction        = tuple.Item2;
            IIndex <b>         index = tuple.Item1;

            Tuple <long, b>[] array = (Tuple <long, b>[])SeqModule.ToArray <Tuple <long, b> >((IEnumerable <M0>) new LinearIndex.matching <b>(searchKey, index, new KeyValuePair <b, long>(), (Tuple <b, long>)null, default(b), new long(), (IEnumerator <KeyValuePair <b, long> >)null, 0, (Tuple <long, b>)null));
            long length             = (long)array.Length;

            LinearIndex.relocs relocs5601 = new LinearIndex.relocs();
            long   lo  = 0;
            long   hi  = length - 1L;
            object obj = lo > hi ? (object)new LinearIndex.relocs(lo, hi, 1L, (Func <long, Func <long, bool> >) new LinearIndex.relocs()) : (object)new LinearIndex.relocs(lo, hi, 1L, (Func <long, Func <long, bool> >) new LinearIndex.relocs());
            IEnumerable <Tuple <long, long> > tuples = (IEnumerable <Tuple <long, long> >)SeqModule.Zip <long, long>((IEnumerable <M0>)SeqModule.Map <long, long>((Func <M0, M1>)relocs5601, (IEnumerable <M0>)obj), SeqModule.Map <Tuple <long, b>, long>((Func <M0, M1>) new LinearIndex.relocs <b>(), (IEnumerable <M0>)array));

            return(new Tuple <IIndex <b>, VectorConstruction>((IIndex <b>) new LinearIndex <b>(System.Array.AsReadOnly <b>(ArrayModule.OfSeq <b>((IEnumerable <b>)SeqModule.Map <Tuple <long, b>, b>((Func <M0, M1>) new LinearIndex.newIndex <b>(), (IEnumerable <M0>)array))), (IIndexBuilder)this, FSharpOption <bool> .Some(index.IsOrdered)), VectorConstruction.NewRelocate(vectorConstruction, length, tuples)));
        }
Esempio n. 5
0
        VectorConstruction IIndexBuilder.Reindex <e>(IIndex <e> index1, IIndex <e> index2, Lookup semantics, VectorConstruction vector, Func <long, bool> condition)
        {
            IEnumerable <Tuple <long, long> > tuples = semantics != Lookup.Exact ? (IEnumerable <Tuple <long, long> >) new LinearIndex.relocations <e>(index1, index2, semantics, condition, new KeyValuePair <e, long>(), (Tuple <e, long>)null, new long(), default(e), new OptionalValue <Tuple <e, long> >(), (IEnumerator <KeyValuePair <e, long> >)null, 0, (Tuple <long, long>)null) : (IEnumerable <Tuple <long, long> >) new LinearIndex.relocations <e>(index1, index2, condition, new KeyValuePair <e, long>(), (Tuple <e, long>)null, new long(), default(e), new long(), (IEnumerator <KeyValuePair <e, long> >)null, 0, (Tuple <long, long>)null);

            return(VectorConstruction.NewRelocate(vector, index2.KeyCount, tuples));
        }
Esempio n. 6
0
        Tuple <IIndex <TNewKey>, VectorConstruction> IIndexBuilder.WithIndex <K, TNewKey>(IIndex <K> index1, IVector <TNewKey> indexVector, VectorConstruction vector)
        {
            Tuple <TNewKey, long>[] array       = (Tuple <TNewKey, long>[])SeqModule.ToArray <Tuple <TNewKey, long> >((IEnumerable <M0>) new LinearIndex.newKeys <TNewKey, K>(index1, indexVector, new KeyValuePair <K, long>(), (Tuple <K, long>)null, new long(), default(K), new TNewKey(), (IEnumerator <KeyValuePair <K, long> >)null, 0, (Tuple <TNewKey, long>)null));
            LinearIndex <TNewKey>   linearIndex = new LinearIndex <TNewKey>(System.Array.AsReadOnly <TNewKey>((TNewKey[])ArrayModule.OfSeq <TNewKey>((IEnumerable <M0>)SeqModule.Map <Tuple <TNewKey, long>, TNewKey>((Func <M0, M1>) new LinearIndex.newIndex <TNewKey>(), (IEnumerable <M0>)array))), (IIndexBuilder)this, (FSharpOption <bool>)null);
            long keyCount = ((IIndex <TNewKey>)linearIndex).KeyCount;

            LinearIndex.relocations relocations5178 = new LinearIndex.relocations();
            long   lo  = 0;
            long   hi  = keyCount - 1L;
            object obj = lo > hi ? (object)new LinearIndex.relocations(lo, hi, 1L, (Func <long, Func <long, bool> >) new LinearIndex.relocations()) : (object)new LinearIndex.relocations(lo, hi, 1L, (Func <long, Func <long, bool> >) new LinearIndex.relocations());
            IEnumerable <Tuple <long, long> > tuples = (IEnumerable <Tuple <long, long> >)SeqModule.Zip <long, long>((IEnumerable <M0>)SeqModule.Map <long, long>((Func <M0, M1>)relocations5178, (IEnumerable <M0>)obj), SeqModule.Map <Tuple <TNewKey, long>, long>((Func <M0, M1>) new LinearIndex.relocations <TNewKey>(), (IEnumerable <M0>)array));

            return(new Tuple <IIndex <TNewKey>, VectorConstruction>((IIndex <TNewKey>)linearIndex, VectorConstruction.NewRelocate(vector, (long)array.Length, tuples)));
        }