#pragma once #include "AppendableListNode.h" class AppendableList { public: // PRE: // POST: default constructor AppendableList(); // PRE: // PARAM: list to be copied // POST: copy constructor AppendableList(const AppendableList & list); // PRE: // PARAM: list to be assigned // POST: overloaded assignment operator AppendableList & operator=(const AppendableList & list); // PRE: // POST: overloaded [] operator int & operator[](int i); // PRE: // POST: deallocates memory associated with list ~AppendableList(); // PRE: // POST: returns 1 if list is empty, 0 otherwise int empty(); // PRE: // POST: returns number of values stored in list int length(); // PRE: // PARAM: value = value to be appended // POST: adds a new element to the tail of list void append(int value); // PRE: i < AL->size // PARAM: i = index of data to be returned // POST: returns the date in the ith node in the list int get(int i); // PRE: i < AL->size // PARAM: i = index of data to be set // value = new value // POST: changes the data in the ith node of the list to value void set(int i, int value); // PRE: // POST: prints list elements from head to tail void print(); private: Node* head; Node* tail; int size; // PRE: // POST: removes all nodes from list void removeAll(); // PRE: // PARAM: current = node to be printed // POST: prints list elements from current to tail void printHelper(Node* current); // PARAM: list to be copied // POST: makes a deep copy of list void copyList(const AppendableList & list); };