<commit_before>/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

using System;

namespace Lucene.Net.Search
{
	
	/// <summary>An alternative to BooleanScorer that also allows a minimum number
	/// of optional scorers that should match.
	/// <br>Implements skipTo(), and has no limitations on the numbers of added scorers.
	/// <br>Uses ConjunctionScorer, DisjunctionScorer, ReqOptScorer and ReqExclScorer.
	/// </summary>
	class BooleanScorer2 : Scorer
	{
		private class AnonymousClassDisjunctionSumScorer : DisjunctionSumScorer
		{
			private void  InitBlock(BooleanScorer2 enclosingInstance)
			{
				this.enclosingInstance = enclosingInstance;
			}
			private BooleanScorer2 enclosingInstance;
			public BooleanScorer2 Enclosing_Instance
			{
				get
				{
					return enclosingInstance;
				}
				
			}
			internal AnonymousClassDisjunctionSumScorer(BooleanScorer2 enclosingInstance, System.Collections.IList Param1, int Param2):base(Param1, Param2)
			{
				InitBlock(enclosingInstance);
			}
			private int lastScoredDoc = - 1;
			public override float Score()
			{
				if (this.Doc() > lastScoredDoc)
				{
					lastScoredDoc = this.Doc();
					Enclosing_Instance.coordinator.nrMatchers += base.nrMatchers;
				}
				return base.Score();
			}
		}
		
		private class AnonymousClassConjunctionScorer : ConjunctionScorer
		{
			private void  InitBlock(int requiredNrMatchers, BooleanScorer2 enclosingInstance)
			{
				this.requiredNrMatchers = requiredNrMatchers;
				this.enclosingInstance = enclosingInstance;
			}
			
			private int requiredNrMatchers;
			private BooleanScorer2 enclosingInstance;
			
			public BooleanScorer2 Enclosing_Instance
			{
				get
				{
					return enclosingInstance;
				}
				
			}
			internal AnonymousClassConjunctionScorer(int requiredNrMatchers, BooleanScorer2 enclosingInstance, Lucene.Net.Search.Similarity Param1, System.Collections.ICollection scorers) : base(Param1, scorers)
			{
				InitBlock(requiredNrMatchers, enclosingInstance);
			}
			private int lastScoredDoc = - 1;
			
			public override float Score()
			{
				if (this.Doc() > lastScoredDoc)
				{
					lastScoredDoc = this.Doc();
					Enclosing_Instance.coordinator.nrMatchers += requiredNrMatchers;
				}
				// All scorers match, so defaultSimilarity super.score() always has 1 as
				// the coordination factor.
				// Therefore the sum of the scores of the requiredScorers
				// is used as score.
				return base.Score();
			}
		}
		private System.Collections.ArrayList requiredScorers = new System.Collections.ArrayList();
		private System.Collections.ArrayList optionalScorers = new System.Collections.ArrayList();
		private System.Collections.ArrayList prohibitedScorers = new System.Collections.ArrayList();
		
		
		private class Coordinator
		{
			public Coordinator(BooleanScorer2 enclosingInstance)
			{
				InitBlock(enclosingInstance);
			}
			private void  InitBlock(BooleanScorer2 enclosingInstance)
			{
				this.enclosingInstance = enclosingInstance;
			}
			private BooleanScorer2 enclosingInstance;<commit_msg>LUCENENET-128: 2 bugs in BooleanScorer2<commit_after>/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

using System;

namespace Lucene.Net.Search
{
	
	/// <summary>An alternative to BooleanScorer that also allows a minimum number
	/// of optional scorers that should match.
	/// <br>Implements skipTo(), and has no limitations on the numbers of added scorers.
	/// <br>Uses ConjunctionScorer, DisjunctionScorer, ReqOptScorer and ReqExclScorer.
	/// </summary>
	class BooleanScorer2 : Scorer
	{
		private class AnonymousClassDisjunctionSumScorer : DisjunctionSumScorer
		{
			private void  InitBlock(BooleanScorer2 enclosingInstance)
			{
				this.enclosingInstance = enclosingInstance;
			}
			private BooleanScorer2 enclosingInstance;
			public BooleanScorer2 Enclosing_Instance
			{
				get
				{
					return enclosingInstance;
				}
				
			}
			internal AnonymousClassDisjunctionSumScorer(BooleanScorer2 enclosingInstance, System.Collections.IList Param1, int Param2):base(Param1, Param2)
			{
				InitBlock(enclosingInstance);
			}
			private int lastScoredDoc = - 1;
			public override float Score()
			{
				if (this.Doc() >= lastScoredDoc)
				{
					lastScoredDoc = this.Doc();
					Enclosing_Instance.coordinator.nrMatchers += base.nrMatchers;
				}
				return base.Score();
			}
		}
		
		private class AnonymousClassConjunctionScorer : ConjunctionScorer
		{
			private void  InitBlock(int requiredNrMatchers, BooleanScorer2 enclosingInstance)
			{
				this.requiredNrMatchers = requiredNrMatchers;
				this.enclosingInstance = enclosingInstance;
			}
			
			private int requiredNrMatchers;
			private BooleanScorer2 enclosingInstance;
			
			public BooleanScorer2 Enclosing_Instance
			{
				get
				{
					return enclosingInstance;
				}
				
			}
			internal AnonymousClassConjunctionScorer(int requiredNrMatchers, BooleanScorer2 enclosingInstance, Lucene.Net.Search.Similarity Param1, System.Collections.ICollection scorers) : base(Param1, scorers)
			{
				InitBlock(requiredNrMatchers, enclosingInstance);
			}
			private int lastScoredDoc = - 1;
			
			public override float Score()
			{
				if (this.Doc() >= lastScoredDoc)
				{
					lastScoredDoc = this.Doc();
					Enclosing_Instance.coordinator.nrMatchers += requiredNrMatchers;
				}
				// All scorers match, so defaultSimilarity super.score() always has 1 as
				// the coordination factor.
				// Therefore the sum of the scores of the requiredScorers
				// is used as score.
				return base.Score();
			}
		}
		private System.Collections.ArrayList requiredScorers = new System.Collections.ArrayList();
		private System.Collections.ArrayList optionalScorers = new System.Collections.ArrayList();
		private System.Collections.ArrayList prohibitedScorers = new System.Collections.ArrayList();
		
		
		private class Coordinator
		{
			public Coordinator(BooleanScorer2 enclosingInstance)
			{
				InitBlock(enclosingInstance);
			}
			private void  InitBlock(BooleanScorer2 enclosingInstance)
			{
				this.enclosingInstance = enclosingInstance;
			}
			private BooleanScorer2 enclosingInstance;
{'fraction_non_alphanumeric': 0.0719915922228061, 'fraction_numerical': 0.0072254335260115606, 'mean_word_length': 3.740348692403487, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '400870', 'n_tokens_mistral': 2606, 'n_tokens_neox': 2083, 'n_words': 629}