Equals() public method

public Equals ( Object obj ) : bool
obj Object
return bool
コード例 #1
0
        public virtual bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            Type thisType = GetType();
            Type objType  = obj.GetType();

            if (!thisType.Equals(objType))
            {
                return(false);
            }
            if (!thisType.IsValueType)
            {
                return(ReferenceEquals(this, obj));
            }
            return(ValueType.Equals(this, obj));
        }
コード例 #2
0
        static StackObject *Equals_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Object @obj = (System.Object) typeof(System.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.ValueType instance_of_this_method = (System.ValueType) typeof(System.ValueType).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.Equals(@obj);

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value      = result_of_this_method ? 1 : 0;
            return(__ret + 1);
        }
コード例 #3
0
ファイル: NumericRangeQuery.cs プロジェクト: vernon016/mono
        private NumericRangeQuery(System.String field, int precisionStep, int valSize, System.ValueType min, System.ValueType max, bool minInclusive, bool maxInclusive)
        {
            System.Diagnostics.Debug.Assert((valSize == 32 || valSize == 64));
            if (precisionStep < 1)
            {
                throw new System.ArgumentException("precisionStep must be >=1");
            }
            this.field         = StringHelper.Intern(field);
            this.precisionStep = precisionStep;
            this.valSize       = valSize;
            this.min           = min;
            this.max           = max;
            this.minInclusive  = minInclusive;
            this.maxInclusive  = maxInclusive;

            // For bigger precisionSteps this query likely
            // hits too many terms, so set to CONSTANT_SCORE_FILTER right off
            // (especially as the FilteredTermEnum is costly if wasted only for AUTO tests because it
            // creates new enums from IndexReader for each sub-range)
            switch (valSize)
            {
            case 64:
                SetRewriteMethod((precisionStep > 6)?CONSTANT_SCORE_FILTER_REWRITE:CONSTANT_SCORE_AUTO_REWRITE_DEFAULT);
                break;

            case 32:
                SetRewriteMethod((precisionStep > 8)?CONSTANT_SCORE_FILTER_REWRITE:CONSTANT_SCORE_AUTO_REWRITE_DEFAULT);
                break;

            default:
                // should never happen
                throw new System.ArgumentException("valSize must be 32 or 64");
            }

            // shortcut if upper bound == lower bound
            if (min != null && min.Equals(max))
            {
                SetRewriteMethod(CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE);
            }
        }
コード例 #4
0
ファイル: NumericRangeQuery.cs プロジェクト: sinsay/SSE
        private NumericRangeQuery(System.String field, int precisionStep, int valSize, System.ValueType min, System.ValueType max, bool minInclusive, bool maxInclusive)
        {
            System.Diagnostics.Debug.Assert((valSize == 32 || valSize == 64));
            if (precisionStep < 1)
                throw new System.ArgumentException("precisionStep must be >=1");
            this.field = StringHelper.Intern(field);
            this.precisionStep = precisionStep;
            this.valSize = valSize;
            this.min = min;
            this.max = max;
            this.minInclusive = minInclusive;
            this.maxInclusive = maxInclusive;

            // For bigger precisionSteps this query likely
            // hits too many terms, so set to CONSTANT_SCORE_FILTER right off
            // (especially as the FilteredTermEnum is costly if wasted only for AUTO tests because it
            // creates new enums from IndexReader for each sub-range)
            switch (valSize)
            {

                case 64:
                    SetRewriteMethod((precisionStep > 6)?CONSTANT_SCORE_FILTER_REWRITE:CONSTANT_SCORE_AUTO_REWRITE_DEFAULT);
                    break;

                case 32:
                    SetRewriteMethod((precisionStep > 8)?CONSTANT_SCORE_FILTER_REWRITE:CONSTANT_SCORE_AUTO_REWRITE_DEFAULT);
                    break;

                default:
                    // should never happen
                    throw new System.ArgumentException("valSize must be 32 or 64");

            }

            // shortcut if upper bound == lower bound
            if (min != null && min.Equals(max))
            {
                SetRewriteMethod(CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE);
            }
        }