/// <summary>Returns true if <code>o</code> is equal to this. </summary>
        public override bool Equals(System.Object o)
        {
            if (!(o is MultiPhraseQuery))
            {
                return(false);
            }
            MultiPhraseQuery other = (MultiPhraseQuery)o;

            if (this.GetBoost() == other.GetBoost() && this.slop == other.slop)
            {
                System.Collections.IEnumerator iter1 = this.termArrays.GetEnumerator();
                System.Collections.IEnumerator iter2 = other.termArrays.GetEnumerator();
                while (iter1.MoveNext() && iter2.MoveNext())
                {
                    Term item1 = (Term)iter1.Current;
                    Term item2 = (Term)iter2.Current;
                    if (!item1.Equals(item2))
                    {
                        return(false);
                    }
                }
                iter1 = this.positions.GetEnumerator();
                iter2 = other.positions.GetEnumerator();
                while (iter1.MoveNext() && iter2.MoveNext())
                {
                    System.Int32 item1 = (System.Int32)iter1.Current;
                    System.Int32 item2 = (System.Int32)iter2.Current;
                    if (!item1.Equals(item2))
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
示例#2
0
        /// <summary>Returns true if <code>o</code> is equal to this. </summary>
        public override bool Equals(System.Object o)
        {
            if (!(o is MultiPhraseQuery))
            {
                return(false);
            }
            MultiPhraseQuery other = (MultiPhraseQuery)o;
            bool             eq    = this.GetBoost() == other.GetBoost() && this.slop == other.slop;

            if (!eq)
            {
                return(false);
            }
            eq = this.termArrays.Count.Equals(other.termArrays.Count);
            if (!eq)
            {
                return(false);
            }

            for (int i = 0; i < this.termArrays.Count; i++)
            {
                if (!Support.Compare.CompareTermArrays((Term[])this.termArrays[i], (Term[])other.termArrays[i]))
                {
                    return(false);
                }
            }
            if (!eq)
            {
                return(false);
            }
            eq = this.positions.Count.Equals(other.positions.Count);
            if (!eq)
            {
                return(false);
            }
            for (int i = 0; i < this.positions.Count; i++)
            {
                if (!(this.positions[i] == other.positions[i]))
                {
                    return(false);
                }
            }
            return(true);
        }