From 03b1689de99510eb5c8c4ab9a2b550c0d249d9ba Mon Sep 17 00:00:00 2001 From: kuepper Date: Mon, 3 Oct 2005 09:47:06 +0000 Subject: [PATCH] Initialize booleans to get rid of compiler-warnings. --- eo/tutorial/Lesson5/eoOneMaxMutation.h | 62 +++++++++---------- eo/tutorial/Lesson5/eoOneMaxQuadCrossover.h | 68 ++++++++++----------- 2 files changed, 65 insertions(+), 65 deletions(-) diff --git a/eo/tutorial/Lesson5/eoOneMaxMutation.h b/eo/tutorial/Lesson5/eoOneMaxMutation.h index f98e74824..50e93109d 100644 --- a/eo/tutorial/Lesson5/eoOneMaxMutation.h +++ b/eo/tutorial/Lesson5/eoOneMaxMutation.h @@ -25,43 +25,43 @@ template class eoOneMaxMutation: public eoMonOp { public: - /** - * Ctor - no requirement - */ -// START eventually add or modify the anyVariable argument - eoOneMaxMutation() - // eoOneMaxMutation( varType _anyVariable) : anyVariable(_anyVariable) -// END eventually add or modify the anyVariable argument - { - // START Code of Ctor of an eoOneMaxEvalFunc object - // END Code of Ctor of an eoOneMaxEvalFunc object - } + /** + * Ctor - no requirement + */ + // START eventually add or modify the anyVariable argument + eoOneMaxMutation() + // eoOneMaxMutation( varType _anyVariable) : anyVariable(_anyVariable) + // END eventually add or modify the anyVariable argument + { + // START Code of Ctor of an eoOneMaxEvalFunc object + // END Code of Ctor of an eoOneMaxEvalFunc object + } - /// The class name. Used to display statistics - string className() const { return "eoOneMaxMutation"; } + /// The class name. Used to display statistics + string className() const { return "eoOneMaxMutation"; } - /** - * modifies the parent - * @param _genotype The parent genotype (will be modified) - */ - bool operator()(GenotypeT & _genotype) - { - bool isModified; - // START code for mutation of the _genotype object + /** + * modifies the parent + * @param _genotype The parent genotype (will be modified) + */ + bool operator()(GenotypeT & _genotype) + { + bool isModified(true); + // START code for mutation of the _genotype object - /** Requirement - * if (_genotype has been modified) - * isModified = true; - * else - * isModified = false; - */ - return isModified; - // END code for mutation of the _genotype object - } + /** Requirement + * if (_genotype has been modified) + * isModified = true; + * else + * isModified = false; + */ + return isModified; + // END code for mutation of the _genotype object + } private: // START Private data of an eoOneMaxMutation object - // varType anyVariable; // for example ... + // varType anyVariable; // for example ... // END Private data of an eoOneMaxMutation object }; diff --git a/eo/tutorial/Lesson5/eoOneMaxQuadCrossover.h b/eo/tutorial/Lesson5/eoOneMaxQuadCrossover.h index 1a0c414fc..5a201bd08 100644 --- a/eo/tutorial/Lesson5/eoOneMaxQuadCrossover.h +++ b/eo/tutorial/Lesson5/eoOneMaxQuadCrossover.h @@ -1,7 +1,7 @@ /** -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- The above line is usefulin Emacs-like editors - */ +*/ /* Template for simple quadratic crossover operators @@ -15,55 +15,55 @@ Quadratic crossover operators modify the both genotypes #include -/** +/** * Always write a comment in this format before class definition * if you want the class to be documented by Doxygen * * THere is NO ASSUMPTION on the class GenoypeT. * In particular, it does not need to derive from EO */ -template +template class eoOneMaxQuadCrossover: public eoQuadOp { public: - /** - * Ctor - no requirement - */ + /** + * Ctor - no requirement + */ // START eventually add or modify the anyVariable argument - eoOneMaxQuadCrossover() - // eoOneMaxQuadCrossover( varType _anyVariable) : anyVariable(_anyVariable) -// END eventually add or modify the anyVariable argument - { - // START Code of Ctor of an eoOneMaxEvalFunc object - // END Code of Ctor of an eoOneMaxEvalFunc object - } + eoOneMaxQuadCrossover() + // eoOneMaxQuadCrossover( varType _anyVariable) : anyVariable(_anyVariable) + // END eventually add or modify the anyVariable argument + { + // START Code of Ctor of an eoOneMaxEvalFunc object + // END Code of Ctor of an eoOneMaxEvalFunc object + } - /// The class name. Used to display statistics - string className() const { return "eoOneMaxQuadCrossover"; } + /// The class name. Used to display statistics + string className() const { return "eoOneMaxQuadCrossover"; } - /** - * eoQuad crossover - modifies both parents - * @param _genotype1 The first parent - * @param _genotype2 The second parent - */ - bool operator()(GenotypeT& _genotype1, GenotypeT & _genotype2) - { - bool oneAtLeastIsModified; - // START code for crossover of _genotype1 and _genotype2 objects + /** + * eoQuad crossover - modifies both parents + * @param _genotype1 The first parent + * @param _genotype2 The second parent + */ + bool operator()(GenotypeT& _genotype1, GenotypeT & _genotype2) + { + bool oneAtLeastIsModified(true); + // START code for crossover of _genotype1 and _genotype2 objects - /** Requirement - * if (at least one genotype has been modified) // no way to distinguish - * oneAtLeastIsModified = true; - * else - * oneAtLeastIsModified = false; - */ - return oneAtLeastIsModified; - // END code for crossover of _genotype1 and _genotype2 objects - } + /** Requirement + * if (at least one genotype has been modified) // no way to distinguish + * oneAtLeastIsModified = true; + * else + * oneAtLeastIsModified = false; + */ + return oneAtLeastIsModified; + // END code for crossover of _genotype1 and _genotype2 objects + } private: // START Private data of an eoOneMaxQuadCrossover object - // varType anyVariable; // for example ... + // varType anyVariable; // for example ... // END Private data of an eoOneMaxQuadCrossover object };