public BaseCharTypeInfo(string name, PrimitiveCategory primitiveCategory)
     : base(name, primitiveCategory)
 {
 }
 public PrimitiveTypeInfo(string typeName, PrimitiveCategory primitiveCategory)
 {
     this.typeName          = typeName;
     this.primitiveCategory = primitiveCategory;
 }
 internal PrimitiveTypeInfo(Dictionary <string, TypeInfo> types, string typeName, PrimitiveCategory primitiveCategory)
     : this(typeName, primitiveCategory)
 {
     types.Add(typeName, this);
 }
 internal static PrimitiveGrouping getPrimitiveGrouping(PrimitiveCategory from)
 {
     throw new NotImplementedException();
 }
 internal static ObjectInspector getPrimitiveWritableObjectInspector(PrimitiveCategory primitiveCategory)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 6
0
 public ObjPrimitive(PrimitiveCategory category, int capacity)
 {
     Category = category;
     Vertices = new(capacity);
 }
Ejemplo n.º 7
0
        public static bool implicitConvertible(PrimitiveCategory from, PrimitiveCategory to)
        {
            if (from == to)
            {
                return(true);
            }

            PrimitiveGrouping fromPg = PrimitiveObjectInspectorUtils.getPrimitiveGrouping(from);
            PrimitiveGrouping toPg   = PrimitiveObjectInspectorUtils.getPrimitiveGrouping(to);

            // Allow implicit String to Double conversion
            if (fromPg == PrimitiveGrouping.STRING_GROUP && to == PrimitiveCategory.DOUBLE)
            {
                return(true);
            }
            // Allow implicit String to Decimal conversion
            if (fromPg == PrimitiveGrouping.STRING_GROUP && to == PrimitiveCategory.DECIMAL)
            {
                return(true);
            }
            // Void can be converted to any type
            if (from == PrimitiveCategory.VOID)
            {
                return(true);
            }

            // Allow implicit String to Date conversion
            if (fromPg == PrimitiveGrouping.DATE_GROUP && toPg == PrimitiveGrouping.STRING_GROUP)
            {
                return(true);
            }
            // Allow implicit Numeric to String conversion
            if (fromPg == PrimitiveGrouping.NUMERIC_GROUP && toPg == PrimitiveGrouping.STRING_GROUP)
            {
                return(true);
            }
            // Allow implicit String to varchar conversion, and vice versa
            if (fromPg == PrimitiveGrouping.STRING_GROUP && toPg == PrimitiveGrouping.STRING_GROUP)
            {
                return(true);
            }

            // Allow implicit conversion from Byte -> Integer -> Long -> Float -> Double
            // Decimal -> String
            int?f = null;
            int?t = null;
            int tmp;

            if (numericTypes.TryGetValue(from, out tmp))
            {
                f = tmp;
            }
            if (numericTypes.TryGetValue(to, out tmp))
            {
                t = tmp;
            }

            if (f == null || t == null)
            {
                return(false);
            }
            if (f.Value > t.Value)
            {
                return(false);
            }
            return(true);
        }
Ejemplo n.º 8
0
 public static void registerNumericType(PrimitiveCategory primitiveCategory, int level)
 {
     numericTypeList.Add(primitiveCategory);
     numericTypes.AddOrUpdate(primitiveCategory, v => level, (v, x) => x);
 }