std::ostream &
SolverQueueItemInstallOneOf::dumpOn( std::ostream & os ) const
{
- os << "[" << "InstallOneOf: ";
+ os << "[" << (_soft?"Soft":"") << "InstallOneOf: ";
for (PoolItemList::const_iterator iter = _oneOfList.begin();
iter != _oneOfList.end();
iter++)
//---------------------------------------------------------------------------
-SolverQueueItemInstallOneOf::SolverQueueItemInstallOneOf (const ResPool & pool, const PoolItemList & itemList)
+SolverQueueItemInstallOneOf::SolverQueueItemInstallOneOf (const ResPool & pool, const PoolItemList & itemList,
+ bool soft)
: SolverQueueItem (QUEUE_ITEM_TYPE_INSTALL_ONE_OF, pool)
, _oneOfList (itemList)
+ , _soft (soft)
{
}
bool SolverQueueItemInstallOneOf::addRule (_Queue & q)
{
bool ret = true;
- MIL << "Install one of: " << endl;
- queue_push( &(q), SOLVER_INSTALL_SOLVABLE_ONE_OF );
+ MIL << "Install one of " << (_soft ? "(soft):" : ":")<< endl;
+
+ if (_soft) {
+ queue_push( &(q), SOLVER_INSTALL_SOLVABLE_ONE_OF | SOLVER_WEAK);
+ } else {
+ queue_push( &(q), SOLVER_INSTALL_SOLVABLE_ONE_OF );
+ }
+
for (PoolItemList::const_iterator iter = _oneOfList.begin(); iter != _oneOfList.end(); iter++) {
Id id = (*iter)->satSolvable().id();
if (id == ID_NULL) {
{
SolverQueueItemInstallOneOf_Ptr new_installOneOf = new SolverQueueItemInstallOneOf (pool(), _oneOfList);
new_installOneOf->SolverQueueItem::copy(this);
+ new_installOneOf->_soft = _soft;
return new_installOneOf;
}
private:
PoolItemList _oneOfList; // List of candidates
+ bool _soft; // if triggered by a soft requirement (a recommends)
public:
- SolverQueueItemInstallOneOf (const ResPool & pool, const PoolItemList & itemList);
+ SolverQueueItemInstallOneOf (const ResPool & pool, const PoolItemList & itemList, bool soft = false);
virtual ~SolverQueueItemInstallOneOf();
// ---------------------------------- I/O
friend std::ostream& operator<<(std::ostream & str, const SolverQueueItemInstallOneOf & obj)
{ return obj.dumpOn (str); }
+ // ---------------------------------- accessors
+
+ bool isSoft (void) const { return _soft; }
+
// ---------------------------------- methods
virtual bool addRule (_Queue & q);