Esempio n. 1
0
        /// <summary>
        /// Advance the <see cref="SubSpans"/> to the same document </summary>
        private bool ToSameDoc()
        {
            sorter.Sort(0, subSpansByDoc.Length);
            int firstIndex = 0;
            int maxDoc     = subSpansByDoc[subSpansByDoc.Length - 1].Doc;

            while (subSpansByDoc[firstIndex].Doc != maxDoc)
            {
                if (!subSpansByDoc[firstIndex].SkipTo(maxDoc))
                {
                    more      = false;
                    inSameDoc = false;
                    return(false);
                }
                maxDoc = subSpansByDoc[firstIndex].Doc;
                if (++firstIndex == subSpansByDoc.Length)
                {
                    firstIndex = 0;
                }
            }
            for (int i = 0; i < subSpansByDoc.Length; i++)
            {
                if (Debugging.AssertsEnabled)
                {
                    Debugging.Assert(subSpansByDoc[i].Doc == maxDoc, " NearSpansOrdered.ToSameDoc() spans {0}\n at doc {1}, but should be at {2}", subSpansByDoc[0], subSpansByDoc[i].Doc, maxDoc);
                }
            }
            inSameDoc = true;
            return(true);
        }
Esempio n. 2
0
        /// <summary>
        /// Advance the <see cref="SubSpans"/> to the same document </summary>
        private bool ToSameDoc()
        {
            sorter.Sort(0, subSpansByDoc.Length);
            int firstIndex = 0;
            int maxDoc     = subSpansByDoc[subSpansByDoc.Length - 1].Doc;

            while (subSpansByDoc[firstIndex].Doc != maxDoc)
            {
                if (!subSpansByDoc[firstIndex].SkipTo(maxDoc))
                {
                    more      = false;
                    inSameDoc = false;
                    return(false);
                }
                maxDoc = subSpansByDoc[firstIndex].Doc;
                if (++firstIndex == subSpansByDoc.Length)
                {
                    firstIndex = 0;
                }
            }
            for (int i = 0; i < subSpansByDoc.Length; i++)
            {
                Debug.Assert((subSpansByDoc[i].Doc == maxDoc), " NearSpansOrdered.toSameDoc() spans " + subSpansByDoc[0] + "\n at doc " + subSpansByDoc[i].Doc + ", but should be at " + maxDoc);
            }
            inSameDoc = true;
            return(true);
        }
Esempio n. 3
0
        /// <summary>
        /// Advance the subSpans to the same document </summary>
        private bool ToSameDoc()
        {
            sorter.Sort(0, SubSpansByDoc.Length);
            int firstIndex = 0;
            int maxDoc     = SubSpansByDoc[SubSpansByDoc.Length - 1].Doc();

            while (SubSpansByDoc[firstIndex].Doc() != maxDoc)
            {
                if (!SubSpansByDoc[firstIndex].SkipTo(maxDoc))
                {
                    More      = false;
                    InSameDoc = false;
                    return(false);
                }
                maxDoc = SubSpansByDoc[firstIndex].Doc();
                if (++firstIndex == SubSpansByDoc.Length)
                {
                    firstIndex = 0;
                }
            }
            for (int i = 0; i < SubSpansByDoc.Length; i++)
            {
                Debug.Assert((SubSpansByDoc[i].Doc() == maxDoc), " NearSpansOrdered.toSameDoc() spans " + SubSpansByDoc[0] + "\n at doc " + SubSpansByDoc[i].Doc() + ", but should be at " + maxDoc);
            }
            InSameDoc = true;
            return(true);
        }