home *** CD-ROM | disk | FTP | other *** search
- #include "double.h"
-
- double_node::double_node(containable *arg) : link_node(arg)
- {
- last = NULL;
- }
-
- void double_index::put(containable *arg)
- {
- double_node *last;
-
- if (list == NULL) return;
- last = node()->last;
- abstract_index::put(new double_node(arg));
- node()->last = last;
- if (node()->next == NULL)
- d_list()->tail = node();
- else
- next_node()->last = node();
- }
-
- void double_index::operator -- ( int )
- {
- data = node()->last;
- }
-
- void double_index::destroy()
- {
- if (data == NULL) return;
- if (node()->next == NULL)
- d_list()->tail = node()->last;
- else
- next_node()->last = node()->last;
- abstract_index::destroy();
- }
-
- void double_index::to_end()
- {
- if (list == NULL)
- return;
- data = d_list()->tail;
- }
-
- double_list::double_list()
- {
- tail = NULL;
- }
-
- void double_list::put(containable *arg)
- {
- double_index i(*this);
-
- i.put(arg);
- }
-
- void double_list::destroy()
- {
- if (head != NULL && head->next != NULL)
- ((double_node *) head->next)->last = NULL;
- abstract_list::destroy();
- }
-
- containable *double_list::remove(containable *arg)
- {
- double_index i(*this);
-
- if (i.has(arg))
- i.remove();
- return arg;
- }
-
-