コード例 #1
0
        /// <summary>Returns a hash code value for this object.</summary>
        public override int GetHashCode()
        {
            int h = fieldName.GetHashCode();

            h ^= (lowerTerm != null ? lowerTerm.GetHashCode() : unchecked ((int)0xB6ECE882));        // {{Aroush-1.9}} is this OK?!
            h  = (h << 1) | (SupportClass.Number.URShift(h, 31));                                    // rotate to distinguish lower from upper
            h ^= (upperTerm != null ? (upperTerm.GetHashCode()) : unchecked ((int)0x91BEC2C2));      // {{Aroush-1.9}} is this OK?!
            h ^= (includeLower ? unchecked ((int)0xD484B933) : 0) ^ (includeUpper ? 0x6AE423AC : 0); // {{Aroush-1.9}} is this OK?!
            h ^= collator != null?collator.GetHashCode() : 0;

            return(h);
        }
コード例 #2
0
        //@Override
        public override int GetHashCode()
        {
            int prime  = 31;
            int result = base.GetHashCode();

            result = prime * result + ((collator == null)?0:collator.GetHashCode());
            result = prime * result + ((field == null)?0:field.GetHashCode());
            result = prime * result + (includeLower?1231:1237);
            result = prime * result + (includeUpper?1231:1237);
            result = prime * result + ((lowerTerm == null)?0:lowerTerm.GetHashCode());
            result = prime * result + ((upperTerm == null)?0:upperTerm.GetHashCode());
            return(result);
        }
コード例 #3
0
        /// <summary>Returns a hash code value for this object.</summary>
        public override int GetHashCode()
        {
            int h = BitConverter.ToInt32(BitConverter.GetBytes(GetBoost()), 0);

            h ^= (lowerTerm != null ? lowerTerm.GetHashCode() : 0);
            // reversible mix to make lower and upper position dependent and
            // to prevent them from cancelling out.
            h ^= ((h << 25) | (h >> 8));
            h ^= (upperTerm != null ? upperTerm.GetHashCode() : 0);
            h ^= (this.inclusive ? 0x2742E74A : 0);
            h ^= collator != null?collator.GetHashCode() : 0;

            return(h);
        }
コード例 #4
0
        /// <summary>Returns a hash code value for this object.</summary>
        public override int GetHashCode()
        {
            int h = BitConverter.ToInt32(BitConverter.GetBytes(GetBoost()), 0) ^ fieldName.GetHashCode();

            // hashCode of "" is 0, so don't use that for null...
            h ^= (lowerVal != null ? lowerVal.GetHashCode() : unchecked ((int)0x965a965a));                 // {{Aroush-1.9}} Is this OK?!
            // don't just XOR upperVal with out mixing either it or h, as it will cancel
            // out lowerVal if they are equal.
            h ^= ((h << 17) | (SupportClass.Number.URShift(h, 16)));                                 // a reversible (one to one) 32 bit mapping mix
            h ^= (upperVal != null ? (upperVal.GetHashCode()) : 0x5a695a69);
            h ^= (includeLower ? 0x665599aa : 0) ^ (includeUpper ? unchecked ((int)0x99aa5566) : 0); // {{Aroush-1.9}} Is this OK?!
            h ^= collator != null?collator.GetHashCode() : 0;

            return(h);
        }