mirror of https://github.com/apache/lucene.git
Added hashcode and equals implementations to enable caching
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@537123 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d759ee642d
commit
336d3e7c58
|
@ -134,4 +134,31 @@ public class BooleanFilter extends Filter
|
|||
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;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue