#include "hiterator.h" // author: Owen Astrachan // for cps 100, 11/8/95 template HMapIterator::HMapIterator(Vector *> & list) : myList(list), myChainIndex(0), myNode(0) { } template void HMapIterator::First() { myChainIndex = 0; Advance(); } template bool HMapIterator::IsDone() const { return myChainIndex >= myList.Length(); } template void HMapIterator::Advance() { int len = myList.Length(); while (myChainIndex < len && myList[myChainIndex] == 0) { myChainIndex++; } if (myChainIndex < len) { myNode = myList[myChainIndex]; } else { myNode = 0; } } template void HMapIterator::Next() { if (myNode->next) { myNode = myNode->next; } else { myChainIndex++; Advance(); } } template const Kind & HMapIterator::Current() const { if (! IsDone()) { return myNode->info; } else { cerr << "bad call of current, iterator done" << endl; } } template Kind & HMapIterator::Current() { if (! IsDone()) { return myNode->info; } else { cerr << "bad call of current, iterator done" << endl; } }