Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv29403/b7_Scripts/TickerSelectionTesting
Modified Files:
GenomeManipulator.cs
Log Message:
Method IsTickerContainedInGenome has been overloaded: added parameters fromGenePosition and toGenePosition in order to perform check only in the given section of the given genome
Index: GenomeManipulator.cs
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/GenomeManipulator.cs,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** GenomeManipulator.cs 7 Aug 2006 21:03:24 -0000 1.7
--- GenomeManipulator.cs 22 Aug 2006 19:09:35 -0000 1.8
***************
*** 232,235 ****
--- 232,264 ----
}
+
+ /// <summary>
+ /// Returns true if a given gene, when decoded by the
+ /// GenomeManagerForEfficientPortfolio, refers to a
+ /// ticker already contained in a given genome
+ /// </summary>
+ /// <param name="geneCorrespondingToATicker">Gene, corresponding to a certain ticker, that has to be checked</param>
+ /// <param name="genome">Genome containing or not the ticker geneCorrespondingToATicker refers to</param>
+ /// <param name="fromGenePosition">First gene position from which the checking
+ /// has to be done, inside the given genome</param>
+ /// <param name="toGenePosition">Last gene position to which the checking
+ /// has to be done, inside the given genome</param>
+ public static bool IsTickerContainedInGenome(int geneCorrespondingToATicker,
+ Genome genome, int fromGenePosition,
+ int toGenePosition)
+ {
+ return(
+ genome.HasGene(geneCorrespondingToATicker,
+ fromGenePosition, toGenePosition) ||
+ ( geneCorrespondingToATicker < 0 &&
+ genome.HasGene(
+ Math.Abs(geneCorrespondingToATicker)-1,
+ fromGenePosition, toGenePosition) ) ||
+ ( geneCorrespondingToATicker >= 0 &&
+ genome.HasGene(- Math.Abs(geneCorrespondingToATicker)- 1,
+ fromGenePosition, toGenePosition))
+ );
+
+ }
}
|