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(); }
/// <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(); }
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); }
/// <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(); }
/// <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(); }
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"); } }
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"); } } }
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()); }
private void QueueForm_Load(object sender, EventArgs e) { queue = new IntQueue(); }