예제 #1
0
        public UnionDocsAndPositionsEnum(Bits liveDocs, AtomicReaderContext context, Term[] terms, IDictionary <Term, TermContext> termContexts, TermsEnum termsEnum)
        {
            ICollection <DocsAndPositionsEnum> docsEnums = new LinkedList <DocsAndPositionsEnum>();

            for (int i = 0; i < terms.Length; i++)
            {
                Term      term      = terms[i];
                TermState termState = termContexts[term].Get(context.Ord);
                if (termState == null)
                {
                    // Term doesn't exist in reader
                    continue;
                }
                termsEnum.SeekExact(term.Bytes(), termState);
                DocsAndPositionsEnum postings = termsEnum.DocsAndPositions(liveDocs, null, DocsEnum.FLAG_NONE);
                if (postings == null)
                {
                    // term does exist, but has no positions
                    throw new InvalidOperationException("field \"" + term.Field() + "\" was indexed without position data; cannot run PhraseQuery (term=" + term.Text() + ")");
                }
                Cost_Renamed += postings.Cost();
                docsEnums.Add(postings);
            }

            _queue   = new DocsQueue(docsEnums);
            _posList = new IntQueue();
        }
예제 #2
0
        /// <summary> Creates a new <c>MultipleTermPositions</c> instance.
        /// 
        /// </summary>
        /// <exception cref="System.IO.IOException">
        /// </exception>
        public MultipleTermPositions(IndexReader indexReader, Term[] terms)
        {
            System.Collections.IList termPositions = new System.Collections.ArrayList();

            for (int i = 0; i < terms.Length; i++)
                termPositions.Add(indexReader.TermPositions(terms[i]));

            _termPositionsQueue = new TermPositionsQueue(termPositions);
            _posList = new IntQueue();
        }
예제 #3
0
        private static IList <int> ArrayQueueAsList(IntQueue queue)
        {
            var l = new List <int>(queue.Size);

            for (int i = 0; i < queue.Size; i++)
            {
                l.Add(queue.Get(i));
            }
            return(l);
        }
예제 #4
0
        /// <summary> Creates a new <code>MultipleTermPositions</code> instance.
        ///
        /// </summary>
        /// <exception cref="IOException">
        /// </exception>
        public MultipleTermPositions(IndexReader indexReader, Term[] terms)
        {
            System.Collections.IList termPositions = new System.Collections.ArrayList();

            for (int i = 0; i < terms.Length; i++)
            {
                termPositions.Add(indexReader.TermPositions(terms[i]));
            }

            _termPositionsQueue = new TermPositionsQueue(termPositions);
            _posList            = new IntQueue();
        }
        /// <summary> Creates a new <c>MultipleTermPositions</c> instance.
        ///
        /// </summary>
        /// <exception cref="System.IO.IOException">
        /// </exception>
        public MultipleTermPositions(IndexReader indexReader, Term[] terms)
        {
            var termPositions = new System.Collections.Generic.LinkedList <TermPositions>();

            for (int i = 0; i < terms.Length; i++)
            {
                termPositions.AddLast(indexReader.TermPositions(terms[i]));
            }

            _termPositionsQueue = new TermPositionsQueue(termPositions);
            _posList            = new IntQueue();
        }
예제 #6
0
        /// <summary> Creates a new <code>MultipleTermPositions</code> instance.
        ///
        /// </summary>
        /// <exception cref="IOException">
        /// </exception>
        public MultipleTermPositions(IndexReader indexReader, Term[] terms)
        {
            IList <TermPositions> termPositions = new List <TermPositions>();

            for (int i = 0; i < terms.Length; i++)
            {
                termPositions.Add(indexReader.TermPositions(terms[i]));
            }

            _termPositionsQueue = new TermPositionsQueue(termPositions);
            _posList            = new IntQueue();
        }
예제 #7
0
파일: Queue.cs 프로젝트: LanevskyVlad/Att_2
 private void WorkBtn_Click(object sender, EventArgs e)
 {
     try
     {
         IntQueue queue = new IntQueue(StrToIntList(Input.Text));
         queue.RemoveAfterD((int)GetD.Value);
         Output.Text           = IntListToString(queue.ToList());
         SaveOutputBtn.Enabled = true;
     }
     catch (Exception)
     {
         MessageBox.Show("некорректный ввод", "Error");
     }
 }
예제 #8
0
 private void OpenBtn_Click(object sender, EventArgs e)
 {
     if (openFileDialog.ShowDialog() == DialogResult.OK)
     {
         try
         {
             FileWork file = new FileWork(openFileDialog.FileName);
             queue = file.ReadIntQueue();
             Upd();
         }
         catch (Exception)
         {
             MessageBox.Show("Error");
         }
     }
 }
예제 #9
0
        public void Test()
        {
            IntQueue iq = new IntQueue();
            Thread   t  = new Thread(delegate(object o)
            {
                // put child thread code here
                IntQueue miq = (IntQueue)o;
                miq.dequeue();
            });
            Thread t2 = new Thread(delegate(object o)
            {
                IntQueue miq = (IntQueue)o;
                iq.enqueue(2);
            });

            t.Start(iq);
            t2.Start(iq);
            iq.enqueue(1);
            t.Join();
            t2.Join();
            // check consistency of state
            Assert.IsFalse(iq.empty());
        }
예제 #10
0
 private void QueueForm_Load(object sender, EventArgs e)
 {
     queue = new IntQueue();
 }