An abstract data type representing the double ended queue data structure. Rather than just pushing items to one end (the "left end") and popping them from the other (the "right end"), items can be pushed or popped to/from either the right or the left.
Add an item to the left end of the data structure (equivalent to push on a queue)
Add an item to the right end of the data structure
Remove and return the item from the left end of the data structure
Remove and return the item from the right end of the data structure (equivalent to pop on a queue)
Return, but do not remove, the item at the left end of the data structure
type, abstract, extends(queue), public :: deque
!* Author: Chris MacMackin
! Date: March 2016
!
! An abstract data type representing the double ended queue data
! structure. Rather than just pushing items to one end (the "left
! end") and popping them from the other (the "right end"), items can
! be pushed or popped to/from either the right or the left.
!
contains
procedure(push_sub), deferred :: pushleft
!! Add an item to the left end of the data structure (equivalent
!! to [[ordered:push]] on a queue)
procedure(push_sub), deferred :: pushright
!! Add an item to the right end of the data structure
procedure(pop_func), deferred :: popleft
!! Remove and return the item from the left end of the data
!! structure
procedure(pop_func), deferred :: popright
!! Remove and return the item from the right end of the data
!! structure (equivalent to [[ordered:pop]] on a queue)
procedure(peek_func), deferred :: peekleft
!! Return, but do not remove, the item at the left end of the data
!! structure
procedure(peek_func), deferred :: peekright
!! Return, but do not remove, the item at the left end of the data
!! structure (equivalent to [[ordered:peek]] on a queue)
end type deque