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


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

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

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


desc
@Implementation of linked lists based on IA_Deque<T>.
@


1.3
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 "ia.h"
#include "List.h"

static char IA_List_c_rcsid[] = "$Id: List.c,v 1.2 1993/11/14 19:52:13 rjj Exp rjj $";

// $Log: List.c,v $
//Revision 1.2  1993/11/14  19:52:13  rjj
//Changed 'emptyp()' to 'empty()'.
//
//Revision 1.1  93/11/11  01:15:59  rjj
//Initial revision
//


////////////////////////////////////////////////////////////////////////
//
//  Class  IA_List<T>
//
////////////////////////////////////////////////////////////////////////


/************************
 protected:
 ************************/

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


/************************
 public:
 ************************/

template <class T>
IA_List<T>::IA_List(void)
: IA_Deque<T>() {
}


template <class T>
IA_List<T>::IA_List(const IA_List<T>& list) : IA_Deque<T>(list) {
}


template <class T>
IA_List<T>::IA_List(T *vec, unsigned size) : IA_Deque<T>(vec, size) {
}


template <class T>
IA_List<T>::IA_List(T v0) : IA_Deque<T>(v0) {
}


template <class T>
IA_List<T>::IA_List(T v0, T v1) : IA_Deque<T>(v0, v1) {
}


template <class T>
IA_List<T>::IA_List(T v0, T v1, T v2) : IA_Deque<T>(v0, v1, v2) {
}


template <class T>
IA_List<T>::IA_List(T v0, T v1, T v2, T v3) : IA_Deque<T>(v0, v1, v2, v3) {
}


template <class T>
IA_List<T>::IA_List(T v0, T v1, T v2, T v3, T v4)
: IA_Deque<T>(v0, v1, v2, v3, v4) {
}


template <class T>
int  IA_List<T>::empty() const {
    return this->IA_Deque<T>::empty();
}


template <class T>
T         IA_List<T>::head() const {
    return this->IA_Deque<T>::first();
}


template <class T>
void   IA_List<T>::tail(IA_List<T>& theTail) {

    // What kind of errors should I worry about?
    // empty list?
    if (this->empty()) {
	ia_throw(IA::INVALID_OPERATION, __FILE__, __LINE__);
	return;
    }
    if (&theTail != this) {
	theTail = *this;  // copy it over.
    }
    theTail.IA_Deque<T>::delFront();
}


template <class T>
T   IA_List<T>::operator() (unsigned index) const {

    return this->IA_Deque<T>::operator()(index);
}


template <class T>
T&  IA_List<T>::operator[] (unsigned index) {

    return this->IA_Deque<T>::operator[](index);
}
    

template <class T>
IA_List<T>&  IA_List<T>::operator= (const IA_List<T>& rhs) {

    this->IA_Deque<T>::operator=(rhs);  // Invoke for side effect...
    return *this;
}


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

    this->IA_Deque<T>::reverse(theResult);
}


template <class T>
void   IA_List<T>::sub(unsigned start_index, unsigned end_index,
		    IA_List<T>& theResult) {
    // Note, maybe end_index should be checked to be < length(),
    //       but for now it is not.
    this->IA_Deque<T>::sub(start_index, end_index, theResult);
}


template <class T>
unsigned  IA_List<T>::length() const {
    return this->IA_Deque<T>::length();
}


template <class T>
void   concat (const IA_List<T>& l1, const IA_List<T>& l2,
	       IA_List<T>& theResult) {

    concat((IA_Deque<T> &) l1,
	   (IA_Deque<T> &) l2,
	   (IA_Deque<T> &) theResult);
}


template <class T>
void  IA_List<T>::ins(T val) {

    this->IA_Deque<T>::insFront(val);
}


template <class T>
void  IA_List<T>::del() {

    if (this->empty()) {
	ia_throw(IA::INVALID_OPERATION, __FILE__, __LINE__);
    } else {
	this->IA_Deque<T>::delFront();
    }
}


template <class T>
void  IA_List<T>::delNth(unsigned index) {

    if (this->empty()) {
	ia_throw(IA::INVALID_OPERATION, __FILE__, __LINE__);
    } else {
	this->IA_Deque<T>::delNth(index);
    }
}


template <class T>
void  IA_List<T>::delValue(const T& aValueToDelete) {

    if (this->empty()) {
	ia_throw(IA::INVALID_OPERATION, __FILE__, __LINE__);
    } else {
	this->IA_Deque<T>::delValue(aValueToDelete);
    }
}




////////////////////////////////////////////////////////////////////////
//
//  Class  IA_ListIter<T>
//
////////////////////////////////////////////////////////////////////////


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

    return this->IA_DequeIter<T>::operator()(receptacle);
}
@


1.2
log
@Changed 'emptyp()' to 'empty()'.
@
text
@d8 1
a8 1
static char IA_List_c_rcsid[] = "$Id: List.c,v 1.1 93/11/11 01:15:59 rjj Exp Locker: rjj $";
d10 4
a13 1
// $Log:	List.c,v $
d110 1
a110 1
T   IA_List<T>::operator[] (unsigned index) const {
d112 1
a112 1
    return this->IA_Deque<T>::operator[](index);
@


1.1
log
@Initial revision
@
text
@d8 1
a8 1
static char IA_List_c_rcsid[] = "$Id$";
d10 4
a13 1
// $Log$
d79 2
a80 2
int  IA_List<T>::emptyp() const {
    return this->IA_Deque<T>::emptyp();
d95 1
a95 1
    if (this->emptyp()) {
d170 1
a170 1
    if (this->emptyp()) {
d181 1
a181 1
    if (this->emptyp()) {
d192 1
a192 1
    if (this->emptyp()) {
@
