SplitIntRange() public static méthode

Splits an int range recursively. You may implement a builder that adds clauses to a Lucene.Net.Search.BooleanQuery for each call to its IntRangeBuilder#addRange(BytesRef,BytesRef) method.

this method is used by NumericRangeQuery.

public static SplitIntRange ( IntRangeBuilder builder, int precisionStep, int minBound, int maxBound ) : void
builder IntRangeBuilder
precisionStep int
minBound int
maxBound int
Résultat void
Exemple #1
0
        /// <summary>Note: The neededBounds iterator must be unsigned (easier understanding what's happening) </summary>
        protected internal virtual void  AssertIntRangeSplit(int lower, int upper, int precisionStep, bool useBitSet, System.Collections.IEnumerator neededBounds)
        {
            OpenBitSet bits = useBitSet?new OpenBitSet(upper - lower + 1):null;

            NumericUtils.SplitIntRange(new AnonymousClassIntRangeBuilder(lower, upper, useBitSet, bits, neededBounds, this), precisionStep, lower, upper);

            if (useBitSet)
            {
                // after flipping all bits in the range, the cardinality should be zero
                bits.Flip(0, upper - lower + 1);
                Assert.IsTrue(bits.IsEmpty(), "The sub-range concenated should match the whole range");
            }
        }
Exemple #2
0
        /// <summary>
        /// Note: The neededBounds Iterable must be unsigned (easier understanding what's happening) </summary>
        private void AssertIntRangeSplit(int lower, int upper, int precisionStep, bool useBitSet, IEnumerable <int> expectedBounds, IEnumerable <int> expectedShifts)
        {
            FixedBitSet       bits         = useBitSet ? new FixedBitSet(upper - lower + 1) : null;
            IEnumerator <int> neededBounds = (expectedBounds == null) ? null : expectedBounds.GetEnumerator();
            IEnumerator <int> neededShifts = (expectedShifts == null) ? null : expectedShifts.GetEnumerator();

            NumericUtils.SplitIntRange(new IntRangeBuilderAnonymousInnerClassHelper(this, lower, upper, useBitSet, bits, neededBounds, neededShifts), precisionStep, lower, upper);

            if (useBitSet)
            {
                // after flipping all bits in the range, the cardinality should be zero
                bits.Flip(0, upper - lower + 1);
                Assert.AreEqual(0, bits.Cardinality(), "The sub-range concenated should match the whole range");
            }
        }