/**
         * Returns the sorted list with the entries and the collected page numbers.
         * @return Returns the sorted list with the entries and teh collected page numbers.
         */
        public ArrayList GetSortedEntries()
        {
            Hashtable grouped = new Hashtable();

            for (int i = 0; i < indexentry.Count; i++)
            {
                Entry  e   = (Entry)indexentry[i];
                String key = e.GetKey();

                Entry master = (Entry)grouped[key];
                if (master != null)
                {
                    master.AddPageNumberAndTag(e.GetPageNumber(), e.GetTag());
                }
                else
                {
                    e.AddPageNumberAndTag(e.GetPageNumber(), e.GetTag());
                    grouped[key] = e;
                }
            }

            // copy to a list and sort it
            ArrayList sorted = new ArrayList(grouped.Values);

            sorted.Sort(0, sorted.Count, comparator);
            return(sorted);
        }
Example #2
0
        /**
         * Returns the sorted list with the entries and the collected page numbers.
         * @return Returns the sorted list with the entries and teh collected page numbers.
         */
        virtual public List <Entry> GetSortedEntries()
        {
            Dictionary <string, Entry> grouped = new Dictionary <string, Entry>();

            for (int i = 0; i < indexentry.Count; i++)
            {
                Entry  e   = indexentry[i];
                String key = e.GetKey();

                Entry master;
                grouped.TryGetValue(key, out master);
                if (master != null)
                {
                    master.AddPageNumberAndTag(e.GetPageNumber(), e.GetTag());
                }
                else
                {
                    e.AddPageNumberAndTag(e.GetPageNumber(), e.GetTag());
                    grouped[key] = e;
                }
            }

            // copy to a list and sort it
            List <Entry> sorted = new List <Entry>(grouped.Values);

            sorted.Sort(0, sorted.Count, comparator);
            return(sorted);
        }