ordering combiSolutions
authorStefan Schubert <schubi@suse.de>
Mon, 14 Jan 2008 13:31:23 +0000 (13:31 +0000)
committerStefan Schubert <schubi@suse.de>
Mon, 14 Jan 2008 13:31:23 +0000 (13:31 +0000)
zypp/ResolverProblem.cc
zypp/ResolverProblem.h
zypp/sat/SATResolver.cc
zypp/solver/detail/ProblemSolutionCombi.cc
zypp/solver/detail/ProblemSolutionCombi.h

index af733aa33d8a9be78999dde775b400b04a82997c..41969de7731c1397f95f7157592b3fec18325229 100644 (file)
@@ -101,9 +101,14 @@ ResolverProblem::solutions() const
  **/
 
 void
-ResolverProblem::addSolution( ProblemSolution_Ptr solution )
+ResolverProblem::addSolution( ProblemSolution_Ptr solution,
+                             bool inFront )
 {
-    _solutions.push_back (solution);
+    if (inFront) {
+       _solutions.push_front (solution);
+    } else {
+       _solutions.push_back (solution);
+    }
 }
 
 void
index 6780b967b73e2add3a5d8730099c62baeadc17de..4cd6b0dc601e7746776bc2dbfcc329f34feb5d55 100644 (file)
@@ -97,7 +97,7 @@ namespace zypp
         * Add a solution to this problem. This class takes over ownership of
         * the problem and will delete it when neccessary.
         **/
-       void addSolution( ProblemSolution_Ptr solution );
+       void addSolution( ProblemSolution_Ptr solution, bool inFront = false );
 
     };
     ///////////////////////////////////////////////////////////////////////
index b0c36cf4fbd250df2f75253f1e1d6d1787aac775..c1a20a9d4960d6736c9bf59d330b9b109dc49481 100644 (file)
@@ -796,7 +796,8 @@ SATResolver::problems ()
                        }
                    }
                }
-               resolverProblem->addSolution (problemSolution);
+               resolverProblem->addSolution (problemSolution,
+                                             problemSolution->actionCount() > 1 ? true : false); // Solutions with more than 1 action will be shown first.
                MIL << "------------------------------------" << endl;
            }
            // save problem
index 3facc6e7477a50dd16633504725f942fb952551c..dd7586335017d39f7b948f95a5c5bbe40994f529 100644 (file)
@@ -48,6 +48,7 @@ IMPL_PTR_TYPE(ProblemSolutionCombi);
 
 ProblemSolutionCombi::ProblemSolutionCombi( ResolverProblem_Ptr parent)
     : ProblemSolution (parent, "", "")
+      , actNumber(0)
 {
     _description = "";
     _details = "";
@@ -56,6 +57,7 @@ ProblemSolutionCombi::ProblemSolutionCombi( ResolverProblem_Ptr parent)
 void ProblemSolutionCombi::addSingleAction( PoolItem_Ref item, const TransactionKind action)
 {
     addAction (new TransactionSolutionAction(item, action));
+    actNumber++;
 }
 
 void ProblemSolutionCombi::addDescription( const std::string description)
index ba71bed5a5d218ccb41399640bc96b9601d212b7..39587783f02c5c9f429625143d8b5e4a5b1a09ce 100644 (file)
@@ -44,6 +44,8 @@ namespace zypp
         **/
        class ProblemSolutionCombi : public ProblemSolution
        {
+        protected:
+           int actNumber; // number of actions
        public:
 
            /**
@@ -54,10 +56,17 @@ namespace zypp
             * Add a single action
             */
            void addSingleAction( PoolItem_Ref item, const TransactionKind action);
+
+           /**
+            * returns the number of actions
+            */
+           int actionCount() { return actNumber;}
+           
            /**
             * Set description text
             */
-           void addDescription( const std::string description);            
+           void addDescription( const std::string description);
+
        };
 
       ///////////////////////////////////////////////////////////////////