diff --git a/eng/Versions.props b/eng/Versions.props
index bf1e608240..2424bf129c 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -30,7 +30,7 @@
6.0.1
4.7.1
- 2.0.0
+ 11.0.0
3.19.6
2.3.1
3.3.0
diff --git a/src/Microsoft.Data.Analysis/AssemblyAttributes.cs b/src/Microsoft.Data.Analysis/AssemblyAttributes.cs
new file mode 100644
index 0000000000..b9a8a4daa9
--- /dev/null
+++ b/src/Microsoft.Data.Analysis/AssemblyAttributes.cs
@@ -0,0 +1,7 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Runtime.Versioning;
+
+[assembly: RequiresPreviewFeatures]
diff --git a/src/Microsoft.Data.Analysis/BooleanDataFrameColumn.cs b/src/Microsoft.Data.Analysis/BooleanDataFrameColumn.cs
deleted file mode 100644
index cc9d6e5a6e..0000000000
--- a/src/Microsoft.Data.Analysis/BooleanDataFrameColumn.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace Microsoft.Data.Analysis
-{
- public partial class BooleanDataFrameColumn : PrimitiveDataFrameColumn
- {
- public BooleanDataFrameColumn(string name, IEnumerable values) : base(name, values) { }
-
- public BooleanDataFrameColumn(string name, IEnumerable values) : base(name, values) { }
-
- public BooleanDataFrameColumn(string name, long length = 0) : base(name, length) { }
-
- public BooleanDataFrameColumn(string name, ReadOnlyMemory buffer, ReadOnlyMemory nullBitMap, int length = 0, int nullCount = 0) : base(name, buffer, nullBitMap, length, nullCount) { }
-
- internal BooleanDataFrameColumn(string name, PrimitiveColumnContainer values) : base(name, values) { }
-
- protected override PrimitiveDataFrameColumn CreateNewColumn(string name, long length = 0)
- {
- return new BooleanDataFrameColumn(name, length);
- }
-
- internal override PrimitiveDataFrameColumn CreateNewColumn(string name, PrimitiveColumnContainer container)
- {
- return new BooleanDataFrameColumn(name, container);
- }
- }
-}
diff --git a/src/Microsoft.Data.Analysis/ByteDataFrameColumn.cs b/src/Microsoft.Data.Analysis/ByteDataFrameColumn.cs
deleted file mode 100644
index d341e2cd16..0000000000
--- a/src/Microsoft.Data.Analysis/ByteDataFrameColumn.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace Microsoft.Data.Analysis
-{
- public partial class ByteDataFrameColumn : PrimitiveDataFrameColumn
- {
- public ByteDataFrameColumn(string name, IEnumerable values) : base(name, values) { }
-
- public ByteDataFrameColumn(string name, IEnumerable values) : base(name, values) { }
-
- public ByteDataFrameColumn(string name, long length = 0) : base(name, length) { }
-
- public ByteDataFrameColumn(string name, ReadOnlyMemory buffer, ReadOnlyMemory nullBitMap, int length = 0, int nullCount = 0) : base(name, buffer, nullBitMap, length, nullCount) { }
-
- internal ByteDataFrameColumn(string name, PrimitiveColumnContainer values) : base(name, values) { }
-
- protected override PrimitiveDataFrameColumn CreateNewColumn(string name, long length = 0)
- {
- return new ByteDataFrameColumn(name, length);
- }
-
- internal override PrimitiveDataFrameColumn CreateNewColumn(string name, PrimitiveColumnContainer container)
- {
- return new ByteDataFrameColumn(name, container);
- }
- }
-}
diff --git a/src/Microsoft.Data.Analysis/CharDataFrameColumn.cs b/src/Microsoft.Data.Analysis/CharDataFrameColumn.cs
deleted file mode 100644
index 8abbc3f335..0000000000
--- a/src/Microsoft.Data.Analysis/CharDataFrameColumn.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace Microsoft.Data.Analysis
-{
- public partial class CharDataFrameColumn : PrimitiveDataFrameColumn
- {
- public CharDataFrameColumn(string name, IEnumerable values) : base(name, values) { }
-
- public CharDataFrameColumn(string name, IEnumerable values) : base(name, values) { }
-
- public CharDataFrameColumn(string name, long length = 0) : base(name, length) { }
-
- public CharDataFrameColumn(string name, ReadOnlyMemory buffer, ReadOnlyMemory nullBitMap, int length = 0, int nullCount = 0) : base(name, buffer, nullBitMap, length, nullCount) { }
-
- internal CharDataFrameColumn(string name, PrimitiveColumnContainer values) : base(name, values) { }
-
- protected override PrimitiveDataFrameColumn CreateNewColumn(string name, long length = 0)
- {
- return new CharDataFrameColumn(name, length);
- }
-
- internal override PrimitiveDataFrameColumn CreateNewColumn(string name, PrimitiveColumnContainer container)
- {
- return new CharDataFrameColumn(name, container);
- }
- }
-}
diff --git a/src/Microsoft.Data.Analysis/ColumnArithmeticTemplate.ttinclude b/src/Microsoft.Data.Analysis/ColumnArithmeticTemplate.ttinclude
deleted file mode 100644
index bb31da6a94..0000000000
--- a/src/Microsoft.Data.Analysis/ColumnArithmeticTemplate.ttinclude
+++ /dev/null
@@ -1,459 +0,0 @@
-<#@ template debug="false" hostspecific="false" language="C#" #>
-<#@ assembly name="System.Core" #>
-<#@ import namespace="System.Linq" #>
-<#@ import namespace="System.Text" #>
-<#@ import namespace="System.Collections.Generic" #>
-<#+
- public class TypeConfiguration
- {
- public TypeConfiguration(string typeName, string classPrefix = null, string oneLiteral = "1", string zeroLiteral = "0", bool supportsNumeric = true, bool supportsBitwise = true, IEnumerable unsupportedMethods = null)
- {
- TypeName = typeName;
- ClassPrefix = classPrefix ?? char.ToUpper(typeName[0]) + typeName.Substring(1);
- OneLiteral = oneLiteral;
- ZeroLiteral = zeroLiteral;
- SupportsNumeric = supportsNumeric;
- SupportsBitwise = supportsBitwise;
- UnsupportedMethods = new HashSet(unsupportedMethods ?? Enumerable.Empty());
- }
-
- public string TypeName { get; }
- public string ClassPrefix { get; }
- public string OneLiteral { get; }
- public string ZeroLiteral { get; }
-
- public bool SupportsNumeric { get; }
- public bool SupportsBitwise { get; }
- public ISet UnsupportedMethods { get; }
- }
-
- public string GenerateInPlaceStatement(string trueCondition, string falseCondition)
- {
- return $"inPlace ? {trueCondition} : {falseCondition}";
- }
-
- public string GenerateIfStatementHeader(TypeConfiguration type)
- {
- string keyword = (type == typeConfiguration[0]) ? "if" : "else if";
- return $"{keyword} (typeof(T) == typeof({type.TypeName}))";
- }
-
- // A way to discern implicit conversions. For ex: short has primitivitty 2. int has primitivitty 3. primitivitty(short) + primitivitty(int) > 2 * primitivitty(short) implying that a conversion has to take place
- public Dictionary primitiveTypeToPrimitivityLevelMap = new Dictionary {
- {"byte", 1},
- {"sbyte", 1},
- {"short", 2},
- {"ushort", 2},
- {"int", 3},
- {"uint", 3},
- {"long", 4},
- {"ulong", 4},
- {"float", 5},
- {"double", 6},
- {"decimal", 7}
- };
-
- public string GetCapitalizedPrimitiveTypes(string type)
- {
- string typeFirstCharUpper;
- if (type.First() == 'u' || type == "sbyte")
- {
- typeFirstCharUpper = type[0].ToString().ToUpper() + type[1].ToString().ToUpper() + type.Substring(2);
- }
- else
- {
- typeFirstCharUpper = type[0].ToString().ToUpper() + type.Substring(1);
- }
- if (typeFirstCharUpper == "Bool")
- {
- return "Boolean";
- }
- else if (typeFirstCharUpper == "Float")
- {
- return "Single";
- }
- else if (typeFirstCharUpper == "Int")
- {
- return "Int32";
- }
- else if (typeFirstCharUpper == "Short")
- {
- return "Int16";
- }
- else if (typeFirstCharUpper == "Long")
- {
- return "Int64";
- }
- else if (typeFirstCharUpper == "UInt")
- {
- return "UInt32";
- }
- else if (typeFirstCharUpper == "UShort")
- {
- return "UInt16";
- }
- else if (typeFirstCharUpper == "ULong")
- {
- return "UInt64";
- }
- return typeFirstCharUpper;
- }
-
- public bool IsMixedSignedAndUnsignedTypePair(string t1, string t2)
- {
- if (t1 == "byte" && t2 == "sbyte")
- {
- return true;
- }
- if (t2 == "byte" && t1 == "sbyte")
- {
- return true;
- }
- if (("u" + t1) == t2)
- {
- return true;
- }
- if (("u" + t2) == t1)
- {
- return true;
- }
- return false;
- }
-
- // These are a subset of the implicit conversions allowed in C#. They are used to generate the return type for binary ops
- // https://github.com/dotnet/csharplang/blob/master/spec/conversions.md#implicit-numeric-conversions
- public Dictionary> primitiveTypeToImplicitConversions = new Dictionary> {
- {"sbyte", new List {"int", "long", "float", "double", "decimal"}},
- {"byte", new List {"int", "uint", "long", "ulong", "float", "double", "decimal"}},
- {"short", new List {"int", "long", "float", "double", "decimal"}},
- {"ushort", new List {"int", "uint", "long", "ulong", "float", "double", "decimal"}},
- {"int", new List {"int", "long", "float", "double", "decimal"}},
- {"uint", new List {"uint", "long", "ulong", "float", "double", "decimal"}},
- {"long", new List {"long", "float", "double", "decimal"}},
- {"ulong", new List {"ulong", "float", "double", "decimal"}},
- {"float", new List {"float", "double"}},
- {"double", new List {"double"}},
- {"decimal", new List {"decimal"}},
- };
-
- public TypeConfiguration[] typeConfiguration = new []
- {
- new TypeConfiguration("bool", oneLiteral:"true", zeroLiteral:"false", supportsNumeric: false, unsupportedMethods: new[] {"LeftShift", "RightShift"}),
- new TypeConfiguration("byte", unsupportedMethods: new[] {"All", "Any"}),
- new TypeConfiguration("char", oneLiteral:"(char)1", zeroLiteral:"(char)0", unsupportedMethods: new[] {"All", "Any"}),
- new TypeConfiguration("decimal", supportsBitwise: false, unsupportedMethods: new[] {"All", "Any"}),
- new TypeConfiguration("double", oneLiteral:"1.0", supportsBitwise: false, unsupportedMethods: new[] {"All", "Any"}),
- new TypeConfiguration("float", oneLiteral:"1.0f", supportsBitwise: false, unsupportedMethods: new[] {"All", "Any"}),
- new TypeConfiguration("int", unsupportedMethods: new[] {"All", "Any"}),
- new TypeConfiguration("long", unsupportedMethods: new[] {"All", "Any"}),
- new TypeConfiguration("sbyte", classPrefix:"SByte", unsupportedMethods: new[] {"All", "Any"}),
- new TypeConfiguration("short", unsupportedMethods: new[] {"All", "Any"}),
- new TypeConfiguration("uint", classPrefix:"UInt", unsupportedMethods: new[] {"UnaryMinus", "All", "Any"}),
- new TypeConfiguration("ulong", classPrefix:"ULong", unsupportedMethods: new[] {"UnaryMinus", "All", "Any"}),
- new TypeConfiguration("ushort", classPrefix:"UShort", unsupportedMethods: new[] {"UnaryMinus", "All", "Any"}),
- new TypeConfiguration("DateTime", supportsBitwise: false, supportsNumeric: false, unsupportedMethods: new[] {"And", "Or", "Xor"})
- };
-
- public string GetBinaryShiftOperationReturnType(TypeConfiguration t1)
- {
- primitiveTypeToImplicitConversions.TryGetValue(t1.TypeName, out IReadOnlyList t1ImplicitConversions);
- return t1ImplicitConversions.First() ?? string.Empty;
- }
-
- public string GetBinaryOperationReturnType(string t1, string t2)
- {
- if (t1 == "long" && t2 == "ulong" || t1 == "ulong" && t2 == "long")
- {
- return string.Empty;
- }
- primitiveTypeToImplicitConversions.TryGetValue(t1, out IReadOnlyList t1ImplicitConversions);
- primitiveTypeToImplicitConversions.TryGetValue(t2, out IReadOnlyList t2ImplicitConversions);
- var intersection = t1ImplicitConversions.Intersect(t2ImplicitConversions);
- string ret;
- if (intersection.Count() == 0)
- {
- ret = string.Empty;
- }
- else
- {
- ret = intersection.First();
- }
- return ret;
- }
-
- // Returns an empty string for binary ops that are not valid: For ex: float + decimal is NOT allowed.
- // Special case: long + ulong is NOT allowed. The other mixed signed and unsigned are valid
- public string GetBinaryOperationReturnType(TypeConfiguration t1, TypeConfiguration t2)
- {
- string t1Type = t1.TypeName;
- string t2Type = t2.TypeName;
- return GetBinaryOperationReturnType(t1Type, t2Type);
- }
-
- public enum MethodType
- {
- Unary,
- UnaryInPlace,
- BinaryScalar,
- BinaryInt,
- Binary,
- Comparison,
- ComparisonScalar,
- Contraction,
- ElementwiseComputation,
- Reduction
- }
-
- public MethodConfiguration[] computationMethodConfiguration = new []
- {
- new MethodConfiguration("Abs", MethodType.ElementwiseComputation, "Math.Abs", isNumeric: true, methodComments: "Updates each numeric element with its absolute numeric value"),
- new MethodConfiguration("All", MethodType.Reduction, "", isBitwise: true, methodComments: "Returns whether all the elements are True"),
- new MethodConfiguration("Any", MethodType.Reduction, "", isBitwise: true, methodComments: "Returns whether any element is True"),
- new MethodConfiguration("CumulativeMax", MethodType.ElementwiseComputation, "", isNumeric:true, methodComments: "Updates each element with its cumulative maximum"),
- new MethodConfiguration("CumulativeMax", MethodType.ElementwiseComputation, "", isNumeric:true, supportsRowSubsets: true, methodComments: "Updates column values at rowIndices with its cumulative rowIndices maximum"),
- new MethodConfiguration("CumulativeMin", MethodType.ElementwiseComputation, "", isNumeric:true, methodComments: "Updates each element with its cumulative minimum"),
- new MethodConfiguration("CumulativeMin", MethodType.ElementwiseComputation, "", isNumeric:true, supportsRowSubsets: true, methodComments: "Updates column values at rowIndices with its cumulative rowIndices minimum"),
- new MethodConfiguration("CumulativeProduct", MethodType.ElementwiseComputation, "", isNumeric:true, methodComments: "Updates each element with its cumulative product"),
- new MethodConfiguration("CumulativeProduct", MethodType.ElementwiseComputation, "", isNumeric:true, supportsRowSubsets: true, methodComments: "Updates column values at rowIndices with its cumulative rowIndices product"),
- new MethodConfiguration("CumulativeSum", MethodType.ElementwiseComputation, "", isNumeric:true, methodComments: "Updates each element with its cumulative sum"),
- new MethodConfiguration("CumulativeSum", MethodType.ElementwiseComputation, "", isNumeric:true, supportsRowSubsets: true, methodComments: "Updates column values at rowIndices with its cumulative rowIndices sum"),
- new MethodConfiguration("Max", MethodType.Reduction, "", isNumeric:true, hasReturnValue:true, methodComments: "Returns the maximum of the values in the column"),
- new MethodConfiguration("Max", MethodType.Reduction, "", isNumeric:true, hasReturnValue:true, supportsRowSubsets: true, methodComments: "Returns the maximum of the values at rowIndices"),
- new MethodConfiguration("Min", MethodType.Reduction, "", isNumeric:true, hasReturnValue:true, methodComments: "Returns the minimum of the values in the column"),
- new MethodConfiguration("Min", MethodType.Reduction, "", isNumeric:true, hasReturnValue:true, supportsRowSubsets: true, methodComments: "Returns the minimum of the values at the rowIndices"),
- new MethodConfiguration("Product", MethodType.Reduction, "*", isNumeric:true, hasReturnValue:true, methodComments: "Returns the product of the values in the column"),
- new MethodConfiguration("Product", MethodType.Reduction, "*", isNumeric:true, hasReturnValue:true, supportsRowSubsets: true, methodComments: "Returns the product of the values at the rowIndices"),
- new MethodConfiguration("Sum", MethodType.Reduction, "+", isNumeric:true, hasReturnValue:true, methodComments: "Returns the sum of the values in the column"),
- new MethodConfiguration("Sum", MethodType.Reduction, "+", isNumeric:true, hasReturnValue:true, supportsRowSubsets: true, methodComments: "Returns the sum of the values at the rowIndices"),
- new MethodConfiguration("Round", MethodType.ElementwiseComputation, "Math.Round", isNumeric:true, methodComments: "Calls Math.Round on each value in a column"),
- };
-
- public MethodConfiguration[] methodConfiguration = new []
- {
- new MethodConfiguration("Add", MethodType.Binary, "+", isNumeric:true, methodComments: "Performs element-wise addition"),
- new MethodConfiguration("Add", MethodType.BinaryScalar, "+", isNumeric:true, methodComments: "Performs an element-wise addition on each column"),
- new MethodConfiguration("Subtract", MethodType.Binary, "-", isNumeric:true, methodComments: "Performs element-wise subtraction"),
- new MethodConfiguration("Subtract", MethodType.BinaryScalar, "-", isNumeric:true, methodComments: "Performs an element-wise subtraction on each column"),
- new MethodConfiguration("Multiply", MethodType.Binary, "*", isNumeric:true, methodComments: "Performs element-wise multiplication"), // element-wise product, not matrix product
- new MethodConfiguration("Multiply", MethodType.BinaryScalar, "*", isNumeric:true, methodComments: "Performs an element-wise multiplication on each column"),
- new MethodConfiguration("Divide", MethodType.Binary, "/", isNumeric:true, methodComments: "Performs element-wise division"),
- new MethodConfiguration("Divide", MethodType.BinaryScalar, "/", isNumeric:true, methodComments: "Performs an element-wise division on each column"),
- new MethodConfiguration("Modulo", MethodType.Binary, "%", isNumeric:true, methodComments: "Performs element-wise modulus"),
- new MethodConfiguration("Modulo", MethodType.BinaryScalar, "%", isNumeric:true, methodComments: "Performs an element-wise modulus operation on each column"),
- new MethodConfiguration("And", MethodType.Binary, "&", isBitwise: true, methodComments: "Performs element-wise boolean And"),
- new MethodConfiguration("And", MethodType.BinaryScalar, "&", isBitwise: true, methodComments: "Performs an element-wise boolean And on each column"),
- new MethodConfiguration("Or", MethodType.Binary, "|", isBitwise: true, methodComments: "Performs element-wise boolean Or"),
- new MethodConfiguration("Or", MethodType.BinaryScalar, "|", isBitwise: true, methodComments: "Performs an element-wise boolean Or on each column"),
- new MethodConfiguration("Xor", MethodType.Binary, "^", isBitwise: true, methodComments: "Performs element-wise boolean Xor"),
- new MethodConfiguration("Xor", MethodType.BinaryScalar, "^", isBitwise: true, methodComments: "Performs an element-wise boolean Xor on each column"),
- new MethodConfiguration("LeftShift", MethodType.BinaryInt, "<<", isBitwise: true, methodComments: "Performs an element-wise left shift on each column"),
- new MethodConfiguration("RightShift", MethodType.BinaryInt, ">>", isBitwise: true, methodComments: "Performs an element-wise right shift on each column"),
-
- new MethodConfiguration("ElementwiseEquals", MethodType.Comparison, "==", methodComments: "Performs element-wise equals"),
- new MethodConfiguration("ElementwiseEquals", MethodType.ComparisonScalar, "==", methodComments: "Performs an element-wise equals on each column"),
- new MethodConfiguration("ElementwiseNotEquals", MethodType.Comparison, "!=", methodComments: "Performs element-wise not-equals"),
- new MethodConfiguration("ElementwiseNotEquals", MethodType.ComparisonScalar, "!=", methodComments: "Performs an element-wise not-equals on each column"),
- new MethodConfiguration("ElementwiseGreaterThanOrEqual", MethodType.Comparison, ">=", isNumeric:true, methodComments: "Performs element-wise greater than or equal"),
- new MethodConfiguration("ElementwiseGreaterThanOrEqual", MethodType.ComparisonScalar, ">=", isNumeric:true, methodComments: "Performs an element-wise greater than or equal on each column"),
- new MethodConfiguration("ElementwiseLessThanOrEqual", MethodType.Comparison, "<=", isNumeric:true, methodComments: "Performs element-wise less than or equal"),
- new MethodConfiguration("ElementwiseLessThanOrEqual", MethodType.ComparisonScalar, "<=", isNumeric:true, methodComments: "Performs an element-wise less than or equal on each column"),
- new MethodConfiguration("ElementwiseGreaterThan", MethodType.Comparison, ">", isNumeric:true, methodComments: "Performs element-wise greater than"),
- new MethodConfiguration("ElementwiseGreaterThan", MethodType.ComparisonScalar, ">", isNumeric:true, methodComments: "Performs an element-wise greater than on each column"),
- new MethodConfiguration("ElementwiseLessThan", MethodType.Comparison, "<", isNumeric:true, methodComments: "Performs element-wise less than"),
- new MethodConfiguration("ElementwiseLessThan", MethodType.ComparisonScalar, "<", isNumeric:true, methodComments: "Performs an element-wise less than on each column"),
- };
-
- public class MethodConfiguration
- {
- public MethodConfiguration(string methodName, MethodType methodType, string op = null, bool isNumeric = false, bool isBitwise = false, bool hasReturnValue = false, bool supportsRowSubsets = false, string methodComments = null)
- {
- MethodName = methodName;
- MethodType = methodType;
- Operator = op;
- IsNumeric = isNumeric;
- IsBitwise = isBitwise;
- HasReturnValue = hasReturnValue;
- SupportsRowSubsets = supportsRowSubsets;
- MethodComments = methodComments;
- }
-
- public string ResultName => "result";
-
- public string Op1Name
- {
- get
- {
- switch (MethodType)
- {
- case MethodType.Unary:
- case MethodType.UnaryInPlace:
- case MethodType.BinaryScalar:
- case MethodType.BinaryInt:
- case MethodType.ComparisonScalar:
- case MethodType.ElementwiseComputation:
- case MethodType.Reduction:
- return "column";
- case MethodType.Binary:
- case MethodType.Comparison:
- case MethodType.Contraction:
- return "left";
- default:
- throw new ArgumentException();
- };
- }
- }
-
- public string Op2Name
- {
- get
- {
- switch (MethodType)
- {
- case MethodType.BinaryScalar:
- case MethodType.ComparisonScalar:
- return "scalar";
- case MethodType.BinaryInt:
- return "value";
- case MethodType.Binary:
- case MethodType.Comparison:
- case MethodType.Contraction:
- return "right";
- case MethodType.Unary:
- case MethodType.UnaryInPlace:
- default:
- throw new ArgumentException();
- };
- }
- }
-
- public string MethodName { get; }
- public MethodType MethodType { get; }
- public string Operator { get; }
- public string MethodComments { get; }
-
- public string GetColumnSpecificMethodComments()
- {
- var str = MethodComments;
- return str.Replace("column", "value in the column");
- }
-
- public string GetReverseMethodComments()
- {
- var str = MethodComments;
- return str.Replace(" an", " a reversed");
- }
-
- public string GetColumnSpecificBinaryMethodComments()
- {
- var str = MethodComments;
- str = str.Replace("column", "");
- return str.Replace(" an", " ");
- }
-
- public string GetColumnSpecificReverseMethodComments()
- {
- return GetColumnSpecificMethodComments().Replace(" an", " a reversed");
- }
-
- public string GetMethodSignature(string columnType, string genericType)
- {
- var arguments = GetMethodArguments(columnType, genericType);
- return $"void {MethodName}({arguments})";
- }
-
- public string GetInvertedMethodSignatureForBinaryScalarsOps(string columnType, string genericType)
- {
- var arguments = GetInvertedMethodArguments(columnType, genericType);
- return $"void {MethodName}({arguments})";
- }
-
- public string GetSingleArgumentMethodSignature(string columnType, string genericType)
- {
- var arguments = GetSingleParameterMethodArguments(columnType, genericType);
- return $"PrimitiveColumnContainer {MethodName}({arguments})";
- }
-
- public string GetComputationOrReductionMethodSignature(string columnType, string genericType)
- {
- var arguments = GetMethodArguments(columnType, genericType);
- switch (MethodType)
- {
- case MethodType.ElementwiseComputation:
- return $"{columnType}<{genericType}> {MethodName}({arguments})";
- case MethodType.Reduction:
- return $"{genericType} {MethodName}({arguments})";
- default:
- throw new ArgumentException();
- }
- }
-
- public string GetInvertedMethodArguments(string dataFrameType, string genericType)
- {
- switch (MethodType)
- {
- case MethodType.BinaryScalar:
- return $"{genericType} {Op2Name}, {dataFrameType}<{genericType}> {Op1Name}";
- default:
- throw new ArgumentException();
- }
- }
-
- public string GetMethodArguments(string dataFrameType, string genericType)
- {
- switch (MethodType)
- {
- case MethodType.Unary:
- case MethodType.UnaryInPlace:
- return $"{dataFrameType}<{genericType}> {Op1Name}";
- case MethodType.BinaryScalar:
- return $"{dataFrameType}<{genericType}> {Op1Name}, {genericType} {Op2Name}";
- case MethodType.ComparisonScalar:
- return $"{dataFrameType}<{genericType}> {Op1Name}, {genericType} {Op2Name}, {dataFrameType} ret";
- case MethodType.BinaryInt:
- return $"{dataFrameType}<{genericType}> {Op1Name}, int {Op2Name}";
- case MethodType.Binary:
- return $"{dataFrameType}<{genericType}> {Op1Name}, {dataFrameType}<{genericType}> {Op2Name}";
- case MethodType.Comparison:
- return $"{dataFrameType}<{genericType}> {Op1Name}, {dataFrameType}<{genericType}> {Op2Name}, {dataFrameType} ret";
- case MethodType.Contraction:
- return $"{dataFrameType}<{genericType}> {Op1Name}, {dataFrameType}<{genericType}> {Op2Name}, int[] leftAxes, int[] rightAxes";
- case MethodType.ElementwiseComputation:
- case MethodType.Reduction:
- return $"";
- default:
- throw new ArgumentException();
- }
- }
-
- public string GetSingleParameterMethodArguments(string dataFrameType, string genericType)
- {
- switch (MethodType)
- {
- case MethodType.Unary:
- case MethodType.UnaryInPlace:
- throw new ArgumentException();
- return $"{dataFrameType}<{genericType}> {Op1Name}";
- case MethodType.BinaryScalar:
- return $"{genericType} {Op2Name}";
- case MethodType.ComparisonScalar:
- return $"{genericType} {Op2Name}, {dataFrameType} ret";
- case MethodType.BinaryInt:
- return $"int {Op2Name}";
- case MethodType.Binary:
- return $"{dataFrameType}<{genericType}> {Op2Name}";
- case MethodType.Comparison:
- return $"{dataFrameType}<{genericType}> {Op2Name}, {dataFrameType} ret";
- case MethodType.Contraction:
- throw new ArgumentException();
- return $"{dataFrameType}<{genericType}> {Op1Name}, {dataFrameType}<{genericType}> {Op2Name}, int[] leftAxes, int[] rightAxes";
- default:
- throw new ArgumentException();
- }
- }
-
- public bool IsNumeric { get; }
- public bool IsBitwise { get; }
- public bool HasReturnValue { get; }
- public bool SupportsRowSubsets { get; }
- }
-#>
diff --git a/src/Microsoft.Data.Analysis/Converters.cs b/src/Microsoft.Data.Analysis/Converters.cs
deleted file mode 100644
index a6900ea3f4..0000000000
--- a/src/Microsoft.Data.Analysis/Converters.cs
+++ /dev/null
@@ -1,948 +0,0 @@
-
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-// Generated from Converters.tt. Do not modify directly
-
-using System;
-using System.Collections.Generic;
-
-namespace Microsoft.Data.Analysis
-{
- internal interface IByteConverter
- {
- byte GetByte(T value);
- }
- internal static class ByteConverter
- {
- public static IByteConverter Instance { get; } = ByteConverter.GetByteConverter();
- }
- internal static class ByteConverter
- {
- public static IByteConverter GetByteConverter()
- {
- if (typeof(T) == typeof(byte))
- {
- return (IByteConverter)new ByteByteConverter();
- }
- if (typeof(T) == typeof(sbyte))
- {
- return (IByteConverter)new SByteByteConverter();
- }
- throw new NotSupportedException();
- }
- }
- internal class ByteByteConverter : IByteConverter
- {
- public byte GetByte(byte value)
- {
- return (byte)value;
- }
- }
- internal class SByteByteConverter : IByteConverter
- {
- public byte GetByte(sbyte value)
- {
- return (byte)value;
- }
- }
- internal interface ISByteConverter
- {
- sbyte GetSByte(T value);
- }
- internal static class SByteConverter
- {
- public static ISByteConverter Instance { get; } = SByteConverter.GetSByteConverter();
- }
- internal static class SByteConverter
- {
- public static ISByteConverter GetSByteConverter()
- {
- if (typeof(T) == typeof(byte))
- {
- return (ISByteConverter)new ByteSByteConverter();
- }
- if (typeof(T) == typeof(sbyte))
- {
- return (ISByteConverter)new SByteSByteConverter();
- }
- throw new NotSupportedException();
- }
- }
- internal class ByteSByteConverter : ISByteConverter
- {
- public sbyte GetSByte(byte value)
- {
- return (sbyte)value;
- }
- }
- internal class SByteSByteConverter : ISByteConverter
- {
- public sbyte GetSByte(sbyte value)
- {
- return (sbyte)value;
- }
- }
- internal interface IInt16Converter
- {
- short GetInt16(T value);
- }
- internal static class Int16Converter
- {
- public static IInt16Converter Instance { get; } = Int16Converter.GetInt16Converter();
- }
- internal static class Int16Converter
- {
- public static IInt16Converter GetInt16Converter()
- {
- if (typeof(T) == typeof(byte))
- {
- return (IInt16Converter)new ByteInt16Converter();
- }
- if (typeof(T) == typeof(sbyte))
- {
- return (IInt16Converter)new SByteInt16Converter();
- }
- if (typeof(T) == typeof(short))
- {
- return (IInt16Converter)new Int16Int16Converter();
- }
- if (typeof(T) == typeof(ushort))
- {
- return (IInt16Converter)new UInt16Int16Converter();
- }
- throw new NotSupportedException();
- }
- }
- internal class ByteInt16Converter : IInt16Converter
- {
- public short GetInt16(byte value)
- {
- return (short)value;
- }
- }
- internal class SByteInt16Converter : IInt16Converter
- {
- public short GetInt16(sbyte value)
- {
- return (short)value;
- }
- }
- internal class Int16Int16Converter : IInt16Converter
- {
- public short GetInt16(short value)
- {
- return (short)value;
- }
- }
- internal class UInt16Int16Converter : IInt16Converter
- {
- public short GetInt16(ushort value)
- {
- return (short)value;
- }
- }
- internal interface IUInt16Converter
- {
- ushort GetUInt16(T value);
- }
- internal static class UInt16Converter
- {
- public static IUInt16Converter Instance { get; } = UInt16Converter.GetUInt16Converter();
- }
- internal static class UInt16Converter
- {
- public static IUInt16Converter GetUInt16Converter()
- {
- if (typeof(T) == typeof(byte))
- {
- return (IUInt16Converter)new ByteUInt16Converter();
- }
- if (typeof(T) == typeof(sbyte))
- {
- return (IUInt16Converter)new SByteUInt16Converter();
- }
- if (typeof(T) == typeof(short))
- {
- return (IUInt16Converter)new Int16UInt16Converter();
- }
- if (typeof(T) == typeof(ushort))
- {
- return (IUInt16Converter)new UInt16UInt16Converter();
- }
- throw new NotSupportedException();
- }
- }
- internal class ByteUInt16Converter : IUInt16Converter
- {
- public ushort GetUInt16(byte value)
- {
- return (ushort)value;
- }
- }
- internal class SByteUInt16Converter : IUInt16Converter
- {
- public ushort GetUInt16(sbyte value)
- {
- return (ushort)value;
- }
- }
- internal class Int16UInt16Converter : IUInt16Converter
- {
- public ushort GetUInt16(short value)
- {
- return (ushort)value;
- }
- }
- internal class UInt16UInt16Converter : IUInt16Converter
- {
- public ushort GetUInt16(ushort value)
- {
- return (ushort)value;
- }
- }
- internal interface IInt32Converter
- {
- int GetInt32(T value);
- }
- internal static class Int32Converter
- {
- public static IInt32Converter Instance { get; } = Int32Converter.GetInt32Converter();
- }
- internal static class Int32Converter
- {
- public static IInt32Converter GetInt32Converter()
- {
- if (typeof(T) == typeof(byte))
- {
- return (IInt32Converter)new ByteInt32Converter();
- }
- if (typeof(T) == typeof(sbyte))
- {
- return (IInt32Converter)new SByteInt32Converter();
- }
- if (typeof(T) == typeof(short))
- {
- return (IInt32Converter)new Int16Int32Converter();
- }
- if (typeof(T) == typeof(ushort))
- {
- return (IInt32Converter)new UInt16Int32Converter();
- }
- if (typeof(T) == typeof(int))
- {
- return (IInt32Converter)new Int32Int32Converter();
- }
- if (typeof(T) == typeof(uint))
- {
- return (IInt32Converter)new UInt32Int32Converter();
- }
- throw new NotSupportedException();
- }
- }
- internal class ByteInt32Converter : IInt32Converter
- {
- public int GetInt32(byte value)
- {
- return (int)value;
- }
- }
- internal class SByteInt32Converter : IInt32Converter
- {
- public int GetInt32(sbyte value)
- {
- return (int)value;
- }
- }
- internal class Int16Int32Converter : IInt32Converter
- {
- public int GetInt32(short value)
- {
- return (int)value;
- }
- }
- internal class UInt16Int32Converter : IInt32Converter
- {
- public int GetInt32(ushort value)
- {
- return (int)value;
- }
- }
- internal class Int32Int32Converter : IInt32Converter
- {
- public int GetInt32(int value)
- {
- return (int)value;
- }
- }
- internal class UInt32Int32Converter : IInt32Converter
- {
- public int GetInt32(uint value)
- {
- return (int)value;
- }
- }
- internal interface IUInt32Converter
- {
- uint GetUInt32(T value);
- }
- internal static class UInt32Converter
- {
- public static IUInt32Converter Instance { get; } = UInt32Converter.GetUInt32Converter();
- }
- internal static class UInt32Converter
- {
- public static IUInt32Converter GetUInt32Converter()
- {
- if (typeof(T) == typeof(byte))
- {
- return (IUInt32Converter)new ByteUInt32Converter();
- }
- if (typeof(T) == typeof(sbyte))
- {
- return (IUInt32Converter)new SByteUInt32Converter();
- }
- if (typeof(T) == typeof(short))
- {
- return (IUInt32Converter)new Int16UInt32Converter();
- }
- if (typeof(T) == typeof(ushort))
- {
- return (IUInt32Converter)new UInt16UInt32Converter();
- }
- if (typeof(T) == typeof(int))
- {
- return (IUInt32Converter)new Int32UInt32Converter();
- }
- if (typeof(T) == typeof(uint))
- {
- return (IUInt32Converter)new UInt32UInt32Converter();
- }
- throw new NotSupportedException();
- }
- }
- internal class ByteUInt32Converter : IUInt32Converter
- {
- public uint GetUInt32(byte value)
- {
- return (uint)value;
- }
- }
- internal class SByteUInt32Converter : IUInt32Converter
- {
- public uint GetUInt32(sbyte value)
- {
- return (uint)value;
- }
- }
- internal class Int16UInt32Converter : IUInt32Converter
- {
- public uint GetUInt32(short value)
- {
- return (uint)value;
- }
- }
- internal class UInt16UInt32Converter : IUInt32Converter
- {
- public uint GetUInt32(ushort value)
- {
- return (uint)value;
- }
- }
- internal class Int32UInt32Converter : IUInt32Converter
- {
- public uint GetUInt32(int value)
- {
- return (uint)value;
- }
- }
- internal class UInt32UInt32Converter : IUInt32Converter
- {
- public uint GetUInt32(uint value)
- {
- return (uint)value;
- }
- }
- internal interface IInt64Converter
- {
- long GetInt64(T value);
- }
- internal static class Int64Converter
- {
- public static IInt64Converter Instance { get; } = Int64Converter.GetInt64Converter();
- }
- internal static class Int64Converter
- {
- public static IInt64Converter GetInt64Converter()
- {
- if (typeof(T) == typeof(byte))
- {
- return (IInt64Converter)new ByteInt64Converter();
- }
- if (typeof(T) == typeof(sbyte))
- {
- return (IInt64Converter)new SByteInt64Converter();
- }
- if (typeof(T) == typeof(short))
- {
- return (IInt64Converter)new Int16Int64Converter();
- }
- if (typeof(T) == typeof(ushort))
- {
- return (IInt64Converter)new UInt16Int64Converter();
- }
- if (typeof(T) == typeof(int))
- {
- return (IInt64Converter)new Int32Int64Converter();
- }
- if (typeof(T) == typeof(uint))
- {
- return (IInt64Converter)new UInt32Int64Converter();
- }
- if (typeof(T) == typeof(long))
- {
- return (IInt64Converter)new Int64Int64Converter();
- }
- if (typeof(T) == typeof(ulong))
- {
- return (IInt64Converter)new UInt64Int64Converter();
- }
- throw new NotSupportedException();
- }
- }
- internal class ByteInt64Converter : IInt64Converter
- {
- public long GetInt64(byte value)
- {
- return (long)value;
- }
- }
- internal class SByteInt64Converter : IInt64Converter
- {
- public long GetInt64(sbyte value)
- {
- return (long)value;
- }
- }
- internal class Int16Int64Converter : IInt64Converter
- {
- public long GetInt64(short value)
- {
- return (long)value;
- }
- }
- internal class UInt16Int64Converter : IInt64Converter
- {
- public long GetInt64(ushort value)
- {
- return (long)value;
- }
- }
- internal class Int32Int64Converter : IInt64Converter
- {
- public long GetInt64(int value)
- {
- return (long)value;
- }
- }
- internal class UInt32Int64Converter : IInt64Converter
- {
- public long GetInt64(uint value)
- {
- return (long)value;
- }
- }
- internal class Int64Int64Converter : IInt64Converter
- {
- public long GetInt64(long value)
- {
- return (long)value;
- }
- }
- internal class UInt64Int64Converter : IInt64Converter
- {
- public long GetInt64(ulong value)
- {
- return (long)value;
- }
- }
- internal interface IUInt64Converter
- {
- ulong GetUInt64(T value);
- }
- internal static class UInt64Converter
- {
- public static IUInt64Converter Instance { get; } = UInt64Converter.GetUInt64Converter();
- }
- internal static class UInt64Converter
- {
- public static IUInt64Converter GetUInt64Converter()
- {
- if (typeof(T) == typeof(byte))
- {
- return (IUInt64Converter)new ByteUInt64Converter();
- }
- if (typeof(T) == typeof(sbyte))
- {
- return (IUInt64Converter)new SByteUInt64Converter();
- }
- if (typeof(T) == typeof(short))
- {
- return (IUInt64Converter)new Int16UInt64Converter();
- }
- if (typeof(T) == typeof(ushort))
- {
- return (IUInt64Converter)new UInt16UInt64Converter();
- }
- if (typeof(T) == typeof(int))
- {
- return (IUInt64Converter)new Int32UInt64Converter();
- }
- if (typeof(T) == typeof(uint))
- {
- return (IUInt64Converter)new UInt32UInt64Converter();
- }
- if (typeof(T) == typeof(long))
- {
- return (IUInt64Converter)new Int64UInt64Converter();
- }
- if (typeof(T) == typeof(ulong))
- {
- return (IUInt64Converter)new UInt64UInt64Converter();
- }
- throw new NotSupportedException();
- }
- }
- internal class ByteUInt64Converter : IUInt64Converter
- {
- public ulong GetUInt64(byte value)
- {
- return (ulong)value;
- }
- }
- internal class SByteUInt64Converter : IUInt64Converter
- {
- public ulong GetUInt64(sbyte value)
- {
- return (ulong)value;
- }
- }
- internal class Int16UInt64Converter : IUInt64Converter
- {
- public ulong GetUInt64(short value)
- {
- return (ulong)value;
- }
- }
- internal class UInt16UInt64Converter : IUInt64Converter
- {
- public ulong GetUInt64(ushort value)
- {
- return (ulong)value;
- }
- }
- internal class Int32UInt64Converter : IUInt64Converter
- {
- public ulong GetUInt64(int value)
- {
- return (ulong)value;
- }
- }
- internal class UInt32UInt64Converter : IUInt64Converter
- {
- public ulong GetUInt64(uint value)
- {
- return (ulong)value;
- }
- }
- internal class Int64UInt64Converter : IUInt64Converter
- {
- public ulong GetUInt64(long value)
- {
- return (ulong)value;
- }
- }
- internal class UInt64UInt64Converter : IUInt64Converter
- {
- public ulong GetUInt64(ulong value)
- {
- return (ulong)value;
- }
- }
- internal interface ISingleConverter
- {
- float GetSingle(T value);
- }
- internal static class SingleConverter
- {
- public static ISingleConverter Instance { get; } = SingleConverter.GetSingleConverter();
- }
- internal static class SingleConverter
- {
- public static ISingleConverter GetSingleConverter()
- {
- if (typeof(T) == typeof(byte))
- {
- return (ISingleConverter)new ByteSingleConverter();
- }
- if (typeof(T) == typeof(sbyte))
- {
- return (ISingleConverter)new SByteSingleConverter();
- }
- if (typeof(T) == typeof(short))
- {
- return (ISingleConverter)new Int16SingleConverter();
- }
- if (typeof(T) == typeof(ushort))
- {
- return (ISingleConverter)new UInt16SingleConverter();
- }
- if (typeof(T) == typeof(int))
- {
- return (ISingleConverter)new Int32SingleConverter();
- }
- if (typeof(T) == typeof(uint))
- {
- return (ISingleConverter)new UInt32SingleConverter();
- }
- if (typeof(T) == typeof(long))
- {
- return (ISingleConverter)new Int64SingleConverter();
- }
- if (typeof(T) == typeof(ulong))
- {
- return (ISingleConverter)new UInt64SingleConverter();
- }
- if (typeof(T) == typeof(float))
- {
- return (ISingleConverter)new SingleSingleConverter();
- }
- throw new NotSupportedException();
- }
- }
- internal class ByteSingleConverter : ISingleConverter
- {
- public float GetSingle(byte value)
- {
- return (float)value;
- }
- }
- internal class SByteSingleConverter : ISingleConverter
- {
- public float GetSingle(sbyte value)
- {
- return (float)value;
- }
- }
- internal class Int16SingleConverter : ISingleConverter
- {
- public float GetSingle(short value)
- {
- return (float)value;
- }
- }
- internal class UInt16SingleConverter : ISingleConverter
- {
- public float GetSingle(ushort value)
- {
- return (float)value;
- }
- }
- internal class Int32SingleConverter : ISingleConverter
- {
- public float GetSingle(int value)
- {
- return (float)value;
- }
- }
- internal class UInt32SingleConverter : ISingleConverter
- {
- public float GetSingle(uint value)
- {
- return (float)value;
- }
- }
- internal class Int64SingleConverter : ISingleConverter
- {
- public float GetSingle(long value)
- {
- return (float)value;
- }
- }
- internal class UInt64SingleConverter : ISingleConverter
- {
- public float GetSingle(ulong value)
- {
- return (float)value;
- }
- }
- internal class SingleSingleConverter : ISingleConverter
- {
- public float GetSingle(float value)
- {
- return (float)value;
- }
- }
- internal interface IDoubleConverter
- {
- double GetDouble(T value);
- }
- internal static class DoubleConverter
- {
- public static IDoubleConverter Instance { get; } = DoubleConverter.GetDoubleConverter();
- }
- internal static class DoubleConverter
- {
- public static IDoubleConverter GetDoubleConverter()
- {
- if (typeof(T) == typeof(byte))
- {
- return (IDoubleConverter)new ByteDoubleConverter();
- }
- if (typeof(T) == typeof(sbyte))
- {
- return (IDoubleConverter)new SByteDoubleConverter();
- }
- if (typeof(T) == typeof(short))
- {
- return (IDoubleConverter)new Int16DoubleConverter();
- }
- if (typeof(T) == typeof(ushort))
- {
- return (IDoubleConverter)new UInt16DoubleConverter();
- }
- if (typeof(T) == typeof(int))
- {
- return (IDoubleConverter)new Int32DoubleConverter();
- }
- if (typeof(T) == typeof(uint))
- {
- return (IDoubleConverter)new UInt32DoubleConverter();
- }
- if (typeof(T) == typeof(long))
- {
- return (IDoubleConverter)new Int64DoubleConverter();
- }
- if (typeof(T) == typeof(ulong))
- {
- return (IDoubleConverter)new UInt64DoubleConverter();
- }
- if (typeof(T) == typeof(float))
- {
- return (IDoubleConverter)new SingleDoubleConverter();
- }
- if (typeof(T) == typeof(double))
- {
- return (IDoubleConverter)new DoubleDoubleConverter();
- }
- throw new NotSupportedException();
- }
- }
- internal class ByteDoubleConverter : IDoubleConverter
- {
- public double GetDouble(byte value)
- {
- return (double)value;
- }
- }
- internal class SByteDoubleConverter : IDoubleConverter
- {
- public double GetDouble(sbyte value)
- {
- return (double)value;
- }
- }
- internal class Int16DoubleConverter : IDoubleConverter
- {
- public double GetDouble(short value)
- {
- return (double)value;
- }
- }
- internal class UInt16DoubleConverter : IDoubleConverter
- {
- public double GetDouble(ushort value)
- {
- return (double)value;
- }
- }
- internal class Int32DoubleConverter : IDoubleConverter
- {
- public double GetDouble(int value)
- {
- return (double)value;
- }
- }
- internal class UInt32DoubleConverter : IDoubleConverter
- {
- public double GetDouble(uint value)
- {
- return (double)value;
- }
- }
- internal class Int64DoubleConverter : IDoubleConverter
- {
- public double GetDouble(long value)
- {
- return (double)value;
- }
- }
- internal class UInt64DoubleConverter : IDoubleConverter
- {
- public double GetDouble(ulong value)
- {
- return (double)value;
- }
- }
- internal class SingleDoubleConverter : IDoubleConverter
- {
- public double GetDouble(float value)
- {
- return (double)value;
- }
- }
- internal class DoubleDoubleConverter : IDoubleConverter
- {
- public double GetDouble(double value)
- {
- return (double)value;
- }
- }
- internal interface IDecimalConverter
- {
- decimal GetDecimal(T value);
- }
- internal static class DecimalConverter
- {
- public static IDecimalConverter Instance { get; } = DecimalConverter.GetDecimalConverter();
- }
- internal static class DecimalConverter
- {
- public static IDecimalConverter GetDecimalConverter()
- {
- if (typeof(T) == typeof(byte))
- {
- return (IDecimalConverter)new ByteDecimalConverter();
- }
- if (typeof(T) == typeof(sbyte))
- {
- return (IDecimalConverter)new SByteDecimalConverter();
- }
- if (typeof(T) == typeof(short))
- {
- return (IDecimalConverter)new Int16DecimalConverter();
- }
- if (typeof(T) == typeof(ushort))
- {
- return (IDecimalConverter)new UInt16DecimalConverter();
- }
- if (typeof(T) == typeof(int))
- {
- return (IDecimalConverter)new Int32DecimalConverter();
- }
- if (typeof(T) == typeof(uint))
- {
- return (IDecimalConverter)new UInt32DecimalConverter();
- }
- if (typeof(T) == typeof(long))
- {
- return (IDecimalConverter)new Int64DecimalConverter();
- }
- if (typeof(T) == typeof(ulong))
- {
- return (IDecimalConverter)new UInt64DecimalConverter();
- }
- if (typeof(T) == typeof(float))
- {
- return (IDecimalConverter)new SingleDecimalConverter();
- }
- if (typeof(T) == typeof(double))
- {
- return (IDecimalConverter)new DoubleDecimalConverter();
- }
- if (typeof(T) == typeof(decimal))
- {
- return (IDecimalConverter)new DecimalDecimalConverter();
- }
- throw new NotSupportedException();
- }
- }
- internal class ByteDecimalConverter : IDecimalConverter
- {
- public decimal GetDecimal(byte value)
- {
- return (decimal)value;
- }
- }
- internal class SByteDecimalConverter : IDecimalConverter
- {
- public decimal GetDecimal(sbyte value)
- {
- return (decimal)value;
- }
- }
- internal class Int16DecimalConverter : IDecimalConverter
- {
- public decimal GetDecimal(short value)
- {
- return (decimal)value;
- }
- }
- internal class UInt16DecimalConverter : IDecimalConverter
- {
- public decimal GetDecimal(ushort value)
- {
- return (decimal)value;
- }
- }
- internal class Int32DecimalConverter : IDecimalConverter
- {
- public decimal GetDecimal(int value)
- {
- return (decimal)value;
- }
- }
- internal class UInt32DecimalConverter : IDecimalConverter