Commit 7f8e2de5 authored by David Narváez's avatar David Narváez

Rename resultDoesNotDependOnGiven Method

Lets not have negation operators in method names that return
booleans :)
parent 33e51b00
......@@ -15,6 +15,8 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
// 02110-1301, USA.
#include <algorithm>
#include "object_hierarchy.h"
#include "../objects/object_holder.h"
......@@ -673,18 +675,17 @@ bool operator==( const ObjectHierarchy& lhs, const ObjectHierarchy& rhs )
return true;
}
bool ObjectHierarchy::resultDoesNotDependOnGiven() const
bool ObjectHierarchy::resultDependsOnGiven() const
{
std::vector<bool> dependsstack( mnodes.size() + mnumberofargs, false );
for ( uint i = 0; i < mnumberofargs; ++i )
dependsstack[i] = true;
std::fill( dependsstack.begin(), dependsstack.begin() + mnumberofargs, true );
for ( uint i = 0; i < mnodes.size(); ++i )
mnodes[i]->checkDependsOnGiven( dependsstack, i + mnumberofargs );
for ( uint i = dependsstack.size() - mnumberofresults; i < dependsstack.size(); ++i )
if ( !dependsstack[i] )
return true;
return false;
// This could be a call to std::any_of if there was an identity function
return std::find( dependsstack.rbegin(), dependsstack.rbegin() + mnumberofresults, false ) == dependsstack.rbegin() + mnumberofresults;
}
// returns the "minimum" of a and b ( in the partially ordered set of
......
......@@ -101,7 +101,7 @@ public:
const ObjectImpType* idOfLastResult() const;
bool resultDoesNotDependOnGiven() const;
bool resultDependsOnGiven() const;
bool allGivenObjectsUsed() const;
ObjectHierarchy transformFinalObject( const Transformation& t ) const;
......
......@@ -85,7 +85,7 @@ bool DefineMacroMode::validateObjects()
std::back_inserter( final ),
std::mem_fun( memfun ) );
ObjectHierarchy hier( given, final );
if ( hier.resultDoesNotDependOnGiven() )
if ( !hier.resultDependsOnGiven() )
{
KMessageBox::sorry( mwizard,
i18n( "One of the result objects you selected "
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment