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;
}
}
}