Exemplo n.º 1
0
        public virtual void TestFilteredDocIdSet()
        {
            const int maxdoc = 10;
            DocIdSet innerSet = new DocIdSetAnonymousInnerClassHelper(this, maxdoc);

            DocIdSet filteredSet = new FilteredDocIdSetAnonymousInnerClassHelper(this, innerSet);

            DocIdSetIterator iter = filteredSet.GetIterator();
            List<int?> list = new List<int?>();
            int doc = iter.Advance(3);
            if (doc != DocIdSetIterator.NO_MORE_DOCS)
            {
                list.Add(Convert.ToInt32(doc));
                while ((doc = iter.NextDoc()) != DocIdSetIterator.NO_MORE_DOCS)
                {
                    list.Add(Convert.ToInt32(doc));
                }
            }

            int[] docs = new int[list.Count];
            int c = 0;
            IEnumerator<int?> intIter = list.GetEnumerator();
            while (intIter.MoveNext())
            {
                docs[c++] = (int)intIter.Current;
            }
            int[] answer = new int[] { 4, 6, 8 };
            bool same = Arrays.Equals(answer, docs);
            if (!same)
            {
                Console.WriteLine("answer: " + Arrays.ToString(answer));
                Console.WriteLine("gotten: " + Arrays.ToString(docs));
                Assert.Fail();
            }
        }
Exemplo n.º 2
0
        public virtual void TestFilteredDocIdSet()
        {
            const int maxdoc   = 10;
            DocIdSet  innerSet = new DocIdSetAnonymousInnerClassHelper(this, maxdoc);

            DocIdSet filteredSet = new FilteredDocIdSetAnonymousInnerClassHelper(this, innerSet);

            DocIdSetIterator iter = filteredSet.GetIterator();
            List <int?>      list = new List <int?>();
            int doc = iter.Advance(3);

            if (doc != DocIdSetIterator.NO_MORE_DOCS)
            {
                list.Add(Convert.ToInt32(doc));
                while ((doc = iter.NextDoc()) != DocIdSetIterator.NO_MORE_DOCS)
                {
                    list.Add(Convert.ToInt32(doc));
                }
            }

            int[] docs = new int[list.Count];
            int   c    = 0;
            IEnumerator <int?> intIter = list.GetEnumerator();

            while (intIter.MoveNext())
            {
                docs[c++] = (int)intIter.Current;
            }
            int[] answer = new int[] { 4, 6, 8 };
            bool  same   = Arrays.Equals(answer, docs);

            if (!same)
            {
                Console.WriteLine("answer: " + Arrays.ToString(answer));
                Console.WriteLine("gotten: " + Arrays.ToString(docs));
                Assert.Fail();
            }
        }
Exemplo n.º 3
0
 public DocIdSetIteratorAnonymousInnerClassHelper(DocIdSetAnonymousInnerClassHelper outerInstance)
 {
     this.OuterInstance = outerInstance;
     docid = -1;
 }
Exemplo n.º 4
0
 public BitsAnonymousInnerClassHelper(DocIdSetAnonymousInnerClassHelper outerInstance)
 {
     this.outerInstance = outerInstance;
 }
Exemplo n.º 5
0
 public DocIdSetIteratorAnonymousInnerClassHelper(DocIdSetAnonymousInnerClassHelper outerInstance)
 {
     this.OuterInstance = outerInstance;
     docid = -1;
 }
Exemplo n.º 6
0
 public BitsAnonymousInnerClassHelper(DocIdSetAnonymousInnerClassHelper outerInstance)
 {
     this.outerInstance = outerInstance;
 }