46 for (q=head(); q != 0; q = np)
62 for (ptr = head(); ptr != 0; ptr = ptr->
next())
72 for (ptr = head(); ptr != 0; ptr = ptr->
next(), ++n)
84 for (i = 0, ptr = head(); ptr != 0; ptr = ptr->
next(), ++i)
88 cerr <<
"Requested item #" << n <<
" off end of list" << endl;
102 item->
p->
n = item->
n;
106 item->
n->
p = item->
p;
119 return remove(nth_pointer(n), item_free);
135 new_item->
n = prev_item->
n;
136 prev_item->
n = new_item;
138 new_item->
p = prev_item;
139 if (new_item->
n == 0)
142 new_item->
n->
p = new_item;
158 new_item->
p = next_item->
p;
159 next_item->
p = new_item;
162 if (new_item->
p == 0)
165 new_item->
p->
n = new_item;
176 if ((a==0) || (b==0))
178 cerr <<
"EST_UList:exchange: can't exchange NULL items" << endl;
188 a->
n = bn == a ? b : bn;
191 a->
p = bp == a ? b : bp;
195 b->
n = an == b ? a : an;
198 b->
p = ap == b ? a : ap;
221 for (k=0,p = head(); p != 0; p = p->
next(),k++)
229 if ((a==0) || (b==0))
231 cerr <<
"EST_UList:exchange: can't exchange items " << i <<
232 " and " << j <<
" (off end of list)" << endl;
243 for (p=head(); p != 0; p=q)
257 if (new_item == 0)
return;
270 if (new_item == 0)
return;
310 for (ptr = l.
head(); ptr != 0; ptr = ptr->
next(), ++n)
331 for(l_ptr=l.
head(); l_ptr != 0; l_ptr=l_ptr->
next()){
335 if(gt(l_ptr, m_ptr)){
367 if((i != j) && (i->
prev() != j)){
415 for(l_ptr=l.
head(); l_ptr != 0; l_ptr=l_ptr->
next()){
420 if(gt(l_ptr, m_ptr)){
423 }
else if(eq(l_ptr, m_ptr)){
424 l.
remove(m_ptr, item_free);
445 for(m_ptr=m.
head(); m_ptr != 0; m_ptr=m_ptr->
next()){
449 for(l_ptr=l.
head(); l_ptr != 0; l_ptr=l_ptr->
next()){
450 if( gt(l_ptr, m_ptr) ){
454 }
else if( eq(m_ptr, l_ptr) ){
460 if(!flag && ( gt(m_ptr, l.
tail()) ) )
EST_Item * next_item(const EST_Item *node)
EST_UItem * remove(EST_UItem *ptr, void(*item_free)(EST_UItem *item))
void sort_unique(EST_TList< T > &l)
void clear_and_free(void(*item_free)(EST_UItem *item))
static void merge_sort_unique(EST_UList &l, EST_UList &m, bool(*eq)(const EST_UItem *item1, const EST_UItem *item2), bool(*gt)(const EST_UItem *item1, const EST_UItem *item2), void(*item_free)(EST_UItem *item))
static void sort(EST_UList &a, bool(*gt)(const EST_UItem *item1, const EST_UItem *item2))
void prepend(EST_UItem *item)
void exchange(EST_UItem *a, EST_UItem *b)
void append(EST_UItem *item)
EST_UItem * insert_before(EST_UItem *ptr, EST_UItem *new_item)
static void qsort(EST_UList &a, bool(*gt)(const EST_UItem *item1, const EST_UItem *item2), void(*exchange)(EST_UItem *item1, EST_UItem *item2))
static void sort_unique(EST_UList &l, bool(*eq)(const EST_UItem *item1, const EST_UItem *item2), bool(*gt)(const EST_UItem *item1, const EST_UItem *item2), void(*item_free)(EST_UItem *item))
EST_UItem * nth_pointer(int n) const
EST_UItem * insert_after(EST_UItem *ptr, EST_UItem *new_item)
int index(EST_UItem *item) const
static bool operator_eq(const EST_UList &a, const EST_UList &b, bool(*eq)(const EST_UItem *item1, const EST_UItem *item2))