You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ar...@apache.org on 2009/11/23 16:02:12 UTC
svn commit: r883359 -
/incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/BooleanQuery.cs
Author: aroush
Date: Mon Nov 23 15:02:12 2009
New Revision: 883359
URL: http://svn.apache.org/viewvc?rev=883359&view=rev
Log:
LUCENENET-294: BooleanQuery
Modified:
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/BooleanQuery.cs
Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/BooleanQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Search/BooleanQuery.cs?rev=883359&r1=883358&r2=883359&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/BooleanQuery.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/BooleanQuery.cs Mon Nov 23 15:02:12 2009
@@ -101,7 +101,7 @@
BooleanQuery.maxClauseCount = maxClauseCount;
}
- private System.Collections.ArrayList clauses = new System.Collections.ArrayList();
+ private SupportClass.EquatableList<BooleanClause> clauses = new SupportClass.EquatableList<BooleanClause>();
private bool disableCoord;
/// <summary>Constructs an empty boolean query. </summary>
@@ -210,7 +210,7 @@
/// <summary>Returns the set of clauses in this query. </summary>
public virtual BooleanClause[] GetClauses()
{
- return (BooleanClause[]) clauses.ToArray(typeof(BooleanClause));
+ return (BooleanClause[]) clauses.ToArray();
}
/// <summary>Returns the list of clauses in this query. </summary>
@@ -593,7 +593,7 @@
public override System.Object Clone()
{
BooleanQuery clone = (BooleanQuery) base.Clone();
- clone.clauses = (System.Collections.ArrayList) this.clauses.Clone();
+ clone.clauses = (SupportClass.EquatableList<BooleanClause>) this.clauses.Clone();
return clone;
}
@@ -661,30 +661,18 @@
/// <summary>Returns true iff <code>o</code> is equal to this. </summary>
public override bool Equals(System.Object o)
{
- if (!(o is BooleanQuery))
- return false;
- BooleanQuery other = (BooleanQuery) o;
- if (this.GetBoost() != other.GetBoost())
- return false;
- if (this.clauses.Count != other.clauses.Count)
- return false;
- for (int i = 0; i < this.clauses.Count; i++)
- {
- if (this.clauses[i].Equals(other.clauses[i]) == false)
- return false;
- }
- return this.GetMinimumNumberShouldMatch() == other.GetMinimumNumberShouldMatch();
+ if (!(o is BooleanQuery))
+ return false;
+ BooleanQuery other = (BooleanQuery)o;
+ return (this.GetBoost() == other.GetBoost())
+ && this.clauses.Equals(other.clauses)
+ && this.GetMinimumNumberShouldMatch() == other.GetMinimumNumberShouldMatch();
}
/// <summary>Returns a hash code value for this object.</summary>
public override int GetHashCode()
{
- int hashCode = 0;
- for (int i = 0; i < clauses.Count; i++)
- {
- hashCode += clauses[i].GetHashCode();
- }
- return BitConverter.ToInt32(BitConverter.GetBytes(GetBoost()), 0) ^ hashCode + GetMinimumNumberShouldMatch();
+ return BitConverter.ToInt32(BitConverter.GetBytes(GetBoost()), 0) ^ clauses.GetHashCode() + GetMinimumNumberShouldMatch();
}
}
}
\ No newline at end of file