head	1.6;
access;
symbols
	r2_1:1.6
	r2_0:1.6
	r1_1_beta:1.6
	r0_11:1.6;
locks; strict;
comment	@//@;


1.6
date	94.04.27.18.26.09;	author rjj;	state Exp;
branches;
next	1.5;

1.5
date	93.11.14.20.04.31;	author rjj;	state Exp;
branches;
next	1.4;

1.4
date	93.11.14.19.55.29;	author rjj;	state Exp;
branches;
next	1.3;

1.3
date	93.11.11.01.13.42;	author rjj;	state Exp;
branches;
next	1.2;

1.2
date	93.05.26.23.15.49;	author rjj;	state Exp;
branches;
next	1.1;

1.1
date	92.12.16.02.11.21;	author rjj;	state Exp;
branches;
next	;


desc
@Initial version, currently relies on IA_Cell
@


1.6
log
@Changed T operator[](int) const  to operator().
@
text
@// -*- C++ -*-
//      Copyright 1993, Center for Computer Vision and Visualization,
//      University of Florida.  All rights reserved.

#include "Deque.h"

static char IA_Deque_c_rcsid[] = "$Id: Deque.c,v 1.5 1993/11/14 20:04:31 rjj Exp rjj $";

// $Log: Deque.c,v $
//Revision 1.5  1993/11/14  20:04:31  rjj
//Changed 'emptyp()' to 'empty()'.
//
//Revision 1.4  93/11/14  19:55:29  rjj
//Rename forwardp() to forward().
//
//Revision 1.3  1993/11/11  01:13:42  rjj
//Added op== and op!=, squashed some buggs.
//
//Revision 1.2  93/05/26  23:15:49  rjj
//Added copyright notice.
//
//Revision 1.1  92/12/16  02:11:21  rjj
//Initial revision
//


/////////////////////////////////////////////////////////////////////////////
// IA_Deque<T> private and IA_Cell<T> helper functions
/////////////////////////////////////////////////////////////////////////////

template <class T>
void  IA_Deque<T>::unlinkCell(IA_Cell<T>* theCell) {

    (theCell->next())->setPrev(theCell->prev());
    (theCell->prev())->setNext(theCell->next());

    // Ensure that this cell is not pointing to other cells.
    theCell->setNext(theCell);
    theCell->setPrev(theCell);
}


template <class T>
void  IA_Deque<T>::deleteCells() {
    while (!this->empty()) {
	this->delFront();
    }
}


/////////////////////////////////////////////////////////////////////////////
//
// class IA_Deque
//
/////////////////////////////////////////////////////////////////////////////


//================================================================
// Constructors & Destructor
//================================================================

// yielding a copy of the IA_Deque d
// NOTE: this version does not share storage
template <class T>
IA_Deque<T>::IA_Deque(const IA_Deque<T>& d) {

    IA_DequeIter<T> dIter(d);
    T val;

    this->nullDeque();
    while( dIter(val) ) {
	this->insBack(val);
    }
}


template <class T>
IA_Deque<T>::IA_Deque(T *vec, unsigned size) {
    // where size = number of elements in vec

    this->nullDeque();
    for (int i=0; i<size; i++) {
	this->insBack(vec[i]);
    }
}


template <class T>
IA_Deque<T>::IA_Deque(T v0) {
    this->nullDeque();
    this->insFront(v0);
}

template <class T>
IA_Deque<T>::IA_Deque(T v0, T v1) {
    this->nullDeque();
    this->insFront(v1);
    this->insFront(v0);
}


template <class T>
IA_Deque<T>::IA_Deque(T v0, T v1, T v2) {
    this->nullDeque();
    this->insFront(v2);
    this->insFront(v1);
    this->insFront(v0);
}

template <class T>
IA_Deque<T>::IA_Deque(T v0, T v1, T v2, T v3) {
    this->nullDeque();
    this->insFront(v3);
    this->insFront(v2);
    this->insFront(v1);
    this->insFront(v0);
}

template <class T>
IA_Deque<T>::IA_Deque(T v0, T v1, T v2, T v3, T v4) {
    this->nullDeque();
    this->insFront(v4);
    this->insFront(v3);
    this->insFront(v2);
    this->insFront(v1);
    this->insFront(v0);
}


template <class T>
IA_Deque<T>::~IA_Deque() {
    // Our job is to ensure the removal of all of our cells...
    this->deleteCells();
}


//================================================================
// Operators
//================================================================

template <class T>
IA_Deque<T>&  IA_Deque<T>::operator= (const IA_Deque<T>& rhd)
{
    if (*this == rhd) {  // Nothing to do if true
	return *this;
    }

    // We will reuse any storage *this has currently
    IA_Cell<T> *cp = this->front;
    IA_DequeIter<T> rhdIter(rhd);
    T rhdVal;

    while( rhdIter( rhdVal ) ) {
	if (cp != 0) {
	    // A cell already exists, so reuse it
	    cp->setValue(rhdVal);
	    cp = (cp->next() != this->rear) ? cp->next() : 0; // don\'t wrap
	} else {
	    // No more cells exist, so add to end of *this
	    this->insBack(rhdVal);
	}
    }

    // Now we must be sure to reclaim any storage that was not reused
    if (cp != 0) {
	cp = cp->prev();  // Last valid cell to keep.
	while (this->rear != cp) {
	    this->delBack();   // Just get rid of it
	}
    }

    return *this;
}

template <class T>
int  IA_Deque<T>::operator==(const IA_Deque<T>& rhd) const
{
    T  thisValue, rhdValue;
    IA_DequeIter<T> thisIter(*this), rhdIter(rhd);

    // Run down the deques to see if they differ anywhere.
    while( thisIter(thisValue) && rhdIter(rhdValue) ) {
	if (thisValue != rhdValue)
	    return (int) 0;
    }
    // We now know they are the same so far.
    // Make sure one deque is not longer that the other
    if ( thisIter(thisValue) || rhdIter(rhdValue) ) {
	// Mismatched length
	return (int) 0;
    }
    return (int) 1;  // Same length and same values
}


template <class T>
T  IA_Deque<T>::operator() (int n) const {

    if (this->empty()) {
	ia_throw(IA::INVALID_OPERATION, __FILE__, __LINE__);
	return T(0);
    }

    // Should we wrap?  i.e.  n mod (this->length())  ??
    IA_Cell<T> *c = front;

    if (n > 0)
	{for (; n>0; n--) c = c->next();}
    else if (n < 0)
	{for (; n<0; n++) c = c->prev();}

    return c->value();
}

template <class T>
T&  IA_Deque<T>::operator[] (int n) {

    if (this->empty()) {
	ia_throw(IA::INVALID_OPERATION, __FILE__, __LINE__);
	return *(new T);
    }

    // Should we wrap?  i.e.  n mod (this->length())  ??
    IA_Cell<T> *c = front;

    if (n > 0)
	{for (; n>0; n--) c = c->next();}
    else if (n < 0)
	{for (; n<0; n++) c = c->prev();}

    return c->cellValue;
}


//================================================================
// Member functions
//================================================================


template <class T>
int  IA_Deque<T>::empty() const {
    return front == 0;
}


template <class T>
T  IA_Deque<T>::first() const {

    if (this->empty()) {
	ia_throw(IA::INVALID_OPERATION, __FILE__, __LINE__);
	return T(0);
    }

    return this->front->value();
}


template <class T>
T  IA_Deque<T>::last() const {

    if (this->empty()) {
	ia_throw(IA::INVALID_OPERATION, __FILE__, __LINE__);
	return T(0);
    }

    return this->rear->value();
}


template <class T>
unsigned  IA_Deque<T>::length() const {

    if (this->empty()) {
	return 0;
    }
    int CellCount = 0;
    IA_DequeIter<T>  dIter(*this);
    T  val;

    while (dIter(val)) {
	CellCount++;
    }

    return CellCount;
}



//
// Support operations
//

template <class T>
void  IA_Deque<T>::insFront(T val) {

    IA_Cell<T>* newCell = new IA_Cell<T>(val);

    if (this->front == 0) {
	this->rear  = newCell;
    } else {
	newCell->setNext(this->front);    // Point to current front
	newCell->setPrev(this->rear);     // Remember who is last
	this->front->setPrev(newCell);    // #1 now #2
	this->rear->setNext(newCell);
    }
    this->front = newCell;
}


template <class T>
void  IA_Deque<T>::insBack(T val) {

    IA_Cell<T>* newCell = new IA_Cell<T>(val);

    if (this->rear == 0) {
	this->front = newCell;
    } else {
	this->front->setPrev(newCell);  // #1 points to new rear
	this->rear->setNext(newCell);   // last now points to new rear
	newCell->setPrev(this->rear);
	newCell->setNext(this->front);
    }
    this->rear  = newCell;
}


template <class T>
void  IA_Deque<T>::delFront() {
    // When Unlinking the first cell, remember there may be only one...
    if (this->empty()) {
	ia_throw(IA::INVALID_OPERATION, __FILE__, __LINE__);
    } else {
	unlinkCell(this->front);
	delete this->front;

	if (this->front == this->rear) {  // Deleted last cell in deque
	    this->nullDeque();
	} else {                          // At least one more cells left
	    this->front = this->rear->next();
	}
    }
}


template <class T>
void  IA_Deque<T>::delNth(int n) {
    n = n % (this->length());

    IA_Cell<T> *c = this->front->skip(n);
    
    if (c == this->front) {
	this->delFront();
    } else if (c == this->rear) {
	this->delBack();
    } else {
	unlinkCell(c);
	delete c;
    }
}


template <class T>
void  IA_Deque<T>::delValue(const T& val) {
    if ( this->empty() ) {
	ia_throw(IA::INVALID_OPERATION, __FILE__, __LINE__);
    } else {
	IA_Cell<T> *c = this->front;
	while (c != this->rear) {
	    if (c->value() == val) {
		break;
	    } else {
		c = c->next();
	    }
	}

	if (c->value() == val) {
	    if (c == this->front) {
		this->delFront();
	    } else if (c == this->rear) {
		this->delBack();
	    } else {
		unlinkCell(c);
		delete c;
	    }
	} else {
	    // Should we throw here?
	}
    }
}


template <class T>
void  IA_Deque<T>::delBack() {
    // When unlinking the last cell, remember there may be only one...
    if (this->empty()) {
	ia_throw(IA::INVALID_OPERATION, __FILE__, __LINE__);
    } else {
	unlinkCell(this->rear);
	delete this->rear;

	if (this->front == this->rear) {   // Deleted last cell in deque
	    this->nullDeque();
	} else {                           // At least one more cells left
	    this->rear = this->front->prev();
	}
    }
}


template <class T>
void  IA_Deque<T>::reverse(IA_Deque<T>& theResult) {

    if (this->empty()) {
	theResult.deleteCells();  // Now both are empty
	return;
    }

    // We have a potential problem if theResult is us,
    //   but we can use a clever routine if this is the case.
    if (theResult != *this) {
	// could be very clever and try to reuse storage in theResult
	// but for now I will op for the simplist way..
	theResult.deleteCells();

	IA_DequeIter<T> dIter(*this);
	T val;

	while( dIter(val) ) {
	    theResult.insFront(val);
	}
    } else {
	// We can do an in place reverse here !
	IA_Cell<T> *cellToReverse, *cp;
	cellToReverse = this->front;
	while (cellToReverse != this->rear) {
	    cp = cellToReverse->next();
	    cellToReverse->setNext( cellToReverse->prev() );
	    cellToReverse->setPrev( cp );
	    cellToReverse = cp;
	}
	// Don\'t forget to switch the front and rear pointers.
	cp = this->front;
	this->front = this->rear;
	this->rear = cp;
    }
}


template <class T>
void  IA_Deque<T>::sub (int m, int n, IA_Deque<T>& theResult) {

    int dLen = this->length();
    if ( (this->empty()) || (n-m<0) || (dLen <= (n-m)) ) {
	ia_throw(IA::INVALID_OPERATION, __FILE__, __LINE__);
	return;
    }

    IA_Cell<T> *c = this->front->skip(m);   // Start Cell for this job
    if (*this != theResult) {
	// Take the easy way and just reclaim all of theResult\'s storage
	theResult.deleteCells();

	// NOTE:  We use the cell pointers rather than a IA_DequeIter
	//        to allow the wrap around the ends.
	IA_Cell<T> *c = this->front->skip(m);   // Start Cell for this job
	theResult.insFront(c->value());

	for (int i=m; i<n; i++) {
	    c = c->next();
	    theResult.insBack( c->value() );
	}
    } else {
	// Since we are eating at ourself, we need to be a little careful.
	// Set the front pointer correctly and the delete off the back.
	this->front = c;            // Force front pointer
	this->rear = c->prev();     // Force back pointer
	for ( ; dLen > (n-m+1); dLen-- ) {
	    this->delBack();        // Delete unwanted cells
	}
    }
}


//================================================================
// Friend functions
//================================================================

template <class T>
void  concat (const IA_Deque<T>& lhd, const IA_Deque<T>& rhd,
	      IA_Deque<T>& theResult) {
    if ((theResult == lhd) && (theResult == rhd)) {
	ia_throw(IA::INVALID_OPERATION, __FILE__, __LINE__);
	return;
    }

    if (lhd.empty()) {
	theResult = rhd;
    } else if (rhd.empty()) {
	theResult = lhd;
    } else if (theResult == lhd) {
        IA_DequeIter<T> dIter(rhd);  // Prepare to iterate over the rhd
        T val;                       // Our receptacle
        while( dIter(val) ) {
            theResult.insBack(val);
        }
    } else if (theResult == rhd) {
	IA_DequeIter<T> dIter(lhd, -1);  // Backwards iterator
	T val;
	while( dIter(val) ) {
	    theResult.insFront(val);
	}
    } else {
	if ((theResult != lhd) && (theResult != rhd)) {
	    theResult = lhd;

	    IA_DequeIter<T> dIter(rhd);  // Prepare to iterate over the rhd
	    T val;                       // Our receptacle
	    
	    while( dIter(val) ) {
		theResult.insBack(val);
	    }
	}
    }
}




/////////////////////////////////////////////////////////////////////////////
//
//  class IA_DequeIter
//
/////////////////////////////////////////////////////////////////////////////

template <class T>
IA_DequeIter<T>::IA_DequeIter(const IA_Deque<T>& d) {

    myDeque = (IA_Deque<T> *) &d;
    myDirection = 1;  // Forward
    this->determineMyFirstCell();
}


template <class T>
IA_DequeIter<T>::IA_DequeIter(const IA_Deque<T>& theDeque,
			int direction) {
    // direction < 0 if backwards
    myDeque = (IA_Deque<T> *) &theDeque;
    this->determineMyDirection(direction);
    this->determineMyFirstCell();
}


template <class T>
int  IA_DequeIter<T>::operator() (T& receptacle) {

    if (myNextCell != 0) {
	receptacle = myNextCell->value();
	this->determineNextCell();
	return 1;
    }

    // We must be at the end, so return 0 and leave;
    return 0;
}



// Here we will try to encapsulate the knowledge of what special values
// for myDirection actually mean.

template <class T>
int  IA_DequeIter<T>::forward() {
    return (myDirection >= 0);
}

template <class T>
void  IA_DequeIter<T>::determineMyDirection(int dValue) {
    if (dValue >= 0) {
	this->myDirection = 1;
    } else {
	this->myDirection = -1;
    }
}


// Our job here is to set my first IA_Cell to either point to the
// first or the last IA_Cell of the IA_Deque, based on our direction.

template <class T>
void  IA_DequeIter<T>::determineMyFirstCell() {
    if (this->forward()) {
	myNextCell = myDeque->front;
    } else {
	myNextCell = myDeque->rear;
    }
}


// Our job is to assign myNextCell based on its current value
// and myDirection.  If we are at the end of the list, we will
// set myNextCell to 0

template <class T>
void  IA_DequeIter<T>::determineNextCell() {

    if (this->forward()) {
	// direction is forward, make sure we do not overshoot the end
	if (myNextCell == myDeque->rear) {
	    myNextCell = 0;
	} else {
	    myNextCell = myNextCell->next();
	}
    } else {
	// Direction is backwards, so do not overshoot the front
	if (myNextCell == myDeque->front) {
	    myNextCell = 0;
	} else {
	    myNextCell = myNextCell->prev();
	}
    }
}
@


1.5
log
@Changed 'emptyp()' to 'empty()'.
@
text
@d7 1
a7 1
static char IA_Deque_c_rcsid[] = "$Id: Deque.c,v 1.4 93/11/14 19:55:29 rjj Exp Locker: rjj $";
d9 4
a12 1
// $Log:	Deque.c,v $
d197 1
a197 1
T  IA_Deque<T>::operator[] (int n) const {
@


1.4
log
@Rename forwardp() to forward().
@
text
@d7 1
a7 1
static char IA_Deque_c_rcsid[] = "$Id: Deque.c,v 1.3 1993/11/11 01:13:42 rjj Exp rjj $";
d9 4
a12 1
// $Log: Deque.c,v $
d42 1
a42 1
    while (!this->emptyp()) {
d196 1
a196 1
    if (this->emptyp()) {
d215 1
a215 1
    if (this->emptyp()) {
d238 1
a238 1
int  IA_Deque<T>::emptyp() const {
d246 1
a246 1
    if (this->emptyp()) {
d258 1
a258 1
    if (this->emptyp()) {
d270 1
a270 1
    if (this->emptyp()) {
d327 1
a327 1
    if (this->emptyp()) {
d361 1
a361 1
    if ( this->emptyp() ) {
d392 1
a392 1
    if (this->emptyp()) {
d410 1
a410 1
    if (this->emptyp()) {
d450 1
a450 1
    if ( (this->emptyp()) || (n-m<0) || (dLen <= (n-m)) ) {
d493 1
a493 1
    if (lhd.emptyp()) {
d495 1
a495 1
    } else if (rhd.emptyp()) {
@


1.3
log
@Added op== and op!=, squashed some buggs.
@
text
@d7 1
a7 1
static char IA_Deque_c_rcsid[] = "$Id: Deque.c,v 1.2 93/05/26 23:15:49 rjj Exp Locker: rjj $";
d9 4
a12 1
// $Log:	Deque.c,v $
d567 1
a567 1
int  IA_DequeIter<T>::forwardp() {
d586 1
a586 1
    if (this->forwardp()) {
d601 1
a601 1
    if (this->forwardp()) {
@


1.2
log
@Added copyright notice.
@
text
@d7 1
a7 1
static char IA_Deque_c_rcsid[] = "$Id: Deque.c,v 1.1 92/12/16 02:11:21 rjj Exp Locker: rjj $";
d10 3
d133 6
a138 1
IA_Deque<T>&  IA_Deque<T>::operator= (const IA_Deque<T>& rhd) {
d166 20
d402 1
a402 7
void  IA_Deque<T>::reverse(IA_Deque<T>& theReceiver) const {

    if ( ! theReceiver.emptyp() ) {
	// could be very clever and try to reuse storage in theReceiver
	// but for now I will op for the simplist way..
	theReceiver.deleteCells();
    }
d405 1
d409 9
a417 2
    IA_DequeIter<T> dIter(*this);
    T val;
d419 17
a435 2
    while( dIter(val) ) {
	theReceiver.insFront(val);
d441 1
a441 1
void  IA_Deque<T>::sub (int m, int n, IA_Deque<T>& theReceiver) const {
d443 2
a444 4
    // Take the easy way and just reclaim all of theReceiver\'s storage
    theReceiver.deleteCells();

    if ( (n-m<0) || (this->length() <= (n-m)) ) {
d449 22
a470 8
    // NOTE:  We use the cell pointers rather than a IA_DequeIter
    //        to allow the wrap around the ends.
    IA_Cell<T> *c = this->front->skip(m);   // The starting Cell for this job
    theReceiver.insFront(c->value());

    for (int i=m; i<n; i++) {
	c = c->next();
	theReceiver.insBack( c->value() );
d481 3
a483 4
	      IA_Deque<T>& theReceiver) {

    if (lhd.emptyp()) {
	theReceiver = rhd;
d487 19
a505 1
    theReceiver = lhd;  // lhd is not empty, so copy it to theReceiver
d507 7
a513 9
    if (rhd.emptyp()) { // performance? hack
	return;
    }

    IA_DequeIter<T> dIter(rhd);  // Prepare to iterate over the rhd
    T val;                    // Our receptacle

    while( dIter(val) ) {
	theReceiver.insBack(val);
@


1.1
log
@Initial revision
@
text
@d2 2
d7 1
a7 1
static char IA_Deque_c_rcsid[] = "$Id$";
d9 4
a12 1
// $Log$
d16 1
a16 1
// IA_Cell<T> helper functions
d30 9
a44 5
/*template <class T>
const  char*  IA_Deque<T>::c_file() {
    return IA_Deque_c_rcsid;
}
*/
d46 4
d60 1
a60 1
	this->insertBack(val);
d71 1
a71 1
	this->insertBack(vec[i]);
d79 1
a79 1
    this->insertFront(v0);
d85 2
a86 2
    this->insertFront(v1);
    this->insertFront(v0);
d93 3
a95 3
    this->insertFront(v2);
    this->insertFront(v1);
    this->insertFront(v0);
d101 4
a104 4
    this->insertFront(v3);
    this->insertFront(v2);
    this->insertFront(v1);
    this->insertFront(v0);
d110 5
a114 5
    this->insertFront(v4);
    this->insertFront(v3);
    this->insertFront(v2);
    this->insertFront(v1);
    this->insertFront(v0);
d125 3
a127 4
template <class T>
int  IA_Deque<T>::emptyp() const {
    return front == 0;
}
a128 1

a129 24
T  IA_Deque<T>::first() const {

    if (this->emptyp()) {
	ia_throw(IA::INVALID_OPERATION, __FILE__, __LINE__);
	return T(0);
    }

    return this->front->value();
}


template <class T>
T  IA_Deque<T>::last() const {

    if (this->emptyp()) {
	ia_throw(IA::INVALID_OPERATION, __FILE__, __LINE__);
	return T(0);
    }

    return this->rear->value();
}


template <class T>
d143 1
a143 1
	    this->insertBack(rhdVal);
d151 1
a151 1
	    this->deleteBack();   // Just get rid of it
d198 3
a200 2
template <class T>
void  IA_Deque<T>::reverse(IA_Deque<T>& theReceiver) const {
a201 5
    if ( ! theReceiver.emptyp() ) {
	// could be very clever and try to reuse storage in theReceiver
	// but for now I will op for the simplist way..
	theReceiver.deleteCells();
    }
d203 3
a205 10
    if (this->emptyp()) {
	return;
    }

    IA_DequeIter<T> dIter(*this);
    T val;

    while( dIter(val) ) {
	theReceiver.insertFront(val);
    }
d210 1
a210 1
void  IA_Deque<T>::sub (int m, int n, IA_Deque<T>& theReceiver) const {
d212 1
a212 4
    // Take the easy way and just reclaim all of theReceiver\'s storage
    theReceiver.deleteCells();

    if ( (n-m<0) || (this->length() <= (n-m)) ) {
d214 1
a214 1
	return;
d217 1
a217 9
    // NOTE:  We use the cell pointers rather than a IA_DequeIter
    //        to allow the wrap around the ends.
    IA_Cell<T> *c = this->front->skip(m);   // The starting Cell for this job
    theReceiver.insertFront(c->value());

    for (int i=m; i<n; i++) {
	c = c->next();
	theReceiver.insertBack( c->value() );
    }
d222 1
a222 2
void  concat (const IA_Deque<T>& lhd, const IA_Deque<T>& rhd,
	      IA_Deque<T>& theReceiver) {
d224 3
a226 3
    if (lhd.emptyp()) {
	theReceiver = rhd;
	return;
d229 1
a229 12
    theReceiver = lhd;  // lhd is not empty, so copy it to theReceiver

    if (rhd.emptyp()) { // performance? hack
	return;
    }

    IA_DequeIter<T> dIter(rhd);  // Prepare to iterate over the rhd
    T val;                    // Our receptacle

    while( dIter(val) ) {
	theReceiver.insertBack(val);
    }
a250 2
template <class T, class S>
void  map(S (*f)(T), const IA_Deque<T>& d, IA_Deque<S>& theReceiver) {
a251 11
    theReceiver.deleteCells();  // reclaim all used storage...
    IA_DequeIter<T>  dIter(d);
    T  val;

    while( dIter(val) ) {
	theReceiver.insertBack( (*f)(val) );
    }
}



d257 1
a257 1
void  IA_Deque<T>::insertFront(T val) {
d274 1
a274 1
void  IA_Deque<T>::insertBack(T val) {
d291 1
a291 1
void  IA_Deque<T>::deleteFront() {
d309 9
a317 3
void  IA_Deque<T>::deleteNth(int n) {
    if ( (n <= -this->length()) || (this->length() <= n) ) {
	ia_throw(IA::INVALID_OPERATION, __FILE__, __LINE__);
d319 2
a320 10
	IA_Cell<T> *c = this->front->skip(n);

	if (c == this->front) {
	    this->deleteFront();
	} else if (c == this->rear) {
	    this->deleteBack();
	} else {
	    unlinkCell(c);
	    delete c;
	}
d326 1
a326 1
void  IA_Deque<T>::deleteValue(const T& val) {
d332 1
a332 1
	    if (c->value() == val)
d334 3
d341 1
a341 1
		this->deleteFront();
d343 1
a343 1
		this->deleteBack();
d348 2
d356 1
a356 1
void  IA_Deque<T>::deleteBack() {
d374 6
a379 3
void  IA_Deque<T>::deleteCells() {
    while (!this->emptyp()) {
	this->deleteFront();
d381 11
d393 53
@
