setMatch method

bool setMatch(
  1. int index,
  2. bool matchesHead,
  3. bool matchesPt1
)

Implementation

bool setMatch(int index, bool matchesHead, bool matchesPt1) {
  // return true if we've matched twice
  next_match.index = index;
  next_match.matches_head = matchesHead;
  next_match.matches_pt1 = matchesPt1;

  if (next_match == first_match) {
    next_match = second_match;
    return false;
  }

  next_match = null;

  return true; // we've matched twice, we're done here
}