Improve comments and documentation.
[genetic.git] / src / crossover / crossover.h
index f494b7bbae01e7c61a690fb14643908082aa1776..0d9b309f7fc961f26594911f326a530727e028c5 100644 (file)
@@ -11,11 +11,29 @@ namespace genetic {
         template < typename _Chromosome >
         class Crossover {
         public:
+            /**
+             * Type of probability of crossover chance
+             */
             typedef double CrossoverChanceType;
+
+            /**
+             * Type representing Chromosome Gene
+             */
             typedef typename _Chromosome::GeneType GeneType;
         protected:
+            /**
+             * Probability of Crossover (0 = 0%, 1 = 100%)
+             */
             CrossoverChanceType chance;
 
+            /**
+             * Crossover two Chromosome's between themself.
+             *
+             * @param first first Chromosome to Crossover
+             * @param second second Chromosome to Crossover
+             * @param splitPlace Gene number on which the Genes should be swapped
+             * @return new Chromosome crossed between given two
+             */
             _Chromosome do_cross(_Chromosome first, _Chromosome second, unsigned int splitPlace) {
                 const unsigned int chromosomeSize = first.get().size();
 
@@ -57,10 +75,21 @@ namespace genetic {
             }
 
         public:
+            /**
+             * Class constructor. Initializes values.
+             *
+             * @param chance probability of Crossover (0 = 0%, 1 = 100%)
+             */
             Crossover(CrossoverChanceType chance) :
                 chance(chance) {
             }
 
+            /**
+             * Invokes Crossover calculations
+             *
+             * @param _generation Generation for which the crossover should be applied
+             * @return new Generation of Chromosome's after the Crossover
+             */
             Generation<_Chromosome> cross(Generation<_Chromosome> _generation) {
                 const unsigned int generationSize = _generation.get().size();
                 vector<_Chromosome> newGeneration;