public RowColumns(int row, MatchList matches1, MatchList matches2) { Row = row; Matches = new MatchList(); if (matches1 == null) { if (matches2 != null) { Matches.AddRange(matches2); } } else if (matches2 == null) { Matches.AddRange(matches1); } else { int index1 = 0; int index2 = 0; while (true) { if (matches1[index1].StartCol < matches2[index2].StartCol) { Matches.Add(matches1[index1++]); if (index1 >= matches1.Count) { Matches.AddRange(matches2, index2); break; } } else if (matches1[index1].StartCol > matches2[index2].StartCol) { Matches.Add(matches2[index2++]); if (index2 >= matches2.Count) { Matches.AddRange(matches1, index1); break; } } else if (matches1[index1].EndCol >= matches2[index2].EndCol) { Matches.Add(matches1[index1++]); index2++; if (index1 >= matches1.Count) { Matches.AddRange(matches2, index2); break; } if (index2 >= matches2.Count) { Matches.AddRange(matches1, index1); break; } } else //if (matches1[index1].EndCol < matches2[index2].EndCol) { index1++; Matches.Add(matches2[index2++]); if (index1 >= matches1.Count) { Matches.AddRange(matches2, index2); break; } if (index2 >= matches2.Count) { Matches.AddRange(matches1, index1); break; } } } } }
public void AddTilePosition(MatchInfo info) { matchlist.AddRange(info.matchlist); }