recordPatternInReverse static method

void recordPatternInReverse(
  1. BitArray row,
  2. int start,
  3. List<int> counters
)

Implementation

static void recordPatternInReverse(
  BitArray row,
  int start,
  List<int> counters,
) {
  // This could be more efficient I guess
  int numTransitionsLeft = counters.length;
  bool last = row.get(start);
  while (start > 0 && numTransitionsLeft >= 0) {
    if (row.get(--start) != last) {
      numTransitionsLeft--;
      last = !last;
    }
  }
  if (numTransitionsLeft >= 0) {
    throw NotFoundException.instance;
  }
  recordPattern(row, start + 1, counters);
}