2 * Copyright (C) 2004 Jesus Gimenez, Lluis Marquez and Senen Moya
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 listNode
<T
>* previous
;
49 // void *get(int position);
54 // int add(void *object);
59 /****************************************************************************/
61 /****************************************************************************/
67 listNode
<T
>* aux
=first
;
69 while (first
->next
!=0 && cont
>= 1)
84 /****************************************************************************/
91 /****************************************************************************/
101 /****************************************************************************/
103 /*Move Interest Point to next element */
106 if ((index
== 0) || (index
->next
== 0)) return false;
111 /****************************************************************************/
113 /* Move Interest Point to previous element */
116 if ((index
==0) || (index
->previous
==0)) return false;
117 index
= index
->previous
;
121 /****************************************************************************/
123 /* Get Interest Point */
126 if ( index
== 0 ) return 0;
127 else return &index
->data
;
130 /****************************************************************************/
132 /* Get Interest Point */
138 /****************************************************************************/
145 /****************************************************************************/
152 /****************************************************************************/
159 if (numObj
== 0 || position
>= numObj
)
164 for(i
=0; i
<position
; i
++)
166 if(aux
->next
!= 0) aux
= aux
->next
;
172 /****************************************************************************/
174 /* Show list elements */
177 if (first
==0) return 0;
179 listNode
<T
>* actual
=first
;
181 while (actual
->next
!=0)
189 /****************************************************************************/
193 listNode
<T
>* aux
= new listNode
<T
>();
204 aux
->previous
= last
;
216 /****************************************************************************/
220 listNode
<T
>* aux
= index
;
222 if(numObj
== 0) return -1;
224 if (index
==last
&& index
==first
)
226 /* first = aux->next;
229 last = aux->previous;
238 else if (index
==first
)
245 else if (index
==last
)
247 last
= aux
->previous
;
253 index
= index
->previous
;
254 aux
->previous
->next
= aux
->next
;
255 aux
->next
->previous
= aux
->previous
;
263 /****************************************************************************/
267 return (numObj
== 0 || first
== 0);
270 /****************************************************************************/