#include "LLDeluxe.h" LLDeluxe::LLDeluxe() { first = new Node('\0'); first -> set_next(new Node('~')); count = 0; before = first; current = first -> get_next(); } void LLDeluxe::add_before(char x) { current = new Node(x); current -> set_next(before -> get_next()); before -> set_next(current); count++; } bool LLDeluxe::at_first() { return first == before; } bool LLDeluxe::at_last() { return current -> get_item() == '~'; } void LLDeluxe::display_all() { if (count > 0) for(move_first(); !at_last(); move_next()) current -> display(); cout << endl; } char LLDeluxe::get_current_item() { if (count > 0) return current -> get_item(); else return '\0'; } void LLDeluxe::find_insert_spot(char x) { for(move_first(); !at_last(); move_next()) if (current -> get_item() > x) break; } void LLDeluxe::find_item(char x) { for(move_first(); !at_last(); move_next()) if (current -> get_item() == x) break; } void LLDeluxe::move_first() { if (count > 0) { before = first; current = first -> get_next(); } } void LLDeluxe::move_last() { while (!at_last()) { before = current; current = current -> get_next(); } } void LLDeluxe::move_next() { if (!at_last()) { before = current; current = current -> get_next(); } } void LLDeluxe::remove() { Node *temp; temp = current; if (count > 0) { before -> set_next(temp -> get_next()); delete temp; count--; } }