lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mharw...@apache.org
Subject svn commit: r537123 - /lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/BooleanFilter.java
Date Fri, 11 May 2007 07:14:19 GMT
Author: mharwood
Date: Fri May 11 00:14:18 2007
New Revision: 537123

URL: http://svn.apache.org/viewvc?view=rev&rev=537123
Log:
Added hashcode and equals implementations to enable caching

Modified:
    lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/BooleanFilter.java

Modified: lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/BooleanFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/BooleanFilter.java?view=diff&rev=537123&r1=537122&r2=537123
==============================================================================
--- lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/BooleanFilter.java
(original)
+++ lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/BooleanFilter.java
Fri May 11 00:14:18 2007
@@ -134,4 +134,31 @@
 			notFilters.add(filterClause.getFilter());
 		}
 	}
+
+	public boolean equals(Object obj)
+	{
+		if(this == obj)
+			return true;
+		if((obj == null) || (obj.getClass() != this.getClass()))
+				return false;
+		BooleanFilter test = (BooleanFilter)obj;
+		return (notFilters == test.notFilters|| 
+					 (notFilters!= null && notFilters.equals(test.notFilters)))
+				&&
+			   (mustFilters == test.mustFilters|| 
+					 (mustFilters!= null && mustFilters.equals(test.mustFilters)))				 
+					 &&
+			   (shouldFilters == test.shouldFilters|| 
+					 (shouldFilters!= null && shouldFilters.equals(test.shouldFilters)));
+	}
+
+	public int hashCode()
+	{
+		int hash=7;
+		hash = 31 * hash + (null == mustFilters ? 0 : mustFilters.hashCode());
+		hash = 31 * hash + (null == notFilters ? 0 : notFilters.hashCode());
+		hash = 31 * hash + (null == shouldFilters ? 0 : shouldFilters.hashCode());
+		return hash;
+	}
+	
 }



Mime
View raw message