Beispiel #1
0
        Tuple <IIndex <K>, VectorConstruction> IIndexBuilder.GetRange <K>(Tuple <IIndex <K>, VectorConstruction> _arg12, Tuple <FSharpOption <Tuple <K, BoundaryBehavior> >, FSharpOption <Tuple <K, BoundaryBehavior> > > _arg13)
        {
            Tuple <IIndex <K>, VectorConstruction> tuple1 = _arg12;
            VectorConstruction vectorConstruction         = tuple1.Item2;
            IIndex <K>         index = tuple1.Item1;
            Tuple <FSharpOption <Tuple <K, BoundaryBehavior> >, FSharpOption <Tuple <K, BoundaryBehavior> > > tuple2 = _arg13;
            FSharpOption <Tuple <K, BoundaryBehavior> > fsharpOption1 = tuple2.Item1;
            FSharpOption <Tuple <K, BoundaryBehavior> > fsharpOption2 = tuple2.Item2;
            Tuple <long, long> tuple3 = new Tuple <long, long>(0L, index.KeyCount - 1L);
            long num1 = tuple3.Item1;
            long num2 = tuple3.Item2;
            FSharpOption <Tuple <K, BoundaryBehavior> > fsharpOption3 = fsharpOption1;
            long num3;

            if (fsharpOption3 != null)
            {
                FSharpOption <Tuple <K, BoundaryBehavior> > fsharpOption4 = fsharpOption3;
                K      key    = fsharpOption4.get_Value().Item1;
                Lookup lookup = !fsharpOption4.get_Value().Item2.Equals((object)BoundaryBehavior.get_Exclusive(), LanguagePrimitives.get_GenericEqualityComparer()) ? Lookup.ExactOrGreater : Lookup.Greater;
                FSharpChoice <Unit, Tuple <K, long> > fsharpChoice = OptionalValueModule.MissingPresent <Tuple <K, long> >(index.Lookup(key, lookup, (Func <long, bool>) new LinearIndex.loBound()));
                num3 = !(fsharpChoice is FSharpChoice <Unit, Tuple <K, long> > .Choice1Of2) ? ((FSharpChoice <Unit, Tuple <K, long> > .Choice2Of2)fsharpChoice).get_Item().Item2 : num2 + 1L;
            }
            else
            {
                num3 = num1;
            }
            long startAddress = num3;
            FSharpOption <Tuple <K, BoundaryBehavior> > fsharpOption5 = fsharpOption2;
            long num4;

            if (fsharpOption5 != null)
            {
                FSharpOption <Tuple <K, BoundaryBehavior> > fsharpOption4 = fsharpOption5;
                K      key    = fsharpOption4.get_Value().Item1;
                Lookup lookup = !fsharpOption4.get_Value().Item2.Equals((object)BoundaryBehavior.get_Exclusive(), LanguagePrimitives.get_GenericEqualityComparer()) ? Lookup.ExactOrSmaller : Lookup.Smaller;
                FSharpChoice <Unit, Tuple <K, long> > fsharpChoice = OptionalValueModule.MissingPresent <Tuple <K, long> >(index.Lookup(key, lookup, (Func <long, bool>) new LinearIndex.hiBound()));
                num4 = !(fsharpChoice is FSharpChoice <Unit, Tuple <K, long> > .Choice1Of2) ? ((FSharpChoice <Unit, Tuple <K, long> > .Choice2Of2)fsharpChoice).get_Item().Item2 : num1 - 1L;
            }
            else
            {
                num4 = num2;
            }
            long endAddress = num4;

            if (endAddress < startAddress)
            {
                return(new Tuple <IIndex <K>, VectorConstruction>((IIndex <K>) new LinearIndex <K>(System.Array.AsReadOnly <K>(new K[0]), (IIndexBuilder)this, FSharpOption <bool> .Some(true)), VectorConstruction.NewEmpty(0L)));
            }
            return(new Tuple <IIndex <K>, VectorConstruction>((IIndex <K>) new LinearRangeIndex <K>(index, startAddress, endAddress), VectorConstruction.NewGetRange(vectorConstruction, RangeRestriction <long> .NewFixed(startAddress, endAddress))));
        }
Beispiel #2
0
        public R GetAs <R>(K column, R fallback)
        {
            FSharpChoice <Unit, Tuple <K, long> > fsharpChoice1 = OptionalValueModule.\u007CMissing\u007CPresent\u007C <Tuple <K, long> > (this.index.Lookup(column, Lookup.Exact, (FSharpFunc <long, bool>) new \u0024Series.address\u00401230\u002D1()));

            if (fsharpChoice1 is FSharpChoice <Unit, Tuple <K, long> > .Choice1Of2)
            {
                throw new KeyNotFoundException(((FSharpFunc <K, string>)ExtraTopLevelOperators.PrintFormatToString <FSharpFunc <K, string> >((PrintfFormat <M0, Unit, string, string>) new PrintfFormat <FSharpFunc <K, string>, Unit, string, string, K>("The key %O is not present in the index"))).Invoke(column));
            }
            FSharpChoice <Unit, object> fsharpChoice2 = OptionalValueModule.\u007CMissing\u007CPresent\u007C <object> (this.vector.GetValue(((FSharpChoice <Unit, Tuple <K, long> > .Choice2Of2)fsharpChoice1).get_Item().Item2));

            if (!(fsharpChoice2 is FSharpChoice <Unit, object> .Choice1Of2))
            {
                return(Deedle.Internal.Convert.convertType <R>(ConversionKind.Flexible, ((FSharpChoice <Unit, object> .Choice2Of2)fsharpChoice2).get_Item()));
            }
            return(fallback);
        }
Beispiel #3
0
        Tuple <IIndex <K>, VectorConstruction> IIndexBuilder.DropItem <K>(Tuple <IIndex <K>, VectorConstruction> _arg10, K key)
        {
            Tuple <IIndex <K>, VectorConstruction> tuple1 = _arg10;
            VectorConstruction vectorConstruction1        = tuple1.Item2;
            IIndex <K>         index = tuple1.Item1;
            FSharpChoice <Unit, Tuple <K, long> > fsharpChoice = OptionalValueModule.MissingPresent <Tuple <K, long> >(index.Lookup(key, Lookup.Exact, (Func <long, bool>) new LinearIndex.DeedleIndicesIIndexBuilderDropItem()));

            if (fsharpChoice is FSharpChoice <Unit, Tuple <K, long> > .Choice2Of2)
            {
                Tuple <K, long>        tuple2 = ((FSharpChoice <Unit, Tuple <K, long> > .Choice2Of2)fsharpChoice).get_Item();
                VectorConstruction     vectorConstruction2 = VectorConstruction.NewDropRange(vectorConstruction1, RangeRestriction <long> .NewFixed(tuple2.Item2, tuple2.Item2));
                ReadOnlyCollection <K> keys = index.Keys;
                return(new Tuple <IIndex <K>, VectorConstruction>((IIndex <K>) new LinearIndex <K>(System.Array.AsReadOnly <K>(ArrayModule.OfSeq <K>(SeqModule.Filter <K>((Func <K, bool>) new LinearIndex.newKeys <K>(key), (IEnumerable <M0>)keys))), (IIndexBuilder)this, FSharpOption <bool> .Some(index.IsOrdered)), vectorConstruction2));
            }
            string paramName = nameof(key);

            throw new ArgumentException(((Func <K, string>)ExtraTopLevelOperators.PrintFormatToString <Func <K, string> >((PrintfFormat <M0, Unit, string, string>) new PrintfFormat <Func <K, string>, Unit, string, string, K>("The key '%O' is not present in the index."))).Invoke(key), paramName);
        }