#include <AList.hpp>
Public Methods | |
| AList () | |
| AList (ULONG size) | |
| virtual | ~AList () |
| void | clear () |
| void | insert (Elem item) |
| void | append (Elem item) |
| Elem | remove () |
| void | setFirst () |
| void | prev () |
| void | next () |
| long | getPos () |
| void | setPos (ULONG pos) |
| void | setValue (Elem item) |
| Elem | currValue () const |
| ULONG | length () const |
| ULONG | getMaxSize () const |
| bool | isEmpty () const |
| bool | isInList () const |
| long | find (Elem val) |
| void | display () const |
Private Attributes | |
| ULONG | msize |
| ULONG | nbList |
| ULONG | curr |
| Elem * | listarray |
|
|
|
|
|
|
|
|
|
|
|
Definition at line 49 of file AList.cpp. 00050 {
00051 assert( nbList < msize ); // List must not be full
00052 listarray[ nbList ] = item;
00053 nbList++; // Increment list size
00054 }
|
|
|
Definition at line 27 of file AList.cpp. 00028 {
00029 nbList = 0; // Simply reinitialize values
00030 curr = 0;
00031 }
|
|
|
Definition at line 120 of file AList.cpp. 00121 {
00122 assert( isInList() ); // Curr must be at valid position
00123 return listarray[ curr ]; // This is OK ?!?
00124 }
|
|
|
|
|
|
|
|
|
Definition at line 109 of file AList.cpp. 00110 {
00111 return msize;
00112 }
|
|
|
Definition at line 97 of file AList.cpp. Referenced by find().
00098 {
00099 if ( isEmpty() ) return -1;
00100 return curr;
00101 }
|
|
|
Definition at line 34 of file AList.cpp. 00035 {
00036 // Array must not be full and curr must be a legal position
00037 assert( nbList < msize );
00038 assert( curr <= nbList );
00039
00040 for( ULONG i = nbList; i > curr; i-- ) // Shift Elems up to make room
00041 {
00042 listarray[ i ] = listarray[ i-1 ];
00043 }
00044
00045 listarray[ curr ] = item;
00046 nbList++; // Increment current list size
00047 }
|
|
|
Definition at line 126 of file AList.cpp. 00127 {
00128 return ( nbList == 0 && curr == 0 );
00129 }
|
|
|
Definition at line 131 of file AList.cpp. 00132 {
00133 return ( nbList != 0 && curr >= 0 && curr < nbList );
00134 }
|
|
|
Definition at line 104 of file AList.cpp. 00105 {
00106 return nbList;
00107 }
|
|
|
Definition at line 85 of file AList.cpp. Referenced by find().
00086 {
00087 if ( curr >= msize-1 ) return;
00088 curr++;
00089 }
|
|
|
Definition at line 79 of file AList.cpp. 00080 {
00081 if ( curr <= 0 ) return;
00082 curr--;
00083 }
|
|
|
Definition at line 56 of file AList.cpp. 00057 {
00058 assert( !isEmpty() ); // Must be an Elem to remove
00059 assert( isInList() );
00060
00061 Elem temp = listarray[curr]; // Store removed Elem
00062
00063 register ULONG i;
00064 for( i = curr; i < nbList-1; i++) // Shift elements down
00065 {
00066 listarray[ i ] = listarray[ i + 1 ];
00067 }
00068
00069 nbList--; // Decrement current list size
00070
00071 return temp; // This is OK ?!? or by copy constructor?
00072 }
|
|
|
Definition at line 74 of file AList.cpp. 00075 {
00076 curr = 0;
00077 }
|
|
|
Definition at line 91 of file AList.cpp. 00092 {
00093 if ( pos > msize-1 ) return; // Position must be valid
00094 curr = pos;
00095 }
|
|
|
Definition at line 114 of file AList.cpp. 00115 {
00116 assert( isInList() ); // Curr must be at valid position
00117 listarray[ curr ] = item;
00118 }
|
|
|
|
|
|
|
|
|
|
|
|
|
1.2.11.1 written by Dimitri van Heesch,
© 1997-2001