Advertisement
Guest User

Untitled

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