private void GreateAndSeparateGroupBalances() { foreach (Person person in people) { if (Equals(person, person.PayGroupLeader)) { GroupBalance groupBalance = new GroupBalance(trip, person); var a = groupBalance.Status; switch (groupBalance.Status) { case GroupBalance.BalanceStatus.Debtor: debtorsGroupBalances.Add(groupBalance); break; case GroupBalance.BalanceStatus.Neutral: neutralsGroupBalances.Add(groupBalance); break; case GroupBalance.BalanceStatus.Payer: payersGroupBalances.Add(groupBalance); break; } } } }
private static void SortGroupBalances(List <GroupBalance> groupBalances)//TODO needed test { for (int i = 0; i < groupBalances.Count - 1; ++i) { int maxElementIndex = i;// for (int j = i + 1; j < groupBalances.Count; j++) { if (Math.Abs(groupBalances[j].PayDebtBalance) > Math.Abs(groupBalances[maxElementIndex].PayDebtBalance)) { maxElementIndex = j; } } GroupBalance tempElement = groupBalances[i]; groupBalances[i] = groupBalances[maxElementIndex]; groupBalances[maxElementIndex] = tempElement; } }