private List <TrailGroupOS> GenGroups(List <TrailOS_ST> trials, int[] arrangement) { List <TrailGroupOS> retval = new List <TrailGroupOS>(); int totalCount = 0; bool broken = false; for (int i = 0; i < arrangement.Length; i++) { TrailGroupOS group = new TrailGroupOS(); for (int j = 0; j < arrangement[i]; j++) { if (totalCount < trials.Count) { group.mTrails.Add(trials[totalCount]); } else { broken = true; break; } totalCount++; } if (broken) { break; } retval.Add(group); } return(retval); }
private void readFixedFromFile(string path, ref List <TrailGroupOS> groups, int[] scheme, int begFromLine) { TabFetcher fet = new TabFetcher(path, "\\t"); fet.Open(); for (int k = 0; k < begFromLine; k++) { fet.GetLineBy(); //skip lines } groups = new List <TrailGroupOS>(); //practise for (int i = 0; i < scheme.Length; i++) { TrailGroupOS group = new TrailGroupOS(); for (int j = 0; j < scheme[i]; j++) { List <String> line = fet.GetLineBy(); TrailOS_ST st = new TrailOS_ST(); st.equation = line[1]; st.result = line[2]; if (Int32.Parse(line[3]) == 1) { st.correctness = true; } else { st.correctness = false; } st.memTarget = line[4]; group.mTrails.Add(st); } groups.Add(group); } fet.Close(); }