Term* TermBucket::find(string term) { if (!root) return NULL; Term* curr = root; if (curr->get_name().compare(term) == 0) return curr; while (curr->get_next()) { curr = curr->get_next(); if (curr->get_name().compare(term) == 0) return curr; } return NULL; }
bool TermBucket::has_word(string term) { if (!root) return false; // Iterate through the linked list at this bucket, // checking each word for a match. Term* curr = root; if (curr->get_name().compare(term) == 0) return true; while (curr->get_next()) { curr = curr->get_next(); if (curr->get_name().compare(term) == 0) return true; } // By this point, it's checked every term (with no matches), // so return false. return false; }