public RankCount(RankCount myRankCount) { this.name = myRankCount.name; timeHappen = new int[AllRankCount.GetRankCount()]; for (int i = 0; i < timeHappen.Length; i++) { timeHappen[i] = myRankCount.GetPositionNumber((RankPosition)i); } }
private List<RankCount> SortRankCount() { List<RankCount> newList = new List<RankCount>(); List<RankCount> remainingRankCount = new List<RankCount>(rankCounts); for(int i = 0; i < rankCounts.Count; i++) { RankCount higherRankCount = new RankCount("temp RankCount"); for(int j = 0; j < remainingRankCount.Count; j++) { if(remainingRankCount[j].GetPositionNumber(RankPosition.First) > higherRankCount.GetPositionNumber(RankPosition.First)) { higherRankCount = new RankCount(remainingRankCount[j]); } else if (remainingRankCount[j].GetPositionNumber(RankPosition.First) == higherRankCount.GetPositionNumber(RankPosition.First) && remainingRankCount[j].GetPositionNumber(RankPosition.Second) > higherRankCount.GetPositionNumber(RankPosition.Second)) { higherRankCount = new RankCount(remainingRankCount[j]); } else if (remainingRankCount[j].GetPositionNumber(RankPosition.First) == higherRankCount.GetPositionNumber(RankPosition.First) && remainingRankCount[j].GetPositionNumber(RankPosition.Second) == higherRankCount.GetPositionNumber(RankPosition.Second) && remainingRankCount[j].GetPositionNumber(RankPosition.Third) > higherRankCount.GetPositionNumber(RankPosition.Third)) { higherRankCount = new RankCount(remainingRankCount[j]); } else if (remainingRankCount[j].GetPositionNumber(RankPosition.First) == higherRankCount.GetPositionNumber(RankPosition.First) && remainingRankCount[j].GetPositionNumber(RankPosition.Second) == higherRankCount.GetPositionNumber(RankPosition.Second) && remainingRankCount[j].GetPositionNumber(RankPosition.Third) == higherRankCount.GetPositionNumber(RankPosition.Third) && remainingRankCount[j].GetPositionNumber(RankPosition.Fourth) > higherRankCount.GetPositionNumber(RankPosition.Fourth)) { higherRankCount = new RankCount(remainingRankCount[j]); } else if (remainingRankCount[j].GetPositionNumber(RankPosition.First) == higherRankCount.GetPositionNumber(RankPosition.First) && remainingRankCount[j].GetPositionNumber(RankPosition.Second) == higherRankCount.GetPositionNumber(RankPosition.Second) && remainingRankCount[j].GetPositionNumber(RankPosition.Third) == higherRankCount.GetPositionNumber(RankPosition.Third) && remainingRankCount[j].GetPositionNumber(RankPosition.Fourth) == higherRankCount.GetPositionNumber(RankPosition.Fourth) && remainingRankCount[j].GetPositionNumber(RankPosition.Fifth) > higherRankCount.GetPositionNumber(RankPosition.Fifth)) { higherRankCount = new RankCount(remainingRankCount[j]); } } for (int k = 0; k < remainingRankCount.Count; k++) { if (remainingRankCount[k].name == higherRankCount.name) remainingRankCount.Remove(remainingRankCount[k]); } newList.Add(higherRankCount); } return newList; }