**/
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
* 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 );
};
///////////////////////////////////////////////////////////////////////
}
}
}
- 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
ProblemSolutionCombi::ProblemSolutionCombi( ResolverProblem_Ptr parent)
: ProblemSolution (parent, "", "")
+ , actNumber(0)
{
_description = "";
_details = "";
void ProblemSolutionCombi::addSingleAction( PoolItem_Ref item, const TransactionKind action)
{
addAction (new TransactionSolutionAction(item, action));
+ actNumber++;
}
void ProblemSolutionCombi::addDescription( const std::string description)
**/
class ProblemSolutionCombi : public ProblemSolution
{
+ protected:
+ int actNumber; // number of actions
public:
/**
* 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);
+
};
///////////////////////////////////////////////////////////////////