[Quantproject-developers] QuantProject/b4_Business/a2_Strategies WeightedPositions.cs, 1.11, 1.12
Brought to you by:
glauco_1
|
From: Glauco S. <gla...@us...> - 2007-11-04 18:59:24
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv17322/b4_Business/a2_Strategies Modified Files: WeightedPositions.cs Log Message: - the ToString() method has been overridden (useful for debugging) - a new static property WeightedPositions TestInstance has been added: it will be a good habit to add a TestInstance property to many classes, it will be useful whenever an istance is needed for testing anything - a new string property Description has been added: it is extremely useful in the debugging watch window (for copy and paste also) Index: WeightedPositions.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/WeightedPositions.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** WeightedPositions.cs 28 Oct 2007 18:54:06 -0000 1.11 --- WeightedPositions.cs 4 Nov 2007 18:59:19 -0000 1.12 *************** *** 100,103 **** --- 100,121 ---- } + public static WeightedPositions TestInstance + { + get + { + double[] weights = {1.0}; + string[] tickers = {"DUMMY"}; + WeightedPositions testInstance = new WeightedPositions( weights , tickers ); + return testInstance; + } + } + + /// <summary> + /// text description of these weighted positions. Useful for debugging + /// </summary> + public string Description + { + get { return this.ToString(); } + } private void weightedPositions_default( double[] normalizedWeightValues , string[] tickers ) *************** *** 120,135 **** } - public static WeightedPositions TestInstance - { - get - { - double[] weights = {1.0}; - string[] tickers = {"DUMMY"}; - WeightedPositions testInstance = new WeightedPositions( weights , tickers ); - return testInstance; - } - } - - public WeightedPositions( double[] normalizedUnsignedWeightValues, SignedTickers signedTickers ) --- 138,141 ---- *************** *** 694,697 **** --- 700,710 ---- weightedPosition.Weight = - weightedPosition.Weight; } + public override string ToString() + { + string toString = ""; + for ( int i = 0 ; i < this.Count ; i++ ) + toString += ((WeightedPosition)( this[ i ] )).ToString() + "--"; + return toString; + } } } |