Dynamic_Games.coop.backend.Controller.getPartialResult C# (CSharp) Method

getPartialResult() public method

public getPartialResult ( ) : PartialResult
return Dynamic_Games.Coop.Models.PartialResult
        public PartialResult getPartialResult()
        {
            List<Coalition> coalitions = calculator.getPartialResult();
            if (coalitions != null) // if there was result yet
            {
                List<string> coals = new List<string>();
                List<int> profits = new List<int>();

                foreach (var coalition in coalitions)
                {
                    coals.Add(coalition.ToString() + "    ");
                    profits.Add(Convert.ToInt32(coalition.getMaximumValue()));
                }

                PartialResult result = new PartialResult();
                result.Coalitions = coals;
                result.Profits = profits;
                result.End = false;
                return result;
            }
            else // if there was no result
            {
                if (!calculatorThread.IsAlive){ //if thread is done
                    PartialResult result = new PartialResult();
                    result.End = true;
                    return result;
                }
                else
                {
                    return null;
                }
            }
        }