Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

KetteC< Typ > Class Template Reference

#include <kettec.h>

Inheritance diagram for KetteC< Typ >:

Inheritance graph
[legend]
List of all members.

Public Methods

long size ()
Iter begin ()
Iter end ()
KettenElementC< Typ > * pBegin () const
KettenElementC< Typ > * pEnd ()
 KetteC ()
 KetteC (const KetteC< Typ > &k)
 ~KetteC ()
void RemoveAll (const Typ &t)
void RemoveSingle (const Typ &t)
void Remove (KettenElementC< Typ > *z)
short RemoveFirst ()
short RemoveLast ()
short RemoveFirst (Typ &t)
short RemoveLast (Typ &t)
void push_back (const Typ &t)
void Empty ()
KetteC< Typ > & operator= (const KetteC< Typ > &k)
KettenElementC< Typ > * GetElement (const Typ &t)
short Contain (const Typ &t)
long Count (const Typ &t)

Protected Methods

void CloseLoop ()
void CutLoop ()

Protected Attributes

long m_laenge
int m_loop
KettenElementC< Typ > * m_zanfang
KettenElementC< Typ > * m_zende

template<class Typ>
class KetteC< Typ >


Constructor & Destructor Documentation

template<class Typ>
KetteC< Typ >::KetteC   [inline]
 

Definition at line 82 of file kettec.h.

template<class Typ>
KetteC< Typ >::KetteC const KetteC< Typ > &    k [inline]
 

template<class Typ>
KetteC< Typ >::~KetteC   [inline]
 

Definition at line 100 of file kettec.h.

00101   {
00102     if(m_laenge==0) {return;}
00103     m_zanfang->r=0;  m_zende->v=0;
00104     KettenElementC<Typ> *z=m_zanfang;
00105     while ((z!=m_zende)&&(z!=0)){z=z->v;delete (z->r);}
00106     if(z!=0){delete z;}
00107   }


Member Function Documentation

template<class Typ>
Iter KetteC< Typ >::begin   [inline]
 

Definition at line 78 of file kettec.h.

00078 {return m_zanfang;}

template<class Typ>
void KetteC< Typ >::CloseLoop   [inline, protected]
 

Definition at line 278 of file kettec.h.

Referenced by KetteC< StringC >::operator=(), KetteC< StringC >::push_back(), KetteC< StringC >::RemoveFirst(), and KetteC< StringC >::RemoveLast().

00279   {
00280     if(m_zanfang==0){return;}
00281     m_loop=1;
00282     m_zende->v=m_zanfang;
00283     m_zanfang->r=m_zende;
00284   }

template<class Typ>
short KetteC< Typ >::Contain const Typ &    t [inline]
 

Definition at line 253 of file kettec.h.

00254   {
00255     KettenElementC<Typ> *z=m_zanfang;
00256     if(m_zanfang==0){return 0;}
00257     while(z!=m_zende){
00258       if(z->element == t){return 1;}
00259       z=z->v;
00260     }
00261     if(z->element == t){return 1;}
00262     return 0;
00263   }

template<class Typ>
long KetteC< Typ >::Count const Typ &    t [inline]
 

Definition at line 265 of file kettec.h.

00266   {
00267     long i=0;
00268     KettenElementC<Typ> *z=m_zanfang;
00269     if(m_zanfang==0){return 0;}
00270     while(z!=0){
00271       if(z->element == t){i++;}
00272       z=z->v;
00273     }
00274     return i;
00275   }

template<class Typ>
void KetteC< Typ >::CutLoop   [inline, protected]
 

Definition at line 286 of file kettec.h.

Referenced by KetteC< StringC >::Empty(), KetteC< StringC >::push_back(), KetteC< StringC >::RemoveFirst(), and KetteC< StringC >::RemoveLast().

00287   {
00288     if(m_zanfang==0){return;}
00289     m_loop=0;
00290     m_zende->v=0;
00291     m_zanfang->r=0;
00292   }

template<class Typ>
void KetteC< Typ >::Empty   [inline]
 

Definition at line 212 of file kettec.h.

Referenced by KetteC< StringC >::operator=().

00213   {
00214     KettenElementC<Typ> *z;
00215     if(m_zanfang==0){return;}
00216     if(m_zanfang!=0){m_zanfang->r=0;m_zende->v=0;}
00217     CutLoop();
00218     z=m_zanfang;
00219     while (z!=m_zende){z=z->v;delete(z->r);}
00220     if(z!=0){delete z;}
00221     m_zanfang=0; m_zende=0;
00222     m_laenge=0;
00223   }

template<class Typ>
Iter KetteC< Typ >::end   [inline]
 

Definition at line 79 of file kettec.h.

00079 {return 0;}

template<class Typ>
KettenElementC<Typ>* KetteC< Typ >::GetElement const Typ &    t [inline]
 

Definition at line 242 of file kettec.h.

00242                                                {
00243     KettenElementC<Typ> *z=m_zanfang;
00244     if(m_zanfang==0){return 0;}
00245     while(z!=m_zende){
00246       if(z->element == t){return 1;}
00247       z=z->v;
00248     }
00249     if(z->element == t){return z;}
00250     return 0;
00251   }

template<class Typ>
KetteC<Typ>& KetteC< Typ >::operator= const KetteC< Typ > &    k [inline]
 

Definition at line 226 of file kettec.h.

00227   {
00228     KettenElementC<Typ> *z;
00229     Empty();
00230     z=k.m_zanfang;
00231     if(z==0) return *this;
00232     while(z!=k.m_zende)
00233       {
00234         push_back(z->element);
00235         z=z->v;
00236       }   
00237     push_back(z->element);
00238     if(k.m_loop){CloseLoop();}
00239     return *this;
00240   }

template<class Typ>
KettenElementC<Typ>* KetteC< Typ >::pBegin   const [inline]
 

Definition at line 80 of file kettec.h.

00080 {return m_zanfang;};

template<class Typ>
KettenElementC<Typ>* KetteC< Typ >::pEnd   [inline]
 

Definition at line 81 of file kettec.h.

00081 {return m_zende;}

template<class Typ>
void KetteC< Typ >::push_back const Typ &    t [inline]
 

Definition at line 201 of file kettec.h.

Referenced by KetteC< StringC >::operator=().

00202   {
00203      KettenElementC<Typ> *z = new KettenElementC<Typ>(t);
00204      if(z==0) return;
00205      if(m_loop){CutLoop();m_loop=1;}   
00206      if(m_zanfang==0){m_zanfang=m_zende=z;}
00207          else{z->r=m_zende;m_zende->v=z;m_zende=z;}
00208      if(m_loop){CloseLoop();}
00209      m_laenge++;
00210   }

template<class Typ>
void KetteC< Typ >::Remove KettenElementC< Typ > *    z [inline]
 

Definition at line 138 of file kettec.h.

Referenced by KetteC< StringC >::RemoveAll(), and KetteC< StringC >::RemoveSingle().

00139   {
00140     assert(m_zanfang!=0);
00141     if(m_laenge==1){
00142       assert(z==m_zanfang);delete z;m_laenge=0;m_zanfang=0;m_zende=0;return;}
00143     if(z==m_zanfang){m_zanfang=z->v;m_zanfang->r=0;m_laenge--; delete z;return;}
00144     if(z==m_zende){m_zende=z->r;m_zende->v=0;m_laenge--; delete z;return;}
00145     z->r->v=z->v;
00146     z->v->r=z->r;
00147     delete z;
00148     m_laenge--;
00149   }

template<class Typ>
void KetteC< Typ >::RemoveAll const Typ &    t [inline]
 

Definition at line 109 of file kettec.h.

00110   {  
00111     if(m_zanfang==0) return;
00112     KettenElementC<Typ> *z,*tmpz;
00113     z=m_zanfang;
00114     if ((z==0)||(m_laenge==0)){return;}
00115     while(z!=0){
00116       if(z->element==t){
00117         tmpz =z;
00118         z=z->v;
00119         Remove(tmpz);
00120       }else{
00121         z=z->v;
00122       }
00123     }
00124   }

template<class Typ>
short KetteC< Typ >::RemoveFirst Typ &    t [inline]
 

Definition at line 187 of file kettec.h.

00188   {
00189     if(m_zanfang==0){return 0;}
00190     t=m_zanfang->element;
00191     return RemoveFirst();
00192   }

template<class Typ>
short KetteC< Typ >::RemoveFirst   [inline]
 

Definition at line 151 of file kettec.h.

Referenced by KetteC< StringC >::RemoveFirst().

00152   {
00153      KettenElementC<Typ> *z;
00154      z=m_zanfang;
00155      if(z==0) return 0;
00156      if(m_loop){CutLoop();m_loop=1;}
00157      m_zanfang=z->v;
00158      delete z;
00159      m_laenge--;
00160      if(m_laenge==0){
00161                          m_zanfang=m_zende=0;
00162                  }else{
00163                         m_zanfang->r=0;
00164                  }
00165      if(m_loop){CloseLoop();}
00166      return 1;
00167   }

template<class Typ>
short KetteC< Typ >::RemoveLast Typ &    t [inline]
 

Definition at line 194 of file kettec.h.

00195   {
00196     if(m_zende==0){return 0;}
00197     t=m_zende->element;
00198     return removeLast();
00199   }

template<class Typ>
short KetteC< Typ >::RemoveLast   [inline]
 

Definition at line 169 of file kettec.h.

00170   {
00171      KettenElementC<Typ> *z;
00172      z=m_zende;
00173      if(z==0) return 0;
00174      if(m_loop){CutLoop();m_loop=1;}
00175      m_zende=z->r;
00176      delete z;
00177      m_laenge--;
00178      if(m_laenge==0){
00179                          m_zanfang=m_zende=0;
00180                  }else{
00181                          m_zende->v=0;
00182                  }
00183      if(m_loop){CloseLoop();}
00184      return 1;
00185   }

template<class Typ>
void KetteC< Typ >::RemoveSingle const Typ &    t [inline]
 

Definition at line 126 of file kettec.h.

00127   {
00128     if(m_zanfang==0) return;
00129     KettenElementC<Typ> *z;
00130     z=m_zanfang;
00131     if ((z==0)||(m_laenge==0)){return;}
00132     while(z!=0){
00133       if(z->element==t){Remove(z);return;}
00134       z=z->v;
00135     }
00136   }

template<class Typ>
long KetteC< Typ >::size   [inline]
 

Definition at line 77 of file kettec.h.

00077 {return m_laenge;}


Member Data Documentation

template<class Typ>
long KetteC< Typ >::m_laenge [protected]
 

Definition at line 296 of file kettec.h.

Referenced by KetteC< StringC >::Empty(), KetteC< StringC >::KetteC(), KetteC< StringC >::push_back(), KetteC< StringC >::Remove(), KetteC< StringC >::RemoveAll(), KetteC< StringC >::RemoveFirst(), KetteC< StringC >::RemoveLast(), KetteC< StringC >::RemoveSingle(), KetteC< StringC >::size(), and KetteC< StringC >::~KetteC().

template<class Typ>
int KetteC< Typ >::m_loop [protected]
 

Definition at line 297 of file kettec.h.

Referenced by KetteC< StringC >::CloseLoop(), KetteC< StringC >::CutLoop(), KetteC< StringC >::KetteC(), KetteC< StringC >::operator=(), KetteC< StringC >::push_back(), KetteC< StringC >::RemoveFirst(), and KetteC< StringC >::RemoveLast().

template<class Typ>
KettenElementC<Typ>* KetteC< Typ >::m_zanfang [protected]
 

Definition at line 298 of file kettec.h.

Referenced by KetteC< StringC >::begin(), KetteC< StringC >::CloseLoop(), KetteC< StringC >::Contain(), KetteC< StringC >::Count(), KetteC< StringC >::CutLoop(), KetteC< StringC >::Empty(), KetteC< StringC >::GetElement(), KetteC< StringC >::KetteC(), KetteC< StringC >::operator=(), KetteC< StringC >::pBegin(), KetteC< StringC >::push_back(), KetteC< StringC >::Remove(), KetteC< StringC >::RemoveAll(), KetteC< StringC >::RemoveFirst(), KetteC< StringC >::RemoveLast(), KetteC< StringC >::RemoveSingle(), and KetteC< StringC >::~KetteC().

template<class Typ>
KettenElementC<Typ>* KetteC< Typ >::m_zende [protected]
 

Definition at line 299 of file kettec.h.

Referenced by KetteC< StringC >::CloseLoop(), KetteC< StringC >::Contain(), KetteC< StringC >::CutLoop(), KetteC< StringC >::Empty(), KetteC< StringC >::GetElement(), KetteC< StringC >::KetteC(), KetteC< StringC >::operator=(), KetteC< StringC >::pEnd(), KetteC< StringC >::push_back(), KetteC< StringC >::Remove(), KetteC< StringC >::RemoveFirst(), KetteC< StringC >::RemoveLast(), and KetteC< StringC >::~KetteC().


The documentation for this class was generated from the following file:
Generated on Tue Jul 29 14:30:50 2003 for Open ActiveWrl by doxygen1.3-rc2