Пример #1
0
        public override void  Flush(System.Collections.IDictionary threadsAndFields, SegmentWriteState state)
        {
            System.Collections.IDictionary oneThreadsAndFields = new System.Collections.Hashtable();
            System.Collections.IDictionary twoThreadsAndFields = new System.Collections.Hashtable();

            System.Collections.IEnumerator it = new System.Collections.Hashtable(threadsAndFields).GetEnumerator();
            while (it.MoveNext())
            {
                System.Collections.DictionaryEntry entry = (System.Collections.DictionaryEntry)it.Current;

                DocFieldConsumersPerThread perThread = (DocFieldConsumersPerThread)entry.Key;

                System.Collections.ICollection fields = (System.Collections.ICollection)entry.Value;

                System.Collections.IEnumerator fieldsIt  = fields.GetEnumerator();
                System.Collections.Hashtable   oneFields = new System.Collections.Hashtable();
                System.Collections.Hashtable   twoFields = new System.Collections.Hashtable();
                while (fieldsIt.MoveNext())
                {
                    DocFieldConsumersPerField perField = (DocFieldConsumersPerField)fieldsIt.Current;
                    SupportClass.CollectionsHelper.AddIfNotContains(oneFields, perField.one);
                    SupportClass.CollectionsHelper.AddIfNotContains(twoFields, perField.two);
                }

                oneThreadsAndFields[perThread.one] = oneFields;
                twoThreadsAndFields[perThread.two] = twoFields;
            }


            one.Flush(oneThreadsAndFields, state);
            two.Flush(twoThreadsAndFields, state);
        }
Пример #2
0
        public override void Flush(Support.Dictionary <DocFieldConsumerPerThread, IList <DocFieldConsumerPerField> > threadsAndFields, SegmentWriteState state)
        {
            Support.Dictionary <DocFieldConsumerPerThread, IList <DocFieldConsumerPerField> > oneThreadsAndFields = new Support.Dictionary <DocFieldConsumerPerThread, IList <DocFieldConsumerPerField> >();
            Support.Dictionary <DocFieldConsumerPerThread, IList <DocFieldConsumerPerField> > twoThreadsAndFields = new Support.Dictionary <DocFieldConsumerPerThread, IList <DocFieldConsumerPerField> >();

            foreach (KeyValuePair <DocFieldConsumerPerThread, IList <DocFieldConsumerPerField> > entry in new Support.Dictionary <DocFieldConsumerPerThread, IList <DocFieldConsumerPerField> >(threadsAndFields))
            {
                DocFieldConsumersPerThread perThread = (DocFieldConsumersPerThread)entry.Key;

                IList <DocFieldConsumerPerField> fields = entry.Value;

                //IEnumerator<DocFieldConsumerPerField> fieldsIt = fields.GetEnumerator();
                IList <DocFieldConsumerPerField> oneFields = new List <DocFieldConsumerPerField>();
                IList <DocFieldConsumerPerField> twoFields = new List <DocFieldConsumerPerField>();
                foreach (DocFieldConsumersPerField perField in fields)
                {
                    oneFields.Add(perField.one);
                    twoFields.Add(perField.two);
                }

                oneThreadsAndFields[perThread.one] = oneFields;
                twoThreadsAndFields[perThread.two] = twoFields;
            }

            one.Flush(oneThreadsAndFields, state);
            two.Flush(twoThreadsAndFields, state);
        }
        public override void Flush(IDictionary <DocFieldConsumerPerThread, ICollection <DocFieldConsumerPerField> > threadsAndFields, SegmentWriteState state)
        {
            var oneThreadsAndFields = new HashMap <DocFieldConsumerPerThread, ICollection <DocFieldConsumerPerField> >();
            var twoThreadsAndFields = new HashMap <DocFieldConsumerPerThread, ICollection <DocFieldConsumerPerField> >();

            foreach (var entry in threadsAndFields)
            {
                DocFieldConsumersPerThread             perThread = (DocFieldConsumersPerThread)entry.Key;
                ICollection <DocFieldConsumerPerField> fields    = entry.Value;

                IEnumerator <DocFieldConsumerPerField> fieldsIt  = fields.GetEnumerator();
                ICollection <DocFieldConsumerPerField> oneFields = new HashSet <DocFieldConsumerPerField>();
                ICollection <DocFieldConsumerPerField> twoFields = new HashSet <DocFieldConsumerPerField>();
                while (fieldsIt.MoveNext())
                {
                    DocFieldConsumersPerField perField = (DocFieldConsumersPerField)fieldsIt.Current;
                    oneFields.Add(perField.one);
                    twoFields.Add(perField.two);
                }

                oneThreadsAndFields[perThread.one] = oneFields;
                twoThreadsAndFields[perThread.two] = twoFields;
            }


            one.Flush(oneThreadsAndFields, state);
            two.Flush(twoThreadsAndFields, state);
        }
Пример #4
0
        //internal override void flush(/*IDictionary*/ IDictionary<DocFieldConsumerPerThread, ICollection<DocFieldConsumerPerField>> threadsAndFields, DocumentsWriter.FlushState state)
        internal override void flush(/*IDictionary*/ IDictionary <object, ICollection <object> > threadsAndFields, DocumentsWriter.FlushState state)
        {
            //IDictionary oneThreadsAndFields = new Dictionary();
            //IDictionary twoThreadsAndFields = new Dictionary();
            //IDictionary<DocFieldConsumerPerThread, ICollection<DocFieldConsumerPerField>> oneThreadsAndFields = new Dictionary<DocFieldConsumerPerThread, ICollection<DocFieldConsumerPerField>>();
            //IDictionary<DocFieldConsumerPerThread, ICollection<DocFieldConsumerPerField>> twoThreadsAndFields = new Dictionary<DocFieldConsumerPerThread, ICollection<DocFieldConsumerPerField>>();
            IDictionary <object, ICollection <object> > oneThreadsAndFields = new Dictionary <object, ICollection <object> >();
            IDictionary <object, ICollection <object> > twoThreadsAndFields = new Dictionary <object, ICollection <object> >();

            //IEnumerator it = threadsAndFields.GetEnumerator();
            //IEnumerator<KeyValuePair<DocFieldConsumerPerThread, ICollection<DocFieldConsumerPerField>>> it = threadsAndFields.GetEnumerator();
            IEnumerator <KeyValuePair <object, ICollection <object> > > it = threadsAndFields.GetEnumerator();

            while (it.MoveNext())
            {
                //KeyValuePair entry = it.Current;
                //KeyValuePair<DocFieldConsumerPerThread, ICollection<DocFieldConsumerPerField>> entry = it.Current;
                KeyValuePair <object, ICollection <object> > entry = it.Current;

                //DocFieldConsumersPerThread perThread = (DocFieldConsumersPerThread)entry.Key;
                DocFieldConsumersPerThread perThread = (DocFieldConsumersPerThread)entry.Key;

                //ICollection fields = (ICollection)entry.Value;
                //ICollection<DocFieldConsumerPerField> fields = entry.Value;
                ICollection <object> fields = entry.Value;

                //IEnumerator fieldsIt = fields.GetEnumerator();
                //IEnumerator<DocFieldConsumerPerField> fieldsIt = fields.GetEnumerator();
                IEnumerator <object> fieldsIt = fields.GetEnumerator();

                //IDictionary oneFields = new Dictionary();
                //IDictionary twoFields = new Dictionary();
                //IDictionary<DocFieldConsumerPerField, DocFieldConsumerPerField> oneFields = new Dictionary<DocFieldConsumerPerField, DocFieldConsumerPerField>();
                //IDictionary<DocFieldConsumerPerField, DocFieldConsumerPerField> twoFields = new Dictionary<DocFieldConsumerPerField, DocFieldConsumerPerField>();
                IDictionary <object, object> oneFields = new Dictionary <object, object>();
                IDictionary <object, object> twoFields = new Dictionary <object, object>();

                while (fieldsIt.MoveNext())
                {
                    DocFieldConsumersPerField perField = (DocFieldConsumersPerField)fieldsIt.Current;
                    oneFields[perField.one] = perField.one;
                    twoFields[perField.two] = perField.two;
                }

                oneThreadsAndFields[perThread.one] = oneFields.Keys;
                twoThreadsAndFields[perThread.two] = twoFields.Keys;
            }

            one.flush(oneThreadsAndFields, state);
            two.flush(twoThreadsAndFields, state);
        }
		public DocFieldConsumersPerField(DocFieldConsumersPerThread perThread, DocFieldConsumerPerField one, DocFieldConsumerPerField two)
		{
			this.perThread = perThread;
			this.one = one;
			this.two = two;
		}
 public DocFieldConsumersPerField(DocFieldConsumersPerThread perThread, DocFieldConsumerPerField one, DocFieldConsumerPerField two)
 {
     this.perThread = perThread;
     this.one       = one;
     this.two       = two;
 }