示例#1
0
文件: main.cpp 项目: johnsliao/CS-341
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;
}
示例#2
0
文件: main.cpp 项目: johnsliao/CS-341
bool DoubleLinkList::putCustomer (int s, int e, int o) {
    bool x = false;
    Customer* temp1;
    Customer A(o);

    temp1 = A.putOneCustomer (FwdListPointer, s, e, o);

    if (temp1 != NULL)
    {   if (FwdListPointer == NULL && RevListPointer == NULL)
            FwdListPointer = RevListPointer = temp1;
        else
        {
            FwdListPointer->putPriorPointer (temp1);
            FwdListPointer = temp1;
        }
        x = true;
    }
    return x;
}