Пример #1
0
        private void FillCompaniesFunctionalities()
        {
            int           numberOfCompanies = 3;
            List <String> companyNames      = new List <String> {
                "WordPress", "Joomla", "Drupal"
            };

            for (int i = 0; i < numberOfCompanies; i++)
            {
                mCompanies.Add(new Company());
                mCompanies[i].Name = companyNames[i];
            }
            foreach (SimulationData data in (List <SimulationData>)dataGridView1.DataSource)
            {
                Funcionality func = new Funcionality(data.Functionality, data.MarketReaction);

                mCompanies[0].addRequiredFuncionalityWithCost(func, data.WordPressCost);
                mCompanies[1].addRequiredFuncionalityWithCost(func, data.JoomlaCost);
                mCompanies[2].addRequiredFuncionalityWithCost(func, data.DrupalCost);

                mFunctionalities.Add(func);
            }

            AddDelayTime();
        }
        public void finishDevelopFuncionality()
        {
            ImplementedFunctionalites.Add(mCurrentlyDevelopedFuncionality);

            mCurrentlyDevelopedFuncionality = null;
            TimeToDevelopNextFunctionality  = int.MaxValue;

            State = MissingFunctionalities.Count == 0 ? CompanyState.DoneAllFunctionalities : CompanyState.Idle;

            if (State == CompanyState.DoneAllFunctionalities)
            {
                OrderOfFunctionalitiesImplementationWithCosts = ImplementedFunctionalites.Select(func => new Tuple <Funcionality, int>(func, mFunctionalities[func])).ToList();
            }
        }
Пример #3
0
        private void AddDelayTime()
        {
            mCompanies[0].TimeToDevelopNextFunctionality = (int)wordPressNumericUpDown.Value;
            mCompanies[1].TimeToDevelopNextFunctionality = (int)joomlaNumericUpDown.Value;
            mCompanies[2].TimeToDevelopNextFunctionality = (int)drupalNumericUpDown.Value;
            var delayFunc = new Funcionality("Delay", "stagnation");

            foreach (var company in mCompanies)
            {
                if (company.TimeToDevelopNextFunctionality > 0)
                {
                    company.mFunctionalities.Add(delayFunc, company.TimeToDevelopNextFunctionality);
                    company.developFunctionality(delayFunc);
                    company.State = Company.CompanyState.ProccessingFunctionality;
                }
            }
        }
        private void Step3i(Company company)
        {
            Console.Out.WriteLine("Step3i");
            IEnumerable <Company> otherCompanies          = mAllComapnies.Where(c => c != company);
            List <Funcionality>   priorityFunctionalities = new List <Funcionality>();

            foreach (var otherCompany in otherCompanies)
            {
                priorityFunctionalities.AddRange(otherCompany.ImplementedFunctionalites.Except(company.ImplementedFunctionalites));
            }

            if (priorityFunctionalities.Count != 0)
            {
                priorityFunctionalities.Sort();
            }

            priorityFunctionalities = priorityFunctionalities.Distinct().ToList();

            bool leader = priorityFunctionalities.Count == 0;
            List <Funcionality> missingFunctionalities = leader ?  company.MissingFunctionalities : priorityFunctionalities;

            if (!leader)
            {
                missingFunctionalities = ChooseBestFunctionalities(missingFunctionalities, company);
            }

            var functionalitesWithCost = missingFunctionalities
                                         .Select(func => new { Functionality = func, Cost = company.functionalityCost(func) });

            Funcionality functionalityToDevelop = null;

            functionalityToDevelop = functionalitesWithCost
                                     .First(pair => pair.Cost == functionalitesWithCost.Min(internalPair => internalPair.Cost)).Functionality;

            company.developFunctionality(functionalityToDevelop);
        }
 public void developFunctionality(Funcionality func)
 {
     mCurrentlyDevelopedFuncionality = func;
     TimeToDevelopNextFunctionality  = mFunctionalities[func];
     State = CompanyState.ProccessingFunctionality;
 }
 public int functionalityCost(Funcionality func)
 {
     return(mFunctionalities[func]);
 }
 public void addRequiredFuncionalityWithCost(Funcionality func, int functionalityCost)
 {
     mFunctionalities.Add(func, functionalityCost);
 }