Esempio n. 1
0
        //LOAD-----------------------------------------------------------------

        public void loadSimulation(string displayFileName)
        {
            //DELETE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
            Console.WriteLine("LOAD SIMULATION");
            //DELETE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

            //INITIALIZE ASSOCIATION
            this.simulationDirector = new SimulationDirector(saveLoadDirector.loadSimulation(displayFileName));

            //UPDATE STATE
            stateDirector.setScheduleAndRatingsLoadedState(true);

            //INITIALIZE SETTINGS
            //(must import data before loading settings)
            this.settingsDirector = new SettingsDirector(saveLoadDirector.GetSettings());

            //INITIALIZE SIMULATION PROBABILITIES
            //(must load settings before initializing simulation probabilities)
            simulationDirector.initializeSimulationProbabilities(settingsDirector);

            //SET STATES
            stateDirector.setStates(simulationDirector.getCurrentSimulationDate(),
                                    saveLoadDirector.checkForSaveFolder(), saveLoadDirector.checkIfSimulationSaves());

            //UPDATE ASSOCIATION DATA
            dataDirector.updateDataDirector(settingsDirector);

            //DELETE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
            Console.WriteLine("END LOAD SIMULATION");
            //DELETE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        }
Esempio n. 2
0
        } //END

        //---------------------------------------------------------------------
        //---------------------------------------------------------------------
        //TOURNAMENT SELECTION-------------------------------------------------
        //---------------------------------------------------------------------
        //---------------------------------------------------------------------

        public void setOverallChampRankingsTeamIndexes(SimulationDirector simulationDirector)
        {
            tournamentContainer.setLastUpdatedDate(simulationDirector.getCurrentSimulationDate());

            setConferenceChampIndexes(simulationDirector);

            setChampTournRankingsTeamIndexes(simulationDirector.getTeams());
        } //END
Esempio n. 3
0
        private bool disposedValue = false; // To detect redundant calls

        public Director()
        {
            //IF SAVE FOLDER
            //CHECK FOR SCHEDULE AND RATINGS
            //ELSE SET STATES
            if (saveLoadDirector.checkForSaveFolder())
            {
                //IF SCHEDULE AND RATINGS
                //LOAD SCHEDULE AND RATINGS
                //ELSE SET STATES
                if (saveLoadDirector.containsScheduleFile() && saveLoadDirector.containsRatingsFile())
                {
                    //INITIALIZE ASSOCIATION
                    this.simulationDirector = new SimulationDirector(
                        saveLoadDirector.loadRatings(
                            saveLoadDirector.loadSchedules(simulationDirector)));

                    //UPDATE STATE
                    stateDirector.setScheduleAndRatingsLoadedState(true);

                    //INITIALIZE SETTINGS
                    //(must import data before loading settings)
                    this.settingsDirector = new SettingsDirector(saveLoadDirector.GetSettings());

                    //INITIALIZE SIMULATION PROBABILITIES
                    //(must load settings before initializing simulation probabilities)
                    simulationDirector.initializeSimulationProbabilities(settingsDirector);

                    //SET STATES
                    stateDirector.setStates(simulationDirector.getCurrentSimulationDate(),
                                            saveLoadDirector.checkForSaveFolder(), saveLoadDirector.checkIfSimulationSaves());

                    //UPDATE ASSOCIATION DATA
                    dataDirector.updateDataDirector(settingsDirector);
                }
                else
                {
                    //INITIALIZE STATES
                    stateDirector.setStates(simulationDirector.getCurrentSimulationDate(),
                                            saveLoadDirector.checkForSaveFolder(), saveLoadDirector.checkIfSimulationSaves());
                }//END IF
            }
            else
            {
                //INITIALIZE STATES
                stateDirector.setStates(simulationDirector.getCurrentSimulationDate(),
                                        saveLoadDirector.checkForSaveFolder(), saveLoadDirector.checkIfSimulationSaves());
            } //END IF
        }     //END
Esempio n. 4
0
        }     //END

        //---------------------------------------------------------------------

        public void setConferenceChampIndexes(SimulationDirector simulationDirector)
        {
            //FOR ALL CONFERENCES
            for (int conferenceIndex = 0; conferenceIndex < appResources.getLengthOfConferenceNames(); conferenceIndex++)
            {
                //CHECK IF CONFERENCE TOURNAMENT CHAMPION
                //ADD CHAMPION TO TOURNAMENT
                //ELSE ADD CONFERENCE LEADER
                if (simulationDirector.getConfTournChampSet(conferenceIndex))
                {
                    tournamentContainer.set32ConfChampsIndexes(conferenceIndex, simulationDirector.getConfTournChampTeamIndex(conferenceIndex));
                }
                else
                {
                    setConferenceChampIndex(simulationDirector.getTeams(), conferenceIndex);
                } //END IF
            }     //END FOR
        }         //END
Esempio n. 5
0
        } //END

        private void getChampTournListDataTable(SimulationDirector simulationDirector, Boolean projected)
        {
            int[] arrayIntRankingsOrderTeamIndexes = new int[appResources.getLengthOfTeamNames()];

            //IF RANKINGS NOT UPDATED
            //UPDATE RANKINGS
            if (selectionAndOrder.getRankingsUpdated() == false)
            {
                selectionAndOrder.updateRankings(simulationDirector.getTeams());
            } //END IF

            //IF TOURNAMENT LIST NOT UPDATED
            //FILL TOURNAMENT LIST
            if (boolchampTournListUpdated == false)
            {
                //ROW VARIABLE
                DataRow row;

                //TEAM INDEXES IN ORDER OF RANK
                if (!selectionAndOrder.getContainerUpdated(simulationDirector.getCurrentSimulationDate()))
                {
                    selectionAndOrder.setOverallChampRankingsTeamIndexes(simulationDirector);
                }//END IF

                Array.Copy(
                    selectionAndOrder.getTournamentContainer().getRanked353ChampTournReturnIndexes(),
                    arrayIntRankingsOrderTeamIndexes,
                    arrayIntRankingsOrderTeamIndexes.Length);

                //CLEAR DATA TABLE
                champTournListDataTable.Rows.Clear();

                //ADD TOURNAMENT TEAMS FROM GLOBALS

                for (int tournIndex = 0; tournIndex < selectionAndOrder.getTournamentContainer().getRanked68ChampTournIndexes().Length; tournIndex++)
                {
                    //MAKE ROW
                    row = champTournListDataTable.NewRow();

                    //POPULATE ROWS
                    row[0] = selectionAndOrder.getTournamentContainer().getRanked68ChampTournSeeds()[tournIndex];
                    row[1] = selectionAndOrder.getTournamentContainer().getRanked68ChampTournRegions()[tournIndex];

                    //ASSIGN BID TYPE
                    //IF CONFERENCE CHAMPION
                    //ELSE IF PLAY IN
                    //ELSE AT LARGE
                    if (Array.IndexOf(
                            selectionAndOrder.getTournamentContainer().get32ConfChampsIndexes(),
                            selectionAndOrder.getTournamentContainer().getRanked68ChampTournIndexes()[tournIndex])
                        > -1)
                    {
                        //IF PLAY IN
                        //ELSE CONFERENCE CHAMP
                        if (Array.IndexOf(
                                selectionAndOrder.getTournamentContainer().get8PlayInIndexes(),
                                selectionAndOrder.getTournamentContainer().getRanked68ChampTournIndexes()[tournIndex])
                            > -1)
                        {
                            row[2] = "Play In CC";
                        }
                        else
                        {
                            row[2] = "Conf Champ";
                        }//END IF
                    }
                    else if (Array.IndexOf(
                                 selectionAndOrder.getTournamentContainer().get8PlayInIndexes(),
                                 selectionAndOrder.getTournamentContainer().getRanked68ChampTournIndexes()[tournIndex])
                             > -1)
                    {
                        row[2] = "Play In AL";
                    }
                    else
                    {
                        row[2] = "At Large";
                    }//END IF

                    row[3] = simulationDirector.getTeamNameDisplay(selectionAndOrder.getTournamentContainer().getRanked68ChampTournIndexes()[tournIndex]);
                    row[4] = simulationDirector.getConferenceNameDisplay(selectionAndOrder.getTournamentContainer().getRanked68ChampTournIndexes()[tournIndex]);
                    row[5] = simulationDirector.getWins(selectionAndOrder.getTournamentContainer().getRanked68ChampTournIndexes()[tournIndex]);
                    row[6] = simulationDirector.getLosses(selectionAndOrder.getTournamentContainer().getRanked68ChampTournIndexes()[tournIndex]);
                    row[7] = selectionAndOrder.getRankings()[selectionAndOrder.getTournamentContainer().getRanked68ChampTournIndexes()[tournIndex]];

                    //ADD ROW TO DATA TABLE
                    champTournListDataTable.Rows.Add(row);
                }//END FOR

                //IF PROJECTED ADD REST FROM RETURNED ARRAY

                if (projected)
                {
                    for (int teamIndex = selectionAndOrder.getTournamentContainer().getRanked68ChampTournIndexes().Length; teamIndex < arrayIntRankingsOrderTeamIndexes.Length; teamIndex++)
                    {
                        //MAKE ROW
                        row = champTournListDataTable.NewRow();

                        //POPULATE ROWS
                        row[3] = simulationDirector.getTeamNameDisplay(arrayIntRankingsOrderTeamIndexes[teamIndex]);
                        row[4] = simulationDirector.getConferenceNameDisplay(arrayIntRankingsOrderTeamIndexes[teamIndex]);
                        row[5] = simulationDirector.getWins(arrayIntRankingsOrderTeamIndexes[teamIndex]);
                        row[6] = simulationDirector.getLosses(arrayIntRankingsOrderTeamIndexes[teamIndex]);
                        row[7] = selectionAndOrder.getRankings()[arrayIntRankingsOrderTeamIndexes[teamIndex]];

                        //ADD ROW TO DATA TABLE
                        champTournListDataTable.Rows.Add(row);
                    } //END FOR
                }     //END IF
            }         //END IF

            //SET UPDATED TO TRUE
            boolchampTournListUpdated = true;
        } //END
Esempio n. 6
0
        } //END

        //CHAMPIONSHIP TOURNAMENT LIST SAVE DATA TABLE-------------------------

        public void fillChampTournListDataTable(SimulationDirector simulationDirector)
        {
            getChampTournListDataTable(simulationDirector, false);
        } //END