Lucene.Net.Search.BooleanFilter.GetHashCode C# (CSharp) Method

GetHashCode() public method

Hash code.
public GetHashCode ( ) : int
return int
        public override int GetHashCode()
        {
            int hash = 7;
            hash = 31 * (hash + this.ListHash(this.mustFilters)); 
            hash = 31 * (hash + this.ListHash(this.notFilters)); 
            hash = 31 * (hash + this.ListHash(this.shouldFilters));
            return hash;
        }

Usage Example

        public void HashEquality()
        {
            BooleanFilter a = new BooleanFilter();

            a.Add(new BooleanFilterClause(GetTermsFilter("inStock", "N", false), BooleanClause.Occur.MUST));
            a.Add(new BooleanFilterClause(GetTermsFilter("price", "030", false), BooleanClause.Occur.MUST_NOT));

            BooleanFilter b = new BooleanFilter();

            b.Add(new BooleanFilterClause(GetTermsFilter("inStock", "N", false), BooleanClause.Occur.MUST));
            b.Add(new BooleanFilterClause(GetTermsFilter("price", "030", false), BooleanClause.Occur.MUST_NOT));

            Assert.AreEqual(a.GetHashCode(), b.GetHashCode(), "Hashes do not match");
        }
All Usage Examples Of Lucene.Net.Search.BooleanFilter::GetHashCode