Ejemplo n.º 1
0
        /// <summary>
        /// Returns true iff <code>o</code> is equal to this. </summary>
        public override bool Equals(object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (!(o is SpanNearQuery))
            {
                return(false);
            }

            SpanNearQuery spanNearQuery = (SpanNearQuery)o;

            if (m_inOrder != spanNearQuery.m_inOrder)
            {
                return(false);
            }
            if (m_slop != spanNearQuery.m_slop)
            {
                return(false);
            }
            if (!Equatable.Wrap(m_clauses).Equals(spanNearQuery.m_clauses))
            {
                return(false);
            }

            return(Boost == spanNearQuery.Boost);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Returns a hash code value for this object. </summary>
 public override int GetHashCode()
 {
     return(Number.SingleToInt32Bits(Boost)
            ^ Slop
            ^ Equatable.Wrap(GetTerms()).GetHashCode()
            ^ Equatable.Wrap(GetPositions()).GetHashCode()
            ^ n);
 }
Ejemplo n.º 3
0
        public override bool Equals(object o)
        {
            if (this.GetType() != o.GetType())
            {
                return(false);
            }
            var other = (MultiFunction)o;

            // LUCENENET specific: ensure our passed in list is equatable by
            // wrapping it in an EquatableList if it is not one already
            return(Equatable.Wrap(this.m_sources).Equals(other.m_sources));
        }
Ejemplo n.º 4
0
        public override int GetHashCode()
        {
            int result;

            result = Equatable.Wrap(m_clauses).GetHashCode();
            // Mix bits before folding in things like boost, since it could cancel the
            // last element of clauses.  this particular mix also serves to
            // differentiate SpanNearQuery hashcodes from others.
            result ^= (result << 14) | ((int)((uint)result >> 19)); // reversible
            result += Number.SingleToRawInt32Bits(Boost);
            result += m_slop;
            result ^= (m_inOrder ? unchecked ((int)0x99AFD3BD) : 0);
            return(result);
        }
Ejemplo n.º 5
0
        public override int GetHashCode()
        {
            const int prime  = 31;
            int       result = base.GetHashCode();

            result = prime * result + ((analyzer == null) ? 0 : analyzer.GetHashCode());
            result = prime * result + ((fieldName == null) ? 0 : fieldName.GetHashCode());
            result = prime * result + ((likeText == null) ? 0 : likeText.GetHashCode());
            result = prime * result + maxQueryTerms;
            result = prime * result + minDocFreq;
            result = prime * result + minTermFrequency;
            result = prime * result + Arrays.GetHashCode(moreLikeFields);
            result = prime * result + Number.SingleToInt32Bits(percentTermsToMatch);
            // LUCENENET: wrap in Equatable to compare set contents
            result = prime * result + ((stopWords == null) ? 0 : Equatable.Wrap(stopWords).GetHashCode());
            return(result);
        }
Ejemplo n.º 6
0
        public override bool Equals(object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (!(o is VectorValueSource))
            {
                return(false);
            }

            var that = (VectorValueSource)o;

            // LUCENENET specific: ensure our passed in list is equatable by
            // wrapping it in an EquatableList if it is not one already
            return(Equatable.Wrap(m_sources).Equals(that.m_sources));
        }
Ejemplo n.º 7
0
        public override int GetHashCode()
        {
            const int prime  = 31;
            int       result = base.GetHashCode();

            result = prime * result + (m_disableCoord ? 1231 : 1237);
            result = prime * result + Number.SingleToInt32Bits(m_highFreqBoost);
            result = prime * result + /*((highFreqOccur == null) ? 0 :*/ m_highFreqOccur.GetHashCode() /*)*/;
            result = prime * result + Number.SingleToInt32Bits(m_lowFreqBoost);
            result = prime * result + /*((lowFreqOccur == null) ? 0 :*/ m_lowFreqOccur.GetHashCode() /*)*/;
            result = prime * result + Number.SingleToInt32Bits(m_maxTermFrequency);
            result = prime * result + Number.SingleToInt32Bits(m_lowFreqMinNrShouldMatch);
            result = prime * result + Number.SingleToInt32Bits(m_highFreqMinNrShouldMatch);
            // LUCENENET specific: wrap the m_terms to ensure the collection values are
            // compared for equalitly
            result = prime * result + ((m_terms == null) ? 0 : Equatable.Wrap(m_terms).GetHashCode());
            return(result);
        }
Ejemplo n.º 8
0
        public override bool Equals(object obj)
        {
            if (this == obj)
            {
                return(true);
            }
            if (!base.Equals(obj))
            {
                return(false);
            }
            if (this.GetType() != obj.GetType())
            {
                return(false);
            }
            var other = (MoreLikeThisQuery)obj;

            if (analyzer == null)
            {
                if (other.analyzer != null)
                {
                    return(false);
                }
            }
            else if (!analyzer.Equals(other.analyzer))
            {
                return(false);
            }
            if (fieldName == null)
            {
                if (other.fieldName != null)
                {
                    return(false);
                }
            }
            else if (!fieldName.Equals(other.fieldName, StringComparison.Ordinal))
            {
                return(false);
            }
            if (likeText == null)
            {
                if (other.likeText != null)
                {
                    return(false);
                }
            }
            else if (!likeText.Equals(other.likeText, StringComparison.Ordinal))
            {
                return(false);
            }
            if (maxQueryTerms != other.maxQueryTerms)
            {
                return(false);
            }
            if (minDocFreq != other.minDocFreq)
            {
                return(false);
            }
            if (minTermFrequency != other.minTermFrequency)
            {
                return(false);
            }
            if (!Arrays.Equals(moreLikeFields, other.moreLikeFields))
            {
                return(false);
            }
            if (Number.SingleToInt32Bits(percentTermsToMatch) != Number.SingleToInt32Bits(other.percentTermsToMatch))
            {
                return(false);
            }
            if (stopWords == null)
            {
                if (other.stopWords != null)
                {
                    return(false);
                }
            }
            // LUCENENET: wrap in Equatable to compare set contents
            else if (!Equatable.Wrap(stopWords).Equals(other.stopWords))
            {
                return(false);
            }
            return(true);
        }
Ejemplo n.º 9
0
 public override int GetHashCode()
 {
     // LUCENENET specific: ensure our passed in list is equatable by
     // wrapping it in an EquatableList if it is not one already
     return(Equatable.Wrap(m_sources).GetHashCode() + Name.GetHashCode());
 }
Ejemplo n.º 10
0
        public override bool Equals(object obj)
        {
            if (this == obj)
            {
                return(true);
            }
            if (!base.Equals(obj))
            {
                return(false);
            }
            if (this.GetType() != obj.GetType())
            {
                return(false);
            }
            var other = (CommonTermsQuery)obj;

            if (m_disableCoord != other.m_disableCoord)
            {
                return(false);
            }
            if (Number.SingleToInt32Bits(m_highFreqBoost) != Number.SingleToInt32Bits(other.m_highFreqBoost))
            {
                return(false);
            }
            if (m_highFreqOccur != other.m_highFreqOccur)
            {
                return(false);
            }
            if (Number.SingleToInt32Bits(m_lowFreqBoost) != Number.SingleToInt32Bits(other.m_lowFreqBoost))
            {
                return(false);
            }
            if (m_lowFreqOccur != other.m_lowFreqOccur)
            {
                return(false);
            }
            if (Number.SingleToInt32Bits(m_maxTermFrequency) != Number.SingleToInt32Bits(other.m_maxTermFrequency))
            {
                return(false);
            }
            if (m_lowFreqMinNrShouldMatch != other.m_lowFreqMinNrShouldMatch)
            {
                return(false);
            }
            if (m_highFreqMinNrShouldMatch != other.m_highFreqMinNrShouldMatch)
            {
                return(false);
            }
            if (m_terms == null)
            {
                if (other.m_terms != null)
                {
                    return(false);
                }
            }
            // LUCENENET specific: wrap the m_terms to ensure the collection values are
            // compared for equalitly
            else if (!Equatable.Wrap(m_terms).Equals(other.m_terms))
            {
                return(false);
            }
            return(true);
        }