#ifndef LINKEDLIST_H_
#define LINKEDLIST_H_

#include "Collection.h"

/**
 * A structure for Linked List Nodes
 */
struct LinkNode {
  int data;
  LinkNode *next;
  LinkNode(int pData = 0, LinkNode *pNext = NULL) : data(pData), next(pNext) {}
};

/**
 * A basic implementation of our Collection ADT
 * using a singly linked list.
 */
class LinkedList : public Collection {
  LinkNode *head;
  
  public:
    LinkedList() : head(NULL) {};
    ~LinkedList();
    
    /**
     * Returns the count of the number of elements in the Collection
     */
    int size() const;
    
    /**
     * Adds the given integer value to the Collection. Placement index of
     * the newly added element is assumed to be first (index=0).
     */
    void add(int);
    
    /**
     * Returns the integer value of the first element of the Collection.
     */
    int first() const;
    
    /**
     * Returns true if the given integer value is a member of the Collection.
     */
    bool member(int) const;
    
    /**
     * Appends the given integer value to the Collection. Placement index of
     * the newly added element is assumed to be last (index=size-1).
     */
    void append(int);
    
    /**
     * Removes the value corresponding to the index from the Collection.
     */
    void remove(int);
    
    /**
     * Adds the given integer value to the Collection. Placement index of
     * the newly added element is in value order, assuming this LinkedList
     * is already sorted from lowest to highest value. 
     */
    void addSorted(int);
    
    /**
     * Adds all of the elements of the given LinkedList to the Collection. 
     * The given LinkedList and this LinkedList are both assumed to be sorted
     * from lowest to highest value. Placement index of all newly added elements
     * is in value order. 
     */
    void addSorted(LinkedList*);

    /**
     * Appends all of the elements of the given LinkedList in order to the Collection. 
     * Placement index of the first newly added element is assumed to be the previous
     * last (index=size-1).
     */
    void append(LinkedList*);

};

#endif /*LINKEDLIST_H_*/
