#ifndef __LIST_H__
#define __LIST_H__

#include "property.h"
#include "queue.h"

typedef Property ItemType;

class List
{
public:
  List();
  ~List();

  bool isFull() const;
  int getLength() const;
  void retrieveItem(ItemType& i, bool& found) const;
  
  void makeEmpty();
  void addItem(const ItemType&);
  void deleteItem(const ItemType&);
  
  void resetCurrent();
  void getNextItem(ItemType&);

private:
  List(const List&);                 // to disallow copying lists until
  List& operator = (const List&);    // we write a copy constructor and =

  struct Node
  {
    ItemType info;
    Node *left, *right;
  };

  static int countNodes(const Node *tree);
  static void retrieveItem(const Node *tree, ItemType& i, bool& found);
  static void makeEmpty(Node*& tree);
  static void addItem(Node*& tree, const ItemType& toAdd);
  static void deleteItem(Node*& tree, const ItemType& toDelete);
  static void traverse(Node *tree, Queue& q);

  Node *root;
  
  Queue inorder; // for cheap (meaning intellectually unsatisfying) way of doing traversal
};

#endif

