private void FncSynthetic(List <ABC> des, List <ABC> predic) { const double ACCURACY = 0.8; int l = des.Count; Dictionary <string, int[]>[] dicKEY = new Dictionary <string, int[]> [des.Count]; for (int i = 0; i < l; i++) { dicKEY[i] = new Dictionary <string, int[]>(); for (int j = 0; j < predic.Count; j++) { dicKEY[i].Add(predic[j].KEY, new int[100]); } } for (int i = 0; i < l; i++) { ABC d = des[i]; ABC[] range = d.Clone(ACCURACY); predic.Where(p => p.AverageSquare[0] < range[0].AverageSquare[0] && p.AverageSquare[0] > range[1].AverageSquare[0]).ToList().ForEach(f => dicKEY[i][f.KEY][0]++); predic.Where(p => p.AverageSquare[1] < range[0].AverageSquare[1] && p.AverageSquare[1] > range[1].AverageSquare[1]).ToList().ForEach(f => dicKEY[i][f.KEY][1]++); predic.Where(p => p.AverageSquare[2] < range[0].AverageSquare[2] && p.AverageSquare[2] > range[1].AverageSquare[2]).ToList().ForEach(f => dicKEY[i][f.KEY][2]++); predic.Where(p => p.ProportionSquare <range[0].ProportionSquare && p.ProportionSquare> range[1].ProportionSquare).ToList().ForEach(f => dicKEY[i][f.KEY][3]++); predic.Where(p => p.Margin[0][0] < range[0].Margin[0][0] && p.Margin[0][0] > range[1].Margin[0][0] && p.Margin[0][1] < range[0].Margin[0][1] && p.Margin[0][1] > range[1].Margin[0][1]).ToList().ForEach(f => dicKEY[i][f.KEY][10]++); predic.Where(p => p.Margin[1][0] < range[0].Margin[1][0] && p.Margin[1][0] > range[1].Margin[1][0] && p.Margin[1][1] < range[0].Margin[1][1] && p.Margin[1][1] > range[1].Margin[1][1]).ToList().ForEach(f => dicKEY[i][f.KEY][11]++); predic.Where(p => p.Margin[2][0] < range[0].Margin[2][0] && p.Margin[2][0] > range[1].Margin[2][0] && p.Margin[2][1] < range[0].Margin[2][1] && p.Margin[2][1] > range[1].Margin[2][1]).ToList().ForEach(f => dicKEY[i][f.KEY][12]++); predic.Where(p => p.Margin[3][0] < range[0].Margin[3][0] && p.Margin[3][0] > range[1].Margin[3][0] && p.Margin[3][1] < range[0].Margin[3][1] && p.Margin[3][1] > range[1].Margin[3][1]).ToList().ForEach(f => dicKEY[i][f.KEY][13]++); predic.Where(p => p.Margin[4][0] < range[0].Margin[4][0] && p.Margin[4][0] > range[1].Margin[4][0] && p.Margin[4][1] < range[0].Margin[4][1] && p.Margin[4][1] > range[1].Margin[4][1]).ToList().ForEach(f => dicKEY[i][f.KEY][14]++); predic.Where(p => p.Margin[5][0] < range[0].Margin[5][0] && p.Margin[5][0] > range[1].Margin[5][0] && p.Margin[5][1] < range[0].Margin[5][1] && p.Margin[5][1] > range[1].Margin[5][1]).ToList().ForEach(f => dicKEY[i][f.KEY][15]++); predic.Where(p => p.Margin[6][0] < range[0].Margin[6][0] && p.Margin[6][0] > range[1].Margin[6][0] && p.Margin[6][1] < range[0].Margin[6][1] && p.Margin[6][1] > range[1].Margin[6][1]).ToList().ForEach(f => dicKEY[i][f.KEY][16]++); predic.Where(p => p.Margin[7][0] < range[0].Margin[7][0] && p.Margin[7][0] > range[1].Margin[7][0] && p.Margin[7][1] < range[0].Margin[7][1] && p.Margin[7][1] > range[1].Margin[7][1]).ToList().ForEach(f => dicKEY[i][f.KEY][17]++); predic.Where(p => p.Fragment.Any(q => d.Fragment.Any(r => r == q))).ToList().ForEach(f => dicKEY[i][f.KEY][31]++); predic.Where(p => { int ccc = 0; int same = -1; for (int im = 0; im < p.Fragment.Length; im++) { //exclude dupplicate if (p.Fragment[im] != same && d.Fragment.Contains(p.Fragment[im])) { ccc++; same = p.Fragment[im]; } } return(ccc >= 2); }).ToList().ForEach(f => dicKEY[i][f.KEY][32]++); } List <string> listS = new List <string>(); for (int i = 0; i < l; i++) { var items = from pair in dicKEY[i] where pair.Value.Sum() > 0 orderby pair.Value[32] descending, pair.Value[31] descending, pair.Value[0] + pair.Value[1] + pair.Value[3] descending, pair.Value.Sum() descending select pair; List <string> listF = new List <string>(); foreach (KeyValuePair <string, int[]> pair in items) { listF.Add(String.Format("{0},{1}", pair.Key, pair.Value.Sum())); } listS.Add(String.Join(":", listF)); } string mes = String.Join("\n", listS); Clipboard.SetText(mes); MessageBox.Show(mes); }