TreeViewJumpsRj.printAVG C# (CSharp) Method

printAVG() protected method

protected printAVG ( System myObject, int cols ) : string[]
myObject System
cols int
return string[]
    protected override string[] printAVG(System.Object myObject, int cols)
    {
        JumpRj newJumpRj = (JumpRj)myObject;

        string tcString = newJumpRj.TcString;
        string tvString = newJumpRj.TvString;

        if(newJumpRj.Type == Constants.RunAnalysisName) {
            tcString = Util.DeleteFirstSubEvent(tcString);
            tvString = Util.DeleteFirstSubEvent(tvString);
        }

        double tcAVGDouble = Util.GetAverage(tcString);
        double tvAVGDouble = Util.GetAverage(tvString);

        string [] myData = new String [getColsNum()];
        int count = 0;
        if(newJumpRj.Type == Constants.RunAnalysisName)
            myData[count++] = Catalog.GetString("AVG") + " (" + Catalog.GetString("photocells not included") + ")";
        else
            myData[count++] = Catalog.GetString("AVG");

        myData[count++] = Util.TrimDecimals(tcAVGDouble.ToString(), pDN);
        myData[count++] = Util.TrimDecimals(tvAVGDouble.ToString(), pDN);
        myData[count++] = ""; //weight
        myData[count++] = ""; //fall

        //this values are calculated using the AVG of the tcs or tvs, not as an avg of individual values

        myData[count++] = Util.TrimDecimals(
                Util.GetHeightInCentimeters(
                    tvAVGDouble.ToString())
                , pDN);
        if (preferences.showPower) {
            myData[count++] = "";

            /* TODO:
             * it can be done using AVG values like the other AVG statistics,
             * but result will not be the same than making the avg of the different power values for each row
             * for this reason is best to first calculate the different values of each column and store separately
             * in order to calculate the total, AVG, SD using that data
             */
        }
        if (preferences.showStiffness) {
            myData[count++] = "";

            /* TODO:
             * it can be done using AVG values like the other AVG statistics,
             * but result will not be the same than making the avg of the different power values for each row
             * for this reason is best to first calculate the different values of each column and store separately
             * in order to calculate the total, AVG, SD using that data
             */
        }
        if (preferences.showInitialSpeed)
            myData[count++] = Util.TrimDecimals(
                    Util.GetInitialSpeed(
                        tvAVGDouble.ToString(), preferences.metersSecondsPreferred)
                    , pDN);
        if (preferences.showQIndex)
            myData[count++] = Util.TrimDecimals(
                    Util.GetQIndex(tvAVGDouble,tcAVGDouble).ToString(), pDN);
        else if (preferences.showDjIndex)
            myData[count++] = Util.TrimDecimals(
                    Util.GetDjIndex(tvAVGDouble,tcAVGDouble).ToString(), pDN);

        myData[count++] = "";

        myData[count++] = "-1"; //mark to non select here, select first line

        return myData;
    }