[Quantproject-developers] QuantProject/b1_ADT/Optimizing/Genetic Genome.cs,1.1,1.2
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2005-05-17 23:03:45
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Genetic In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16968/b1_ADT/Optimizing/Genetic Modified Files: Genome.cs Log Message: Added IComparable implementation Index: Genome.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Genetic/Genome.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Genome.cs 1 Dec 2004 22:36:11 -0000 1.1 --- Genome.cs 17 May 2005 23:03:36 -0000 1.2 *************** *** 31,35 **** /// provided by biology /// </summary> ! public class Genome { private int[] genes; --- 31,35 ---- /// provided by biology /// </summary> ! public class Genome : IComparable { private int[] genes; *************** *** 68,72 **** --- 68,84 ---- get{return this.maxValueForGenes;} } + + //implementation of IComparable interface + public int CompareTo(object obj) { + if(obj is Genome) { + Genome genome = (Genome)obj; + return this.Fitness.CompareTo(genome.Fitness); + } + + throw new ArgumentException("Object is not a Genome"); + } + //end of implementation of IComparable interface + /// <summary> /// It creates a new genome object initialized by a IGenomeManager |