コード例 #1
0
        private static int CompareTo0(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj, global::net.sf.jni4net.utils.JniLocalHandle obj)
        {
            // (Lsystem/Object;)I
            // (LSystem/Object;)I
            global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
            int @__return = default(int);

            try {
                global::System.IComparable @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C <global::System.IComparable>(@__env, @__obj);
                @__return = ((int)(@__real.CompareTo(global::net.sf.jni4net.utils.Convertor.FullJ2C <object>(@__env, obj))));
            }catch (global::System.Exception __ex) { @__env.ThrowExisting(__ex); }
            return(@__return);
        }
コード例 #2
0
ファイル: Runtime.cs プロジェクト: sguzman/BrotliHaxe
        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))));
            }
        }