// 构造函数 public Table(PersonStream ps) { reallytimeUpperbound = new double[7] { 2.0f, 1.0f, 2.0f, 2.0f, 1.5f, 2.0f, 4.0f }; timeUpperbound = new int[7] { 4, 3, 3, 3, 3, 2, 4 }; weekendPersonbound = new int[3] { 2, 2, 4 }; weekendUpperbound = new double[3] { 5.0f, 5.5f, 4.0f }; // 对每天 for (int i = 0; i < 5; i++) { iTable.Add(new List <Cell>()); // 对每个时段 for (int j = 0; j < 7; j++) { Cell p1 = new Cell((TimePeriod)(i * 7 + j)); p1.upperbound = timeUpperbound[j]; // 找可填入的人 for (int k = 0; k < ps.pstream.Count; k++) { for (int m = 0; m < ps.pstream[k].validTimePeriod.Count; m++) { if (ps.pstream[k].validTimePeriod[m] == p1.cid) { p1.candidate.Add(ps.pstream[k]); break; } } } iTable[i].Add(p1); } } }
// 构造函数 public Table(PersonStream ps) { reallytimeUpperbound = new double[7] { 2.0f, 1.0f, 2.0f, 2.0f, 1.5f, 2.0f, 4.0f }; timeUpperbound = new int[7] { 4, 3, 3, 3, 3, 2, 4 }; weekendPersonbound = new int[3] { 2, 2, 4 }; weekendUpperbound = new double[3] { 5.0f, 5.5f, 4.0f }; // 对每天 for (int i = 0; i < 5; i++) { iTable.Add(new List<Cell>()); // 对每个时段 for (int j = 0; j < 7; j++) { Cell p1 = new Cell((TimePeriod)(i * 7 + j)); p1.upperbound = timeUpperbound[j]; // 找可填入的人 for (int k = 0; k < ps.pstream.Count; k++) { for (int m = 0; m < ps.pstream[k].validTimePeriod.Count; m++) { if (ps.pstream[k].validTimePeriod[m] == p1.cid) { p1.candidate.Add(ps.pstream[k]); break; } } } iTable[i].Add(p1); } } }
// 构造函数 private Core() { myStream = new PersonStream(); }