Example #1
0
 /// <summary>Sets the value for the specified key.</summary>
 /// <param name="key">The key whose value should be set.</param>
 /// <param name="value">The value to which the key should be set.</param>
 public void SetValue(TKey key, Task <TValue> value)
 {
     if (key == null)
     {
         throw new ArgumentNullException("key");
     }
     _map[key] = LazyExtensions.Create(value);
 }
Example #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)));
        }
Example #3
0
        static VectorHelpers()
        {
            /// Type code of the type for efficient type equality test
            RuntimeTypeHandle typeHandle1 = typeof(double).TypeHandle;
            IntPtr            num1        = StartupCodeDeedle.Deedle.VectorHelpers.doubleCode = typeHandle1.Value;

            RuntimeTypeHandle typeHandle2 = typeof(int).TypeHandle;
            IntPtr            num2        = StartupCodeDeedle.Deedle.VectorHelpers.intCode = typeHandle2.Value;

            RuntimeTypeHandle typeHandle3 = typeof(string).TypeHandle;
            IntPtr            num3        = StartupCodeDeedle.Deedle.VectorHelpers.stringCode = typeHandle3.Value;

            //TODO:
            Lazy <MethodInfo> lazy1 = StartupCodeDeedle.Deedle.VectorHelpers.convertTypeMethod =
                Lazy <_> .Create((FSharpFunc <Unit, M0>) new Deedle.VectorHelpers.convertTypeMethod());

            intTypes = new[] { typeof(byte),
                               typeof(sbyte),
                               typeof(short),
                               typeof(ushort),
                               typeof(int) };

            int64Types = intTypes.Union(new[]
            {
                typeof(uint),
                typeof(long)
            }).ToArray();

            floatTypes = int64Types.Union(new[]
            {
                typeof(Decimal),
                typeof(ulong),
                typeof(float),
                typeof(double)
            }).ToArray();

            stringTypes = new[]
            {
                typeof(char),
                typeof(string)
            };

            Type bottom = Deedle.VectorHelpers.Inference.Bottom;

            Type top = Deedle.VectorHelpers.Inference.Top;

            Lazy <ModuleBuilder> lazy2 = StartupCodeDeedle.Deedle.VectorHelpers.typedRowModule = (Lazy <ModuleBuilder>)LazyExtensions.Create <ModuleBuilder>((FSharpFunc <Unit, M0>) new Deedle.VectorHelpers.typedRowModule());

            ConstructorInfo constructorInfo = StartupCodeDeedle.Deedle.VectorHelpers.objCtor = typeof(object).GetConstructor(new Type[0]);

            Type addrTyp = Deedle.VectorHelpers.Reflection.addrTyp;

            Type type1 = typeof(OptionalValue <object>);

            Type type2 = StartupCodeDeedle.Deedle.VectorHelpers.optTyp = !type1.GetTypeInfo().IsGenericType ? type1 : type1.GetGenericTypeDefinition();

            FSharpRef <int> fsharpRef = StartupCodeDeedle.Deedle.VectorHelpers.typeCounter = (FSharpRef <int>)Operators.Ref <int>((M0)0);

            Dictionary <Tuple <Type, FSharpList <string> >, Tuple <object, FSharpList <Tuple <string, Type> > > > dictionary = StartupCodeDeedle.Deedle.VectorHelpers.createdTypedRowsCache = new Dictionary <Tuple <Type, FSharpList <string> >, Tuple <object, FSharpList <Tuple <string, Type> > > >();
        }
Example #4
0
        public void Test_LazyExtensions_Create()
        {
            var result = LazyExtensions.Create <int>(5).Value;

            Assert.AreEqual(5, result);
        }
Example #5
0
        public static Series <K, int> Diff <K>(this Series <K, int> series, int offset)
        {
            Series <K, int> series1  = series;
            int             num      = offset;
            Series <K, int> series2  = series1;
            IVectorBuilder  instance = FVectorBuilderimplementation.VectorBuilder.Instance;
            Tuple <IIndex <K>, VectorConstruction> tuple = series2.Index.Builder.Shift <K>(new Tuple <IIndex <K>, VectorConstruction>(series2.Index, VectorConstruction.NewReturn(0)), num);
            VectorConstruction vectorConstruction1       = tuple.Item2;
            IIndex <K>         index = tuple.Item1;
            VectorConstruction vectorConstruction2 = series2.Index.Builder.Shift <K>(new Tuple <IIndex <K>, VectorConstruction>(series2.Index, VectorConstruction.NewReturn(0)), -num).Item2;
            VectorConstruction vectorConstruction3 = VectorConstruction.NewCombine((Lazy <long>)LazyExtensions.Create <long>((FSharpFunc <Unit, M0>) new SeriesExtensions.Diff2 <K>(index)), FSharpList <VectorConstruction> .Cons(vectorConstruction2, FSharpList <VectorConstruction> .Cons(vectorConstruction1, FSharpList <VectorConstruction> .get_Empty())), VectorListTransform.NewBinary((IBinaryTransform) new SeriesExtensions.Diff5((FSharpFunc <OptionalValue <int>, FSharpFunc <OptionalValue <int>, OptionalValue <int> > >) new SeriesExtensions.Diff4((FSharpFunc <int, FSharpFunc <int, int> >) new SeriesExtensions.Diff3()))));
            IVector <int>      vector = instance.Build <int>(index.AddressingScheme, vectorConstruction3, new IVector <int>[1]
            {
                series2.Vector
            });

            return(new Series <K, int>(index, vector, instance, series2.Index.Builder));
        }
Example #6
0
 /// <summary>
 /// Sets the value for the specified key.
 /// </summary>
 /// <param name="key">The key whose value should be set.</param>
 /// <param name="value">The value to which the key should be set.</param>
 public void SetValue(TKey key, Task <TValue> value)
 {
     this._map[key] = LazyExtensions.Create(value);
 }