コード例 #1
0
        private IEnumerable <long?> GetNumericIterator(int maxDoc)
        {
            // .NET Port: using yield return instead of custom iterator type. Much less code.
            AbstractAppendingLongBuffer.Iterator iter = Pending.GetIterator();
            int size = (int)Pending.Size();
            int upto = 0;

            while (upto < maxDoc)
            {
                long?value;
                if (upto < size)
                {
                    var v = iter.Next();
                    if (DocsWithField == null || DocsWithField.Get(upto))
                    {
                        value = v;
                    }
                    else
                    {
                        value = null;
                    }
                }
                else
                {
                    value = DocsWithField != null ? (long?)null : MISSING;
                }
                upto++;
                // TODO: make reusable Number
                yield return(value);
            }
        }
コード例 #2
0
        private IEnumerable <long> GetNumericIterator(int maxDoc)
        {
            // .NET Port: using yield return instead of custom iterator type. Much less code.

            AbstractAppendingLongBuffer.Iterator iter = Pending.GetIterator();
            int size = (int)Pending.Size();
            int upto = 0;

            while (upto < maxDoc)
            {
                long value;
                if (upto < size)
                {
                    value = iter.Next();
                }
                else
                {
                    value = 0;
                }
                upto++;
                // TODO: make reusable Number
                yield return(value);
            }
        }