示例#1
0
        public override void main()
        {
            ((IStringInstance)Input_data.Instance).Value = readInput();
            IIteratorInstance <IKVPair <IString, IInteger> > output_data_instance = (IIteratorInstance <IKVPair <IString, IInteger> >)Output_data.Instance;

            //Trace.WriteLine ("APP BEFORE GO !!!");
            Count_words.go();
            //Trace.WriteLine ("APP AFTER GO !!!");

            SortedDictionary <int, IList <string> > result_pairs = new SortedDictionary <int, IList <string> >();

            int    count = 0;
            object word_object;

            while (output_data_instance.fetch_next(out word_object))
            {
                IKVPairInstance <IString, IInteger> word = (IKVPairInstance <IString, IInteger>)word_object;
                int            value = ((IIntegerInstance)word.Value).Value;
                string         key   = ((IStringInstance)word.Key).Value;
                IList <string> list_words;
                if (!result_pairs.TryGetValue(value, out list_words))
                {
                    list_words = new List <string>();
                    result_pairs.Add(value, list_words);
                }
                list_words.Add(key);
            }


            foreach (int count_word in result_pairs.Keys)
            {
                foreach (string word in result_pairs[count_word])
                {
                    Trace.WriteLine("RESULT - " + count_word + " : " + word);
                }
            }

            // Trace.WriteLine ("APP FINISH !!! " + count);
        }
 public override void main()
 {
     Count_words.go();
 }