In this project, we'll implement and thoroughly test our own array-based data structure, a fixed-size circular queue!
An understanding of the following concepts and techniques:
- ADT implementation perspective
- queue ADT (see also java.util.Queue)
- implementing queue as a circular array
- queues with fixed versus growing capacity
- algorithms based on the queue's FIFO policy
- interface-based testing
- stateful property-based testing
- initial exposure to concurrency
In this project, you will have the opportunity to implement a generic queue as a circular array and use this implementation in the context of a typical queue-based application.
Specifically:
- Complete the TODO items in the
FixedArrayQueueimplementation until the tests inTestSimpleQueuepass. - Complete the main class
SingleQueueService, which reads successive input lines until EOF and puts them on a queue that the background consumer activity processes. - When running the main class, note that the consumer is set to serve customers at a fixed rate. By entering customers' names at different rates, try to create scenarios where customers arrive infrequently enough for the queue to remain empty, or in such quick succession that the queue becomes full (by pasting several of them at once).
- Complete the TODO items in the
TestSimpleQueueJqwiktest suite until it reflects the stated pre- and postconditions of theSimpleQueuemethods. - Answer the following questions in a separate file
Answers.md:- Why does
FixedArrayQueuerequire an explicit constructor? - What happens when you offer an item to a full
FixedArrayQueue? - What happens when you poll an empty
FixedArrayQueue? - What is the time and (extra) space complexity of each of the
FixedArrayQueuemethods? - How exhaustively does the
TestSimpleQueuetest suite test the implementation, both conceptually and in terms of actual coverage? - How exhaustively does the
TestSimpleQueueJqwiktest suite test the implementation, both conceptually and in terms of actual coverage? - What kind of test cases does the
simpleQueueActionsmethod generate?
- Why does
To run the tests:
mvn verify
To run the main program:
mvn exec:java
- 2 completion of items marked TODO in
FixedArrayQueueand existing JUnit tests passing - 1 completion of
SingleQueueServiceand correct behavior - 2 completion of items marked TODO in
TestSimpleQueueJqwikand working - 1 written part
- 0.8 responses to the questions above
- 0.2 grammar, style, formatting
Clearly indicate in your Answers.md file any extra credit attempted.
- 0.2 add a working CI status badge for your project
- 0.3 apply
checkSimpleQueueproperty to different queue capacities - 0.3 add observable data invariant(s) for 0 <= size <= capacity to the
checkSimpleQueueproperty - 0.5 add a
clearmethod, which removes all elements in the queue, to interface, impmlementation, and tests