[an error occurred while processing this directive]
The advance() function usually just replaces the current entry pointer by the next member of the current entry. However, when this value is null, the advance must proceed to the first entry on the next non-empty hash list of the table. This is accomplished by the private function nextList(). This function is also used to initialize a TableIterator, after first setting its index to -1.
The currentData(), currentKey(), and advance() functions all call more() before doing anything else in order to check their preconditions. If this check fails then the program is terminated with an error message.
parameter: TableIterator iter
increment iter->currentList
while iter->currentList < number of hash lists
if iter->table->hashLists[iter->currentList] is not null
break
increment iter->currentList
parameter: Table tbl allocate a TableIteratorNode with malloc set the table member to tbl set the currentList member to -1 call startNextList with pointer to node as parameter
parameter: TableIterator iter free iter
return iter < number of hash lists
parameter: TableIterator iter
if more(iter) is false
terminate program with precondition violation error message
advance iter->currentEntry to next entry in list
if iter->currentEntry is null
call startNextList with iter as parameter
parameter: TableIterator iter
if more(iter) is false
terminate program with precondition violation error message
return iter->currentEntry->key
parameter: TableIterator iter
if more(iter) is false
terminate program with precondition violation error message
return iter->currentEntry->data