public void MatchRulesToColumns() { RuleToColumnMatches.Clear(); foreach (var rule in ClassRules) { List <int> columnMatches = new List <int>(); int maxCols = ValidTicketColumns[0].Count; for (int iCol = 0; iCol < maxCols; iCol++) { bool valid = true; foreach (var vtc in ValidTicketColumns) { //vtc[iCol] if (!(rule.Value.Item1 <= vtc[iCol] && vtc[iCol] <= rule.Value.Item2) && !(rule.Value.Item3 <= vtc[iCol] && vtc[iCol] <= rule.Value.Item4)) { // column not valid in this rule valid = false; break; } } if (valid) { columnMatches.Add(iCol); } } RuleToColumnMatches.Add(rule.Key, columnMatches); } }
public List <int> ListDepartureColumns() { var list = RuleToColumnMatches.Where(kv => kv.Key.Contains("departure")).Select(kv => kv.Value[0]).ToList(); return(list); }