bool DoubleLinkList::dequeue() { Customer* delPtr; Customer* temp = NULL; bool status = false; delPtr = RevListPointer; if (delPtr != NULL) { if (FwdListPointer == delPtr) FwdListPointer = FwdListPointer->getNextPointer(); else { temp = delPtr->getPriorPointer(); temp->putNextPointer(delPtr->getNextPointer()); } if (RevListPointer == delPtr) RevListPointer = RevListPointer->getPriorPointer(); else { temp = delPtr->getNextPointer(); temp->putPriorPointer(delPtr->getPriorPointer()); } delete delPtr; status = true; } return status; }
void DoubleLinkList::getListReverse(int minuteNum) { Customer* temp; Customer* temp2; int totalWaitTime; // temp storage for cumulative wait time ahead if (RevListPointer == NULL) cout << minuteNum << "\t\t None" << endl; for (temp = RevListPointer; temp != NULL; temp = temp->getPriorPointer()) { cout << minuteNum << "\t\t\t"; cout << temp->getCustomerNumber() << "\t\t\t\t"; cout << temp->getEntryMin() << "\t\t\t\t\t"; cout << temp->getTimeToServe() << "\t\t\t\t\t"; temp2 = RevListPointer; totalWaitTime = 0; for(; temp2 != temp; temp2 = temp2->getPriorPointer()) { // add up all times for customers in front of current customer totalWaitTime += temp2->getTimeToServe(); } cout << totalWaitTime << "\t\t\t\t\t"; cout << temp->getTimeToServe()+totalWaitTime << endl; } cout << "---------------------------------------------------------------------------------------------------------------------" << endl; }