Ejemplo n.º 1
0
        public static bool isInt(object obj)
        {
            global::System.IConvertible cv1 = ((global::System.IConvertible)((obj as global::System.IConvertible)));
            if ((cv1 != null))
            {
                switch (cv1.GetTypeCode())
                {
                case global::System.TypeCode.Int32:
                case global::System.TypeCode.UInt32:
                {
                    return(true);
                }


                case global::System.TypeCode.Double:
                {
                    double d = ((double)(obj));
                    if (((d >= global::System.Int32.MinValue) && (d <= global::System.Int32.MaxValue)))
                    {
                        return(d == ((int)(d)));
                    }
                    else
                    {
                        return(false);
                    }
                }


                default:
                {
                    return(false);
                }
                }
            }

            return(false);
        }
Ejemplo n.º 2
0
    public static global::ValueType @typeof(object v)
    {
                #line 257 "/opt/haxe/std/cs/_std/Type.hx"
        if ((v == null))
        {
                        #line 258 "/opt/haxe/std/cs/_std/Type.hx"
            return(global::ValueType.TNull);
        }

                #line 260 "/opt/haxe/std/cs/_std/Type.hx"
        global::System.Type t = (v as global::System.Type);
        if (!(global::System.Object.ReferenceEquals(((object)(t)), default(object))))
        {
                        #line 263 "/opt/haxe/std/cs/_std/Type.hx"
            return(global::ValueType.TObject);
        }

                #line 266 "/opt/haxe/std/cs/_std/Type.hx"
        t = ((global::System.Type)(v.GetType()));
        if (t.IsEnum)
        {
                        #line 268 "/opt/haxe/std/cs/_std/Type.hx"
            return(global::ValueType.TEnum(((global::System.Type)(t))));
        }

                #line 269 "/opt/haxe/std/cs/_std/Type.hx"
        if ((v is global::haxe.lang.Enum))
        {
                        #line 270 "/opt/haxe/std/cs/_std/Type.hx"
            return(global::ValueType.TEnum(((global::System.Type)(t.BaseType))));
        }

                #line 271 "/opt/haxe/std/cs/_std/Type.hx"
        if (t.IsValueType)
        {
                        #line 272 "/opt/haxe/std/cs/_std/Type.hx"
            global::System.IConvertible vc = (((object)(v)) as global::System.IConvertible);
            if ((vc != null))
            {
                                #line 274 "/opt/haxe/std/cs/_std/Type.hx"
                switch (vc.GetTypeCode())
                {
                case global::System.TypeCode.Boolean:
                {
                                                #line 276 "/opt/haxe/std/cs/_std/Type.hx"
                    return(global::ValueType.TBool);
                }


                case global::System.TypeCode.Int32:
                {
                                                #line 284 "/opt/haxe/std/cs/_std/Type.hx"
                    return(global::ValueType.TInt);
                }


                case global::System.TypeCode.Double:
                {
                                                #line 278 "/opt/haxe/std/cs/_std/Type.hx"
                    double d = vc.ToDouble(default(global::System.IFormatProvider));
                    if ((((d >= global::System.Int32.MinValue) && (d <= global::System.Int32.MaxValue)) && (d == vc.ToInt32(default(global::System.IFormatProvider)))))
                    {
                                                        #line 280 "/opt/haxe/std/cs/_std/Type.hx"
                        return(global::ValueType.TInt);
                    }
                    else
                    {
                                                        #line 282 "/opt/haxe/std/cs/_std/Type.hx"
                        return(global::ValueType.TFloat);
                    }
                }


                default:
                {
                                                #line 286 "/opt/haxe/std/cs/_std/Type.hx"
                    return(global::ValueType.TClass(((global::System.Type)(t))));
                }
                }
            }
            else
            {
                                #line 289 "/opt/haxe/std/cs/_std/Type.hx"
                return(global::ValueType.TClass(((global::System.Type)(t))));
            }
        }

                #line 293 "/opt/haxe/std/cs/_std/Type.hx"
        if ((v is global::haxe.lang.IHxObject))
        {
                        #line 294 "/opt/haxe/std/cs/_std/Type.hx"
            if ((v is global::haxe.lang.DynamicObject))
            {
                                #line 295 "/opt/haxe/std/cs/_std/Type.hx"
                return(global::ValueType.TObject);
            }

                        #line 296 "/opt/haxe/std/cs/_std/Type.hx"
            return(global::ValueType.TClass(((global::System.Type)(t))));
        }
        else if ((v is global::haxe.lang.Function))
        {
                        #line 298 "/opt/haxe/std/cs/_std/Type.hx"
            return(global::ValueType.TFunction);
        }
        else
        {
                        #line 300 "/opt/haxe/std/cs/_std/Type.hx"
            return(global::ValueType.TClass(((global::System.Type)(t))));
        }
    }
Ejemplo n.º 3
0
    public static global::ValueType @typeof(object v)
    {
        if ((v == null))
        {
            return(global::ValueType.TNull);
        }

        global::System.Type t = ((global::System.Type)((v as global::System.Type)));
        if (!(global::haxe.lang.Runtime.typeEq(t, null)))
        {
            return(global::ValueType.TObject);
        }

        t = ((global::System.Type)(v.GetType()));
        if ((t.IsEnum || (v is global::haxe.lang.Enum)))
        {
            return(global::ValueType.TEnum(((global::System.Type)(t))));
        }

        if (t.IsValueType)
        {
            global::System.IConvertible vc = ((global::System.IConvertible)(v));
            if ((vc != null))
            {
                global::System.TypeCode _g = vc.GetTypeCode();
                switch (_g)
                {
                case global::System.TypeCode.Boolean:
                {
                    return(global::ValueType.TBool);
                }


                case global::System.TypeCode.Int32:
                {
                    return(global::ValueType.TInt);
                }


                case global::System.TypeCode.Double:
                {
                    double d = vc.ToDouble(default(global::System.IFormatProvider));
                    if ((((d >= global::System.Int32.MinValue) && (d <= global::System.Int32.MaxValue)) && (d == vc.ToInt32(default(global::System.IFormatProvider)))))
                    {
                        return(global::ValueType.TInt);
                    }
                    else
                    {
                        return(global::ValueType.TFloat);
                    }
                }


                default:
                {
                    return(global::ValueType.TClass(((global::System.Type)(t))));
                }
                }
            }
            else
            {
                return(global::ValueType.TClass(((global::System.Type)(t))));
            }
        }

        if ((v is global::haxe.lang.IHxObject))
        {
            if ((v is global::haxe.lang.DynamicObject))
            {
                return(global::ValueType.TObject);
            }
            else if ((v is global::haxe.lang.Enum))
            {
                return(global::ValueType.TEnum(((global::System.Type)(t))));
            }

            return(global::ValueType.TClass(((global::System.Type)(t))));
        }
        else if ((v is global::haxe.lang.Function))
        {
            return(global::ValueType.TFunction);
        }
        else
        {
            return(global::ValueType.TClass(((global::System.Type)(t))));
        }
    }
Ejemplo n.º 4
0
 private static global::net.sf.jni4net.utils.JniHandle GetTypeCode0(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj)
 {
     // ()Lsystem/Enum;
     // ()LSystem/TypeCode;
     global::net.sf.jni4net.jni.JNIEnv      @__env    = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
     global::net.sf.jni4net.utils.JniHandle @__return = default(global::net.sf.jni4net.utils.JniHandle);
     try {
         global::System.IConvertible @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C <global::System.IConvertible>(@__env, @__obj);
         @__return = global::net.sf.jni4net.utils.Convertor.StrongC2Jp <global::System.TypeCode>(@__env, @__real.GetTypeCode());
     }catch (global::System.Exception __ex) { @__env.ThrowExisting(__ex); }
     return(@__return);
 }
Ejemplo n.º 5
0
        public static bool eq(object v1, object v2)
        {
            if (global::System.Object.ReferenceEquals(((object)(v1)), ((object)(v2))))
            {
                return(true);
            }

            if ((global::System.Object.ReferenceEquals(((object)(v1)), default(object)) || global::System.Object.ReferenceEquals(((object)(v2)), default(object))))
            {
                return(false);
            }

            global::System.IConvertible v1c = ((global::System.IConvertible)((v1 as global::System.IConvertible)));
            if ((v1c != null))
            {
                global::System.IConvertible v2c = ((global::System.IConvertible)((v2 as global::System.IConvertible)));
                if ((v2c == null))
                {
                    return(false);
                }

                global::System.TypeCode t1 = v1c.GetTypeCode();
                global::System.TypeCode t2 = v2c.GetTypeCode();
                if ((t1 == t2))
                {
                    return(global::System.Object.Equals(((object)(v1c)), ((object)(v2c))));
                }

                if (((t1 == global::System.TypeCode.String) || (t2 == global::System.TypeCode.String)))
                {
                    return(false);
                }

                switch (t1)
                {
                case global::System.TypeCode.Int64:
                {
                    switch (t2)
                    {
                    case global::System.TypeCode.Int64:
                    case global::System.TypeCode.UInt64:
                    case global::System.TypeCode.Single:
                    case global::System.TypeCode.Double:
                    case global::System.TypeCode.DateTime:
                    {
                        return(((long)(v1c.ToInt64(default(global::System.IFormatProvider)))) == ((long)(v2c.ToInt64(default(global::System.IFormatProvider)))));
                    }


                    case global::System.TypeCode.Decimal:
                    {
                        return(v1c.ToDecimal(default(global::System.IFormatProvider)).Equals(v2c.ToDecimal(default(global::System.IFormatProvider))));
                    }


                    default:
                    {
                        return(((long)(v1c.ToInt64(default(global::System.IFormatProvider)))) == ((long)(v2c.ToInt64(default(global::System.IFormatProvider)))));
                    }
                    }
                }


                case global::System.TypeCode.Single:
                case global::System.TypeCode.Double:
                {
                    switch (t2)
                    {
                    case global::System.TypeCode.Int64:
                    {
                        return(((long)(v1c.ToInt64(default(global::System.IFormatProvider)))) == ((long)(v2c.ToInt64(default(global::System.IFormatProvider)))));
                    }


                    case global::System.TypeCode.Single:
                    case global::System.TypeCode.Double:
                    {
                        return(v1c.ToDouble(default(global::System.IFormatProvider)) == v2c.ToDouble(default(global::System.IFormatProvider)));
                    }


                    case global::System.TypeCode.Decimal:
                    {
                        return(v1c.ToDecimal(default(global::System.IFormatProvider)).Equals(v2c.ToDecimal(default(global::System.IFormatProvider))));
                    }


                    case global::System.TypeCode.UInt64:
                    case global::System.TypeCode.DateTime:
                    {
                        return(v1c.ToUInt64(default(global::System.IFormatProvider)) == v2c.ToUInt64(default(global::System.IFormatProvider)));
                    }


                    default:
                    {
                        return(v1c.ToDouble(default(global::System.IFormatProvider)) == v2c.ToDouble(default(global::System.IFormatProvider)));
                    }
                    }
                }


                case global::System.TypeCode.Decimal:
                {
                    return(v1c.ToDecimal(default(global::System.IFormatProvider)).Equals(v2c.ToDecimal(default(global::System.IFormatProvider))));
                }


                case global::System.TypeCode.UInt64:
                case global::System.TypeCode.DateTime:
                {
                    switch (t2)
                    {
                    case global::System.TypeCode.Int64:
                    {
                        return(((long)(v1c.ToInt64(default(global::System.IFormatProvider)))) == ((long)(v2c.ToInt64(default(global::System.IFormatProvider)))));
                    }


                    case global::System.TypeCode.UInt64:
                    case global::System.TypeCode.Single:
                    case global::System.TypeCode.Double:
                    case global::System.TypeCode.DateTime:
                    {
                        return(v1c.ToUInt64(default(global::System.IFormatProvider)) == v2c.ToUInt64(default(global::System.IFormatProvider)));
                    }


                    case global::System.TypeCode.Decimal:
                    {
                        return(v1c.ToDecimal(default(global::System.IFormatProvider)).Equals(v2c.ToDecimal(default(global::System.IFormatProvider))));
                    }


                    default:
                    {
                        return(v1c.ToUInt64(default(global::System.IFormatProvider)) == v2c.ToUInt64(default(global::System.IFormatProvider)));
                    }
                    }
                }


                default:
                {
                    switch (t2)
                    {
                    case global::System.TypeCode.Int64:
                    {
                        return(((long)(v1c.ToInt64(default(global::System.IFormatProvider)))) == ((long)(v2c.ToInt64(default(global::System.IFormatProvider)))));
                    }


                    case global::System.TypeCode.Single:
                    case global::System.TypeCode.Double:
                    {
                        return(v1c.ToDouble(default(global::System.IFormatProvider)) == v2c.ToDouble(default(global::System.IFormatProvider)));
                    }


                    case global::System.TypeCode.Decimal:
                    {
                        return(v1c.ToDecimal(default(global::System.IFormatProvider)).Equals(v2c.ToDecimal(default(global::System.IFormatProvider))));
                    }


                    case global::System.TypeCode.UInt64:
                    case global::System.TypeCode.DateTime:
                    {
                        return(v1c.ToUInt64(default(global::System.IFormatProvider)) == v2c.ToUInt64(default(global::System.IFormatProvider)));
                    }


                    default:
                    {
                        return(v1c.ToInt32(default(global::System.IFormatProvider)) == v2c.ToInt32(default(global::System.IFormatProvider)));
                    }
                    }
                }
                }
            }

            if ((((global::System.ValueType)((v1 as global::System.ValueType))) != null))
            {
                return(v1.Equals(v2));
            }
            else
            {
                global::System.Type v1t = ((global::System.Type)((v1 as global::System.Type)));
                if ((v1t != null))
                {
                    global::System.Type v2t = ((global::System.Type)((v2 as global::System.Type)));
                    if ((v2t != null))
                    {
                        return(global::haxe.lang.Runtime.typeEq(v1t, v2t));
                    }

                    return(false);
                }
            }

            return(false);
        }
Ejemplo n.º 6
0
        public static int compare(object v1, object v2)
        {
            unchecked {
                if (global::System.Object.ReferenceEquals(((object)(v1)), ((object)(v2))))
                {
                    return(0);
                }

                if (global::System.Object.ReferenceEquals(((object)(v1)), default(object)))
                {
                    return(-1);
                }

                if (global::System.Object.ReferenceEquals(((object)(v2)), default(object)))
                {
                    return(1);
                }

                global::System.IConvertible cv1 = ((global::System.IConvertible)((v1 as global::System.IConvertible)));
                if ((cv1 != null))
                {
                    global::System.IConvertible cv2 = ((global::System.IConvertible)((v2 as global::System.IConvertible)));
                    if ((cv2 == null))
                    {
                        throw new global::System.ArgumentException(global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat("Cannot compare ", (v1.GetType() as global::System.Reflection.MemberInfo).ToString()), " and "), (v2.GetType() as global::System.Reflection.MemberInfo).ToString()));
                    }

                    switch (cv1.GetTypeCode())
                    {
                    case global::System.TypeCode.Double:
                    {
                        double d1 = ((double)(v1));
                        double d2 = cv2.ToDouble(default(global::System.IFormatProvider));
                        if ((d1 < d2))
                        {
                            return(-1);
                        }
                        else if ((d1 > d2))
                        {
                            return(1);
                        }
                        else
                        {
                            return(0);
                        }
                    }


                    case global::System.TypeCode.String:
                    {
                        if ((cv2.GetTypeCode() != global::System.TypeCode.String))
                        {
                            throw new global::System.ArgumentException(global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat("Cannot compare ", (v1.GetType() as global::System.Reflection.MemberInfo).ToString()), " and "), (v2.GetType() as global::System.Reflection.MemberInfo).ToString()));
                        }

                        return(string.Compare(((string)((v1 as string))), ((string)((v2 as string))), ((global::System.StringComparison)(global::System.StringComparison.Ordinal))));
                    }


                    default:
                    {
                        double d1d = cv1.ToDouble(default(global::System.IFormatProvider));
                        double d2d = cv2.ToDouble(default(global::System.IFormatProvider));
                        if ((d1d < d2d))
                        {
                            return(-1);
                        }
                        else if ((d1d > d2d))
                        {
                            return(1);
                        }
                        else
                        {
                            return(0);
                        }
                    }
                    }
                }

                global::System.IComparable c1 = ((global::System.IComparable)((v1 as global::System.IComparable)));
                global::System.IComparable c2 = ((global::System.IComparable)((v2 as global::System.IComparable)));
                if (((c1 == null) || (c2 == null)))
                {
                    throw new global::System.ArgumentException(global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat("Cannot compare ", (v1.GetType() as global::System.Reflection.MemberInfo).ToString()), " and "), (v2.GetType() as global::System.Reflection.MemberInfo).ToString()));
                }

                return(c1.CompareTo(((object)(c2))));
            }
        }