Exemple #1
0
        static void RecSort <T1, T2>(IDataFrameView df, int[] icols, bool ascending)
            where T1 : IEquatable <T1>, IComparable <T1>
            where T2 : IEquatable <T2>, IComparable <T2>
        {
            var kind = df.Kinds[icols[2]];

            if (icols.Length == 3)
            {
                switch (kind)
                {
                case DataKind.BL: df.TSort <T1, T2, DvBool>(icols, ascending); break;

                case DataKind.I4: df.TSort <T1, T2, DvInt4>(icols, ascending); break;

                case DataKind.U4: df.TSort <T1, T2, uint>(icols, ascending); break;

                case DataKind.I8: df.TSort <T1, T2, DvInt8>(icols, ascending); break;

                case DataKind.R4: df.TSort <T1, T2, float>(icols, ascending); break;

                case DataKind.R8: df.TSort <T1, T2, double>(icols, ascending); break;

                case DataKind.TX: df.TSort <T1, T2, DvText>(icols, ascending); break;

                default:
                    throw new NotImplementedException($"Sort is not implemented for type '{kind}'.");
                }
            }
            else
            {
                throw new NotImplementedException($"Sort is not implemented for {icols.Length} columns.");
            }
        }
Exemple #2
0
        static void RecSort(IDataFrameView df, int[] icols, bool ascending)
        {
            var kind = df.Kinds[icols[0]];

            if (icols.Length == 1)
            {
                switch (kind)
                {
                case DataKind.BL: df.TSort <DvBool>(icols, ascending); break;

                case DataKind.I4: df.TSort <DvInt4>(icols, ascending); break;

                case DataKind.U4: df.TSort <uint>(icols, ascending); break;

                case DataKind.I8: df.TSort <DvInt8>(icols, ascending); break;

                case DataKind.R4: df.TSort <float>(icols, ascending); break;

                case DataKind.R8: df.TSort <double>(icols, ascending); break;

                case DataKind.TX: df.TSort <DvText>(icols, ascending); break;

                default:
                    throw new NotImplementedException($"Sort is not implemented for type '{kind}'.");
                }
            }
            else
            {
                switch (kind)
                {
                case DataKind.BL: RecSort <DvBool>(df, icols, ascending); break;

                case DataKind.I4: RecSort <DvInt4>(df, icols, ascending); break;

                case DataKind.U4: RecSort <uint>(df, icols, ascending); break;

                case DataKind.I8: RecSort <DvInt8>(df, icols, ascending); break;

                case DataKind.R4: RecSort <float>(df, icols, ascending); break;

                case DataKind.R8: RecSort <double>(df, icols, ascending); break;

                case DataKind.TX: RecSort <DvText>(df, icols, ascending); break;

                default:
                    throw new NotImplementedException($"Sort is not implemented for type '{kind}'.");
                }
            }
        }
        static void RecSort <T1, T2>(IDataFrameView df, int[] icols, bool ascending)
            where T1 : IEquatable <T1>, IComparable <T1>
            where T2 : IEquatable <T2>, IComparable <T2>
        {
            var kind = df.Kinds[icols[2]];

            if (icols.Length == 3)
            {
                if (kind.IsVector())
                {
                    switch (kind.ItemType().RawKind())
                    {
                    case DataKind.BL: df.TSort <T1, T2, VBufferEqSort <bool> >(icols, ascending); break;

                    case DataKind.I4: df.TSort <T1, T2, VBufferEqSort <int> >(icols, ascending); break;

                    case DataKind.U4: df.TSort <T1, T2, VBufferEqSort <uint> >(icols, ascending); break;

                    case DataKind.I8: df.TSort <T1, T2, VBufferEqSort <long> >(icols, ascending); break;

                    case DataKind.R4: df.TSort <T1, T2, VBufferEqSort <float> >(icols, ascending); break;

                    case DataKind.R8: df.TSort <T1, T2, VBufferEqSort <double> >(icols, ascending); break;

                    case DataKind.TX: df.TSort <T1, T2, VBufferEqSort <DvText> >(icols, ascending); break;

                    default:
                        throw new NotImplementedException($"Sort is not implemented for type '{kind}'.");
                    }
                }
                else
                {
                    switch (kind.RawKind())
                    {
                    case DataKind.BL: df.TSort <T1, T2, bool>(icols, ascending); break;

                    case DataKind.I4: df.TSort <T1, T2, int>(icols, ascending); break;

                    case DataKind.U4: df.TSort <T1, T2, uint>(icols, ascending); break;

                    case DataKind.I8: df.TSort <T1, T2, long>(icols, ascending); break;

                    case DataKind.R4: df.TSort <T1, T2, float>(icols, ascending); break;

                    case DataKind.R8: df.TSort <T1, T2, double>(icols, ascending); break;

                    case DataKind.TX: df.TSort <T1, T2, DvText>(icols, ascending); break;

                    default:
                        throw new NotImplementedException($"Sort is not implemented for type '{kind}'.");
                    }
                }
            }
            else
            {
                throw new NotImplementedException($"Sort is not implemented for {icols.Length} columns.");
            }
        }
        static void RecSort(IDataFrameView df, int[] icols, bool ascending)
        {
            var kind = df.Kinds[icols[0]];

            if (icols.Length == 1)
            {
                if (kind.IsVector())
                {
                    switch (kind.ItemType().RawKind())
                    {
                    case DataKind.BL: df.TSort <VBufferEqSort <bool> >(icols, ascending); break;

                    case DataKind.I4: df.TSort <VBufferEqSort <int> >(icols, ascending); break;

                    case DataKind.U4: df.TSort <VBufferEqSort <uint> >(icols, ascending); break;

                    case DataKind.I8: df.TSort <VBufferEqSort <long> >(icols, ascending); break;

                    case DataKind.R4: df.TSort <VBufferEqSort <float> >(icols, ascending); break;

                    case DataKind.R8: df.TSort <VBufferEqSort <double> >(icols, ascending); break;

                    case DataKind.TX: df.TSort <VBufferEqSort <DvText> >(icols, ascending); break;

                    default:
                        throw new NotImplementedException($"Sort is not implemented for type '{kind}'.");
                    }
                }
                else
                {
                    switch (kind.RawKind())
                    {
                    case DataKind.BL: df.TSort <bool>(icols, ascending); break;

                    case DataKind.I4: df.TSort <int>(icols, ascending); break;

                    case DataKind.U4: df.TSort <uint>(icols, ascending); break;

                    case DataKind.I8: df.TSort <long>(icols, ascending); break;

                    case DataKind.R4: df.TSort <float>(icols, ascending); break;

                    case DataKind.R8: df.TSort <double>(icols, ascending); break;

                    case DataKind.TX: df.TSort <DvText>(icols, ascending); break;

                    default:
                        throw new NotImplementedException($"Sort is not implemented for type '{kind}'.");
                    }
                }
            }
            else
            {
                if (kind.IsVector())
                {
                    switch (kind.ItemType().RawKind())
                    {
                    case DataKind.BL: RecSort <VBufferEqSort <bool> >(df, icols, ascending); break;

                    case DataKind.I4: RecSort <VBufferEqSort <int> >(df, icols, ascending); break;

                    case DataKind.U4: RecSort <VBufferEqSort <uint> >(df, icols, ascending); break;

                    case DataKind.I8: RecSort <VBufferEqSort <long> >(df, icols, ascending); break;

                    case DataKind.R4: RecSort <VBufferEqSort <float> >(df, icols, ascending); break;

                    case DataKind.R8: RecSort <VBufferEqSort <double> >(df, icols, ascending); break;

                    case DataKind.TX: RecSort <VBufferEqSort <DvText> >(df, icols, ascending); break;

                    default:
                        throw new NotImplementedException($"Sort is not implemented for type '{kind}'.");
                    }
                }
                else
                {
                    switch (kind.RawKind())
                    {
                    case DataKind.BL: RecSort <bool>(df, icols, ascending); break;

                    case DataKind.I4: RecSort <int>(df, icols, ascending); break;

                    case DataKind.U4: RecSort <uint>(df, icols, ascending); break;

                    case DataKind.I8: RecSort <long>(df, icols, ascending); break;

                    case DataKind.R4: RecSort <float>(df, icols, ascending); break;

                    case DataKind.R8: RecSort <double>(df, icols, ascending); break;

                    case DataKind.TX: RecSort <DvText>(df, icols, ascending); break;

                    default:
                        throw new NotImplementedException($"Sort is not implemented for type '{kind}'.");
                    }
                }
            }
        }
        static void RecSort <T1>(IDataFrameView df, int[] icols, bool ascending)
            where T1 : IEquatable <T1>, IComparable <T1>
        {
            var kind = df.Kinds[icols[1]];

            if (icols.Length == 2)
            {
                if (kind.IsVector())
                {
                    switch (kind.ItemType().RawKind())
                    {
                    case DataKind.Boolean: df.TSort <T1, VBufferEqSort <bool> >(icols, ascending); break;

                    case DataKind.Int32: df.TSort <T1, VBufferEqSort <int> >(icols, ascending); break;

                    case DataKind.UInt32: df.TSort <T1, VBufferEqSort <uint> >(icols, ascending); break;

                    case DataKind.Int64: df.TSort <T1, VBufferEqSort <long> >(icols, ascending); break;

                    case DataKind.Single: df.TSort <T1, VBufferEqSort <float> >(icols, ascending); break;

                    case DataKind.Double: df.TSort <T1, VBufferEqSort <double> >(icols, ascending); break;

                    case DataKind.String: df.TSort <T1, VBufferEqSort <DvText> >(icols, ascending); break;

                    default:
                        throw new NotImplementedException($"Sort is not implemented for type '{kind}'.");
                    }
                }
                else
                {
                    switch (kind.RawKind())
                    {
                    case DataKind.Boolean: df.TSort <T1, bool>(icols, ascending); break;

                    case DataKind.Int32: df.TSort <T1, int>(icols, ascending); break;

                    case DataKind.UInt32: df.TSort <T1, uint>(icols, ascending); break;

                    case DataKind.Int64: df.TSort <T1, long>(icols, ascending); break;

                    case DataKind.Single: df.TSort <T1, float>(icols, ascending); break;

                    case DataKind.Double: df.TSort <T1, double>(icols, ascending); break;

                    case DataKind.String: df.TSort <T1, DvText>(icols, ascending); break;

                    default:
                        throw new NotImplementedException($"Sort is not implemented for type '{kind}'.");
                    }
                }
            }
            else
            {
                if (kind.IsVector())
                {
                    switch (kind.ItemType().RawKind())
                    {
                    case DataKind.Boolean: RecSort <T1, VBufferEqSort <bool> >(df, icols, ascending); break;

                    case DataKind.Int32: RecSort <T1, VBufferEqSort <int> >(df, icols, ascending); break;

                    case DataKind.UInt32: RecSort <T1, VBufferEqSort <uint> >(df, icols, ascending); break;

                    case DataKind.Int64: RecSort <T1, VBufferEqSort <long> >(df, icols, ascending); break;

                    case DataKind.Single: RecSort <T1, VBufferEqSort <float> >(df, icols, ascending); break;

                    case DataKind.Double: RecSort <T1, VBufferEqSort <double> >(df, icols, ascending); break;

                    case DataKind.String: RecSort <T1, VBufferEqSort <DvText> >(df, icols, ascending); break;

                    default:
                        throw new NotImplementedException($"Sort is not implemented for type '{kind}'.");
                    }
                }
                else
                {
                    switch (kind.RawKind())
                    {
                    case DataKind.Boolean: RecSort <T1, bool>(df, icols, ascending); break;

                    case DataKind.Int32: RecSort <T1, int>(df, icols, ascending); break;

                    case DataKind.UInt32: RecSort <T1, uint>(df, icols, ascending); break;

                    case DataKind.Int64: RecSort <T1, long>(df, icols, ascending); break;

                    case DataKind.Single: RecSort <T1, float>(df, icols, ascending); break;

                    case DataKind.Double: RecSort <T1, double>(df, icols, ascending); break;

                    case DataKind.String: RecSort <T1, DvText>(df, icols, ascending); break;

                    default:
                        throw new NotImplementedException($"Sort is not implemented for type '{kind}'.");
                    }
                }
            }
        }