Author: enrico
Date: 2007-06-20 18:16:11 +0000 (Wed, 20 Jun 2007)
New Revision: 3026

Modified:
   software/ui/src/Engine.cpp
   software/ui/src/Engine.h
Log:
Added ability to retrieve max popcon scores to the Engine

Modified: software/ui/src/Engine.cpp
===================================================================
--- software/ui/src/Engine.cpp  2007-06-20 17:39:41 UTC (rev 3025)
+++ software/ui/src/Engine.cpp  2007-06-20 18:16:11 UTC (rev 3026)
@@ -84,6 +84,7 @@
        m_results.clear();
        m_types.clear();
        m_interfaces.clear();
+       m_res_max = 0;
 
        // Compute the types
        if (m_filter_type.valid())
@@ -164,6 +165,9 @@
                res.popcon = m_popcon[res.name];
                res.relevance = i.get_percent();
 
+               if (res.popcon > m_res_max)
+                       m_res_max = res.popcon;
+
                m_results.push_back(res);
 
                // Get all the game and interface tags in the result set
@@ -180,6 +184,9 @@
                }
        }
 
+       if (m_res_max > m_max)
+               m_max = m_res_max;
+
        m_dirty = false;
 }
 

Modified: software/ui/src/Engine.h
===================================================================
--- software/ui/src/Engine.h    2007-06-20 17:39:41 UTC (rev 3025)
+++ software/ui/src/Engine.h    2007-06-20 18:16:11 UTC (rev 3026)
@@ -71,11 +71,14 @@
        std::set<ept::debtags::Tag> m_types;
        std::set<ept::debtags::Tag> m_interfaces;
 
+       float m_max;
+       float m_res_max;
+
        Xapian::Query makeQuery();
        void recompute();
 
 public:
-       Engine() : m_filter_state(ANY), m_dirty(true) {}
+       Engine() : m_filter_state(ANY), m_dirty(true), m_max(0) {}
                
        /// Access the apt data provider
        ept::apt::Apt& apt() { return m_apt; }
@@ -107,6 +110,12 @@
                return m_results;
        }
 
+       /// Get the maximum popcon score in the result set
+       float popconLocalMax() const { return m_res_max; }
+
+       /// Get the maximum popcon score seen so far
+       float popconMax() const { return m_max; }
+
        /**
         * Set the keyword filter from the given string (which will be tokenized
         * and stemmed properly)


_______________________________________________
Pkg-games-commits mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/pkg-games-commits

Reply via email to