lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mharw...@apache.org
Subject svn commit: r541816 - /lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/TermsFilter.java
Date Fri, 25 May 2007 23:23:07 GMT
Author: mharwood
Date: Fri May 25 16:23:07 2007
New Revision: 541816

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

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

Modified: lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/TermsFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/TermsFilter.java?view=diff&rev=541816&r1=541815&r2=541816
==============================================================================
--- lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/TermsFilter.java (original)
+++ lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/TermsFilter.java Fri
May 25 16:23:07 2007
@@ -48,4 +48,27 @@
 		}
 		return result;
 	}
+	
+	public boolean equals(Object obj)
+	{
+		if(this == obj)
+			return true;
+		if((obj == null) || (obj.getClass() != this.getClass()))
+				return false;
+		TermsFilter test = (TermsFilter)obj;
+		return (termsList == test.termsList|| 
+					 (termsList!= null && termsList.equals(test.termsList)));
+	}
+
+	public int hashCode()
+	{
+		int hash=9;
+		for (Iterator iter = termsList.iterator(); iter.hasNext();)
+		{
+			Term term = (Term) iter.next();
+			hash = 31 * hash + term.hashCode();			
+		}
+		return hash;
+	}
+	
 }



Mime
View raw message