note
	description: "[
		Not immutable yet. 
		Adapt base ARRAYED_QUEUE[G] to usual queue ADT:
		Queries
	
			count: INTEGER	
			first: G
	
			has (g: G): BOOLEAN
	
			is_empty: BOOLEAN
	
			last: G
	
		Commands
	
			dequeue
	
			enqueue (g: G)
		Attached and object comparison is set.
		Classical contracts only
	]"
	author: ""
	date: "$Date$"
	revision: "$Revision$"

class interface
	QUEUE [G -> attached ANY]

create 
	make_empty,
	make_one,
	make_from_array

convert
	make_from_array ({ARRAY [G]})

feature -- queries

	first: G
			-- element at the front of the queue
		require
				not is_empty

	last: G
			-- element at the back of the queue

	is_empty: BOOLEAN
			-- is queue empty?

	count: INTEGER_32
			-- number of elements in the queue

	is_equal (other: like Current): BOOLEAN
			-- is this queue equal to other

	has (g: G): BOOLEAN
			-- does this queue have element g

	item alias "[]" (i: INTEGER_32): G
			-- Element at i-th position
		require
				1 <= i and i <= count
	
feature -- commands

	enqueue (g: G)
			-- add element g to the rear of the queue
		ensure
				count = old count + 1
				last ~ g
				has (g)

	dequeue
			-- remove element first at the front of the queue
		ensure
				count = old count - 1
				not has (old first)
	
feature -- out

	out: STRING_8
			-- New string containing terse printable representation
			-- of current object

	debug_output: STRING_8
			-- String that should be displayed in debugger to represent Current.
	
invariant
		is_empty = (count = 0)
		implementation.linear_representation.Lower = 1
		count = 1 implies first ~ last
		count > 1 implies first /~ last
		count = implementation.count
		implementation.object_comparison

end -- class QUEUE

Generated by ISE EiffelStudio