Advertisement
Guest User

Untitled

a guest
May 25th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.88 KB | None | 0 0
  1. /** ADT deque interface
  2.  
  3. @file DequeInterface.h */
  4.  
  5. #ifndef _DEQUE_INTERFACE
  6.  
  7. #define _DEQUE_INTERFACE
  8.  
  9. template <class ItemType>
  10. class DequeInterface
  11. {
  12.   /** Checks to see if deque is empty
  13.  
  14.   @pre None.
  15.  
  16.   @return True if empty, false if not */
  17.  
  18.   virtual bool empty() const = 0;
  19.  
  20.   /** Insert a new entry into the front of deque
  21.  
  22.   @post newEntry is at the
  23.  
  24.   front of the deque, if the operation is succesful.
  25.  
  26.   @param newEntry The object to be added as a new entry.
  27.  
  28.   @return Returns true if addition is successful, otherwise false */
  29.  
  30.   virtual bool addFront(const ItemType& newEntry) = 0;
  31.  
  32.   /** Adds a new entry to the back of this deque.
  33.  
  34.   @post If successful, newEntry is at the
  35.  
  36.   back of the deque.
  37.  
  38.   @param newEntry The object to be added as a new entry.
  39.  
  40.   @return True if the addition is successful or false if not. */
  41.  
  42.   virtual bool addBack(const ItemType& newEntry) = 0;
  43.  
  44.   /** Removes the front of this deque.
  45.  
  46.   @post If the operation was successful, the front of the deque
  47.  
  48.   has been removed.
  49.  
  50.   @return True if the removal is successful or false if not. */
  51.  
  52.   virtual bool removeFront() = 0;
  53.  
  54.   /** Removes the back of this deque.
  55.  
  56.   @post If the operation was successful, the front of the deque
  57.  
  58.   has been removed.
  59.  
  60.   @return True if the removal is successful or false if not. */
  61.  
  62.   virtual bool removeBack() = 0;
  63.  
  64.   /** Returns the front of this deque.
  65.  
  66.   @pre The deque is not empty.
  67.  
  68.   @post The front of the deque has been returned, and the
  69.  
  70.   deque is unchanged.
  71.  
  72.   @return The front of the deque. */
  73.  
  74.   virtual ItemType peekFront() const = 0;
  75.  
  76.   /** Returns the back of this deque.
  77.  
  78.   @pre The deque is not empty.
  79.  
  80.   @post The back of the deque has been returned, and the
  81.  
  82.   deque is unchanged.
  83.  
  84.   @return The back of the deque. */
  85.  
  86.   virtual ItemType peekBack() const = 0;
  87. }  // end DequeInterface
  88.  
  89. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement