diff --git a/src/sbml/validator/constraints/AssignmentCycles.cpp b/src/sbml/validator/constraints/AssignmentCycles.cpp index fe7b549df..7e6a52b8b 100644 --- a/src/sbml/validator/constraints/AssignmentCycles.cpp +++ b/src/sbml/validator/constraints/AssignmentCycles.cpp @@ -84,7 +84,7 @@ AssignmentCycles::~AssignmentCycles () void AssignmentCycles::check_ (const Model& m, const Model& object) { - // this rule ony applies in l2v2 and beyond + // this rule only applies in l2v2 and beyond if (object.getLevel() == 1 || (object.getLevel() == 2 && object.getVersion() == 1)) return; @@ -271,21 +271,19 @@ AssignmentCycles::determineAllDependencies() bool -AssignmentCycles::alreadyExistsInMap(IdMap map, - pair dependency) +AssignmentCycles::alreadyExistsInMap(IdMap& map, + const pair& dependency) const { - bool exists = false; - IdIter it; - for (it = map.begin(); it != map.end(); it++) + for (it = map.begin(); it != map.end(); ++it) { if (((*it).first == dependency.first) && ((*it).second == dependency.second)) - exists = true; + return true; } - return exists; + return false; } diff --git a/src/sbml/validator/constraints/AssignmentCycles.h b/src/sbml/validator/constraints/AssignmentCycles.h index b854ab501..0466d304f 100644 --- a/src/sbml/validator/constraints/AssignmentCycles.h +++ b/src/sbml/validator/constraints/AssignmentCycles.h @@ -92,8 +92,8 @@ class AssignmentCycles: public TConstraint /* helper function to check if a pair already exists */ - bool alreadyExistsInMap(IdMap map, - std::pair dependency); + bool alreadyExistsInMap(IdMap& map, + const std::pair& dependency) const; /* check for explicit use of original variable */