StatType.ChooseStat C# (CSharp) Method

ChooseStat() public method

public ChooseStat ( ) : bool
return bool
    public bool ChooseStat()
    {
        if ( statisticType == Constants.TypeSessionSummary ) {
            int jumperID = -1; //all jumpers
            string jumperName = ""; //all jumpers
            if(graph) {
                myStat = new GraphGlobal(myStatTypeStruct, jumperID, jumperName);
            } else {
                myStat = new StatGlobal(myStatTypeStruct, treeview_stats, jumperID, jumperName);
            }
        }
        else if (statisticType == Constants.TypeJumperSummary)
        {
            if(statisticApplyTo.Length == 0) {
                LogB.Information("Jumper-ret");
                return false;
            }
            int jumperID = Util.FetchID(statisticApplyTo);
            if(jumperID == -1) {
                return false;
            }

            string jumperName = Util.FetchName(statisticApplyTo);
            if(graph) {
                myStat = new GraphGlobal(myStatTypeStruct, jumperID, jumperName);
            }
            else {
                myStat = new StatGlobal(myStatTypeStruct, treeview_stats,
                        jumperID, jumperName);
            }
        }
        else if(statisticType == Constants.TypeJumpsSimple)
        {
            if(statisticApplyTo.Length == 0) {
                LogB.Information("Simple-ret");
                return false;
            }

            if(statisticSubType != Catalog.GetString("No indexes"))
            {
                string indexType = "";
                if(statisticSubType == Catalog.GetString(Constants.SubtractionBetweenTests))
                    indexType = "subtraction";
                else if(statisticSubType == Constants.ChronojumpProfile)
                    indexType = "ChronojumpProfile";
                else if(statisticSubType == Constants.IeIndexFormula)
                    indexType = "IE";
                else if(statisticSubType == Constants.ArmsUseIndexFormula)
                    indexType = "Arms Use Index";
                else if(statisticSubType == Constants.IRnaIndexFormula)
                    indexType = "IRna";
                else if(statisticSubType == Constants.IRaIndexFormula)
                    indexType = "IRa";
                else if(statisticSubType == Constants.FvIndexFormula)
                    indexType = "F/V";
                else if(
                        statisticSubType == Constants.PotencyLewisFormulaShort ||
                        statisticSubType == Constants.PotencyHarmanFormulaShort ||
                        statisticSubType == Constants.PotencySayersSJFormulaShort ||
                        statisticSubType == Constants.PotencySayersCMJFormulaShort ||
                        statisticSubType == Constants.PotencyShettyFormulaShort ||
                        statisticSubType == Constants.PotencyCanavanFormulaShort ||
                        //statisticSubType == Constants.PotencyBahamondeFormula ||
                        statisticSubType == Constants.PotencyLaraMaleApplicantsSCFormulaShort ||
                        statisticSubType == Constants.PotencyLaraFemaleEliteVoleiFormulaShort ||
                        statisticSubType == Constants.PotencyLaraFemaleMediumVoleiFormulaShort ||
                        statisticSubType == Constants.PotencyLaraFemaleSCStudentsFormulaShort ||
                        statisticSubType == Constants.PotencyLaraFemaleSedentaryFormulaShort
                        ) {
                    indexType = statisticSubType;
                }

                if(indexType == "subtraction") {
                    if(graph)
                        myStat = new GraphJumpSimpleSubtraction(myStatTypeStruct);
                    else
                        myStat = new StatJumpSimpleSubtraction(myStatTypeStruct, treeview_stats);
                } else if(indexType == "ChronojumpProfile") {
                    if(graph)
                        //myStat = new GraphChronojumpProfile(myStatTypeStruct);
                        LogB.Warning("TODO");
                    else
                        myStat = new StatChronojumpProfile(myStatTypeStruct, treeview_stats);
                } else if(indexType == "IE" || indexType == Constants.ArmsUseIndexName ||
                        indexType == "IRna" || indexType == "IRa") {
                    if(graph)
                        myStat = new GraphJumpIndexes (myStatTypeStruct, indexType);
                    else
                        myStat = new StatJumpIndexes(myStatTypeStruct, treeview_stats, indexType);
                } else if(indexType == "F/V") {
                    if(graph)
                        myStat = new GraphFv (myStatTypeStruct, indexType);
                    else
                        myStat = new StatFv(myStatTypeStruct, treeview_stats, indexType);
                } else {
                    //indexType = (Potency sayers or lewis);
                    if(graph)
                        myStat = new GraphPotency(myStatTypeStruct, indexType);
                    else
                        myStat = new StatPotency(myStatTypeStruct, treeview_stats, indexType);
                }
            }
            else {
                JumpType myType = new JumpType(statisticApplyTo);

                //manage all weight jumps and the AllJumpsName (simple)
                if(myType.HasWeight ||
                        statisticApplyTo == Constants.AllJumpsName)
                {
                    if(graph)
                        myStat = new GraphSjCmjAbkPlus (myStatTypeStruct);
                    else
                        myStat = new StatSjCmjAbkPlus (myStatTypeStruct, treeview_stats);
                } else {
                    if(graph)
                        myStat = new GraphSjCmjAbk (myStatTypeStruct);
                    else
                        myStat = new StatSjCmjAbk (myStatTypeStruct, treeview_stats);
                }
            }
        }
        else if(statisticType == Constants.TypeJumpsSimpleWithTC)
        {
            if(statisticApplyTo.Length == 0) {
                LogB.Information("WithTC-ret");
                return false;
            }

            if(statisticSubType == Constants.DjIndexFormula)
            {
                if(graph)
                    myStat = new GraphDjIndex (myStatTypeStruct);
                            //heightPreferred is not used, check this
                else
                    myStat = new StatDjIndex(myStatTypeStruct, treeview_stats);
                            //heightPreferred is not used, check this

            } else if(statisticSubType == Constants.QIndexFormula)
            {
                if(graph)
                    myStat = new GraphDjQ (myStatTypeStruct);
                            //heightPreferred is not used, check this
                else
                    myStat = new StatDjQ(myStatTypeStruct, treeview_stats);
                            //heightPreferred is not used, check this

            } else if(statisticSubType == Constants.DjPowerFormula)
            {
                if(graph)
                    myStat = new GraphDjPower (myStatTypeStruct);
                            //heightPreferred is not used, check this
                else
                    myStat = new StatDjPower(myStatTypeStruct, treeview_stats);
                            //heightPreferred is not used, check this
            }
        }
        else if(statisticType == Constants.TypeJumpsReactive) {
            if(statisticSubType == Catalog.GetString("Average Index"))
            {
                if(graph)
                    myStat = new GraphRjIndex (myStatTypeStruct);
                else
                    myStat = new StatRjIndex(myStatTypeStruct, treeview_stats);
            }
            else if(statisticSubType == Constants.RJPotencyBoscoFormula)
            {
                if(graph)
                    myStat = new GraphRjPotencyBosco (myStatTypeStruct);
                else
                    myStat = new StatRjPotencyBosco(myStatTypeStruct, treeview_stats);
            }
            else if(statisticSubType == Catalog.GetString("Evolution"))
            {
                if(graph)
                    myStat = new GraphRjEvolution (myStatTypeStruct, evolution_mark_consecutives);
                else
                    myStat = new StatRjEvolution(myStatTypeStruct, evolution_mark_consecutives, treeview_stats);
            }
            else if(statisticSubType == Constants.RJAVGSDRjIndexName)
            {
                if(graph)
                    myStat = new GraphRjAVGSD(myStatTypeStruct, Constants.RjIndexName);
                else
                    myStat = new StatRjAVGSD(myStatTypeStruct, treeview_stats, Constants.RjIndexName);
            }
            else if(statisticSubType == Constants.RJAVGSDQIndexName)
            {
                if(graph)
                    myStat = new GraphRjAVGSD(myStatTypeStruct, Constants.QIndexName);
                else
                    myStat = new StatRjAVGSD(myStatTypeStruct, treeview_stats, Constants.QIndexName);
            }
        }
        else if(statisticType == Constants.TypeRunsSimple)
        {
            if(statisticApplyTo.Length == 0) {
                LogB.Information("Simple-ret");
                return false;
            }

            if(graph)
                myStat = new GraphRunSimple (myStatTypeStruct);
            else
                myStat = new StatRunSimple (myStatTypeStruct, treeview_stats);
        }
        else if(statisticType == Constants.TypeRunsIntervallic)
        {
            if(statisticApplyTo.Length == 0) {
                LogB.Information("Simple-ret");
                return false;
            }

            if(graph)
                myStat = new GraphRunIntervallic (myStatTypeStruct, evolution_mark_consecutives);
            else
                myStat = new StatRunIntervallic (myStatTypeStruct,
                        evolution_mark_consecutives, treeview_stats);
        }

        myStat.FakeButtonRowCheckedUnchecked.Clicked +=
            new EventHandler(on_fake_button_row_checked_clicked);
        myStat.FakeButtonRowsSelected.Clicked +=
            new EventHandler(on_fake_button_rows_selected_clicked);
        myStat.FakeButtonNoRowsSelected.Clicked +=
            new EventHandler(on_fake_button_no_rows_selected_clicked);

        myStat.PrepareData();

        if(toReport) {
            if(graph) {
                bool notEmpty = myStat.CreateGraphR(fileName, false, statCount); //dont' show
                if(notEmpty) { linkImage(fileName); }
            } else {
                writer.WriteLine(myStat.ReportString());
            }
        } else {
            if(graph) {
                //myStat.CreateGraph();
                myStat.CreateGraphR(Constants.FileNameRGraph, true, -1); //show
            }
        }

        //if we just made a graph, store is not made,
        //and we cannot change the Male/female visualizations in the combo
        //with this we can assign a store to the graph (we assign the store of the last stat (not graph)
        if(! toReport) {
            if(! graph)
                lastStore = myStat.Store;
            else {
                myStat.Store = lastStore;
                myStat.MarkedRows = markedRows;
            }
        }

        return true;
    }

Usage Example

Exemplo n.º 1
0
    private void on_button_graph_clicked(object o, EventArgs args)
    {
        if (selected)
        {
            TreeModel model;
            TreeIter  iter1;

            if (treeview1.Selection.GetSelected(out model, out iter1))
            {
                string    str     = getRow(iter1);
                string [] statRow = str.ToString().Split(new char[] { '\t' });

                string subType;
                int    rj_evolution_mark_consecutives = report.GetRjEvolutionMarkConsecutives(statRow[1], out subType);

                ArrayList sendSelectedSessions = report.GetSelectedSessions(statRow[3]);

                Gtk.TreeView treeviewFake = new Gtk.TreeView();                 //not needed for graph

                bool showSex = Util.StringToBool(statRow[5]);

                int limit          = -1;
                int statsJumpsType = report.GetStatsJumpTypeAndLimit(statRow[4], out limit);

                ArrayList arrayListMarkedRows = Util.StringToArrayList(statRow[6], ':');

                GraphROptions graphROptions = new GraphROptions(statRow[7]);

                StatType myStatType = new StatType(
                    statRow[0],                                         //statisticType
                    subType,
                    statRow[2],                                         //statisticApplyTo,
                    treeviewFake,
                    sendSelectedSessions,
                    showSex,
                    statsJumpsType,
                    limit,
                    arrayListMarkedRows,
                    rj_evolution_mark_consecutives,
                    graphROptions,
                    true,                               //graph
                    false,                              //always false in this class
                    report.preferences
                    );
                myStatType.ChooseStat();
            }
        }
    }
All Usage Examples Of StatType::ChooseStat