208 else if (
cmpf( *
last->item, t ) < 0 )
214 while ( (c =
cmpf( *cursor->item, t )) < 0 )
215 cursor = cursor->next;
220 cursor = cursor->prev;
221 cursor->next =
new ListItem<T>( t, cursor->next, cursor );
222 cursor->next->next->prev = cursor->next;
234 else if (
cmpf( *
last->item, t ) < 0 )
240 while ( (c =
cmpf( *cursor->item, t )) < 0 )
241 cursor = cursor->next;
243 insf( *cursor->item, t );
246 cursor = cursor->prev;
247 cursor->next =
new ListItem<T>( t, cursor->next, cursor );
248 cursor->next->next->prev = cursor->next;
269 return (
first == 0 );
282 return first->getItem();
300 first->next->prev = 0;
312 return last->getItem();
330 last->prev->next = 0;
353 cur->item =
cur->next->item;
373 if ( (
cur =
cur->getNext()) )
433 ASSERT( current,
"ListIterator: no item available" );
434 return current->getItem();
449 current = current->next;
457 current = current->prev;
465 current = current->next;
473 current = current->prev;
480 current = theList->
first;
487 current = theList->
last;
496 if ( ! current->prev )
500 current->prev =
new ListItem<T>( t, current, current->prev );
501 current->prev->prev->next = current->prev;
513 if ( ! current->next )
517 current->next =
new ListItem<T>( t, current->next, current );
518 current->next->next->prev = current->next;
533 current->prev->next = current->next;
535 current->next->prev = current->prev;
537 theList->
last = current->prev;
544 current->next->prev = 0;
545 theList->first = current->next;
570 for (
i = F;
i.hasItem();
i++ )
575 while ( ( !
iselt ) &&
j.hasItem() )
592 for (
i = F;
i.hasItem(); ++
i )
605 for (
i = F;
i.hasItem();
i++ )
610 while ( ( !
iselt ) &&
j.hasItem() )
628 for (
i = F;
i.hasItem(); ++
i )
632 for (
j =
G;
j.hasItem() && (!
found); ++
j )
647 for (
i = F;
i.hasItem(); ++
i )
651 for (
j =
G;
j.hasItem() && (!
found); ++
j )
665 for (
i = F;
i.hasItem(); ++
i )
680 for (
i = F;
i.hasItem(); ++
i )
694 for (
i = F;
i.hasItem();
i++ )
702 if (F.
length() == 0)
return false;
706 if (
J.getItem() == t)
716 if (F.
length() == 0)
return false;
720 if (
ecmpf (
J.getItem(), t))
#define ASSERT(expression, message)
ListItem< T > * getNext()
ListItem< T > & operator=(const ListItem< T > &)
ListItem(const ListItem< T > &)
ListItem< T > * getPrev()
void remove(int moveright)
ListIterator< T > & operator=(const ListIterator< T > &)
void sort(int(*)(const T &, const T &))
List< T > & operator=(const List< T > &)
void print(OSTREAM &) const
int operator==(const List< T > &l1, const List< T > &l2)
bool find(const List< T > &F, const T &t)
List< T > Union(const List< T > &F, const List< T > &G)
List< T > Difference(const List< T > &F, const List< T > &G)
OSTREAM & operator<<(OSTREAM &os, const List< T > &l)