Skip to main content


By May 15, 2020No Comments

INFO1113 Assignment 1Due: September 22nd, 11:59PM AESTThis assignment is worth 6% of your final assessmentTask DescriptionIn this assignment we will develop a key value store database called CrunchDB in the Java program-ming language using dynamic data structures. All entries to the database contain a unique key whichwill map to a set of values. Each entry of the database is identified by a unique key string and containsa dynamically sized list of integer values.You are encouraged to ask questions on Ed using the assignments category. As with any assignment,make sure that your work is your own, and you do not share your code or solutions with other students.Working on your assignmentYou can work on this assignment on your own computer or the lab machines. It is important that youcontinually back up your assignment files onto your own machine, external drives, and in the cloud.You are encouraged to submit your assignment on Ed while you are in the process of completing it.By submitting you will obtain some feedback of your progress on the sample test cases provided.1INFO1113Implementation detailsWrite a program in Java that implements CrunchDB as shown in the examples below. You can assumethat our test cases will contain only valid input commands and not cause any integer overflows. Keysare case sensitive and do not contain spaces. Commands are case insensitive.Entry values are indexed from 1. Snapshots are indexed from 1 and are unique for the lifetime of theprogram. Keys, entries and snapshots are to be outputted in the order from most recently added toleast recently added. Snapshots can be archived in a human-readable text file, storing all entries in thefollowing form|[,…]}Examplea|1,2,3,4b|3,4,5c|9,6,1,2,0,3Archived snapshots can be restored by CrunchDB, resetting the data to the archived snapshot’s state.Your program can be contained in the provided scaffold of, Snapshot.javaand Do not modify any of the existing method signatures in these files. Your programmust produce no errors when built and run on the lab machines and Ed. Your program will read fromstandard input and write to standard output.Your program output must match the exact output format shown in the examples and on Ed. Youare encouraged to submit your assignment while you are working on it, so you can obtain somefeedback. You have been provided simple skeleton classes and hints on how to implement yoursnapshot database.In order to obtain full marks, your program will be checked against automatic test cases, manuallyinspected by your tutors and you must submit a set of test cases that ensure you have implementedfunctionality correctly.Page 2 of 10INFO1113CommandsYour program should implement the following commands, look at the examples to see how they work.• If a does not exist in the current state, output: no such key• If a does not exist in the database, output: no such snapshot• If an does not exist in an entry, output: index out of rangeBYE clear database and exitHELP display this help messageLIST KEYS displays all keys in current stateLIST ENTRIES displays all entries in current stateLIST SNAPSHOTS displays all snapshots in the databaseGET displays entry valuesDEL deletes entry from current statePURGE deletes entry from current state and snapshotsSET sets entry valuesPUSH pushes values to the frontAPPEND appends values to the backPICK displays value at indexPLUCK displays and removes value at indexPOP displays and removes the front valueDROP deletes snapshotROLLBACK restores to snapshot and deletes newer snapshotsCHECKOUT replaces current state with a copy of snapshotSNAPSHOT saves the current state as a snapshotARCHIVE saves snapshot to fileRESTORE loads and restores snapshot from fileMIN displays minimum valueMAX displays maximum valueSUM displays sum of valuesLEN displays number of valuesREV reverses order of valuesUNIQ removes repeated adjacent valuesSORT sorts values in ascending orderDIFF displays set difference of values in keysINTER displays set intersection of values in keysUNION displays set union of values in keysCARTPROD displays cartesian product of sets> BYEbyePage 3 of 10INFO1113Examples (1)> LIST KEYSno keys> LIST ENTRIESno entries> LIST SNAPSHOTSno snapshots> SET a 1ok> GET a[1]> POP a1> GET a[]> POP anil> PUSH a 2 1ok> GET a[1 2]> APPEND a 3 4ok> GET a[1 2 3 4]> DEL aok> DEL ano such key> BYEbyePage 4 of 10INFO1113Examples (2)> SET a 1ok> SET b 2 3ok> LIST KEYSba> LIST ENTRIESb [2 3]a [1]> LIST SNAPSHOTSno snapshots> PICK a 0index out of range> PICK b 12> GET b[2 3]> PLUCK b 23> GET b[2]> DEL bok> GET bno such key> PURGE bok> BYEbyePage 5 of 10INFO1113Examples (3)> DROP 1no such snapshot> ROLLBACK 1no such snapshot> SET a 1 2ok> SET b 3 4ok> LIST ENTRIESb [3 4]a [1 2]> SNAPSHOTsaved as snapshot 1> SET c 5 6ok> LIST ENTRIESc [5 6]b [3 4]a [1 2]> SNAPSHOTsaved as snapshot 2> PURGE bok> ROLLBACK 1ok> CHECKOUT 2no such snapshot> LIST ENTRIESa [1 2]> LIST SNAPSHOTS1> BYEbyePage 6 of 10INFO1113Examples (4)> SET a 1 4 2 3 4 2ok> SNAPSHOTsaved as snapshot 1> MIN a1> MAX a4> SUM a16> LEN a6> REV aok> GET a[2 4 3 2 4 1]> SORT aok> GET a[1 2 2 3 4 4]> UNIQ aok> GET a[1 2 3 4]> CHECKOUT 1ok> LIST SNAPSHOTS1> LIST ENTRIESa [1 4 2 3 4 2]> BYEbyePage 7 of 10INFO1113Examples (5)> SET a 1 2ok> SET b 3 4ok> ARCHIVE 1 example_file.txtno such snapshot> SNAPSHOTsaved as snapshot 1> LIST ENTRIESb [3 4]a [1 2]> ARCHIVE 1 example_file.txtok> SET c 5 6> LIST SNAPSHOTS1> LIST ENTRIESc [5 6]b [3 4]a [1 2]> SNAPSHOTsaved as snapshot 2> LIST SNAPSHOTS21> RESTORE example_file.txtok> LIST ENTRIESb [3 4]a [1 2]> LIST SNAPSHOTSno snapshots> BYEbyePage 8 of 10INFO1113Writing your own testcasesWe have provided you with some test cases but these do not not test all the functionality described inthe assignment. It is important that you thoroughly test your code by writing your own test cases.You should place all of your test cases in the tests/ directory. Ensure that each test case has the .ininput file along with a corresponding .out output file. We require that the names of your test cases aredescriptive so that you know what each is testing, e.g. and and wecan accurately and quickly assess your test cases.Submission DetailsFinal deliverable for the correctness and manual inspection will be due on the 22nd of September2019.You must submit your code and tests using the assignment page on Ed. To submit, simply place yourfiles and folders into the workspace, click run to check your program works and then click submit.You are encouraged to submit multiple times, but only your last submission will be considered.MarkingYou will only be given valid inputs as part of the automatic test suite. Your program will be checkedfor errors that a user can possibly make. In addition, we will mark your program against a substantialcollection of hidden test cases.3 marks are assigned based on automatic tests for the correctness of your program. This componentwill use hidden test cases that cover every aspect of the specification. Your program must match theexact output in the examples and the test cases on Ed. Test cases will be released progressively, thefinal set of public test cases will be released prior to 17th of September.3 marks are assigned based on a manual inspection of the style (1 mark) and tests cases (2 marks).Make sure that you carefully follow the assignment specifications and thoroughly test your code,optimising for coverage and testing for a variety of input ranges.Page 9 of 10INFO1113Academic declarationBy submitting this assignment you declare the following:I declare that I have read and understood the University of Sydney Student Plagiarism: Coursework Policy and Procedure, and except where specificallyacknowledged, the work contained in this assignment/project is my own work, and has not been copied from other sources or been previously submittedfor award or assessment.I understand that failure to comply with the Student Plagiarism: Coursework Policy and Procedure can lead to severe penalties as outlined underChapter 8 of the University of Sydney By-Law
1999 (as amended). These penalties may be imposed in cases where any significant portion of mysubmitted work has been copied without proper acknowledgment from other sources, including published works, the Internet, existing programs, thework of other students, or work previously submitted for other awards or assessments.I realise that I may be asked to identify those portions of the work contributed by me and required to demonstrate my knowledge of the relevant materialby answering oral questions or by undertaking supplementary work, either written or in the laboratory, in order to arrive at the final assessment mark.I acknowledge that the School of Computer Science, in assessing this assignment, may reproduce it entirely, may provide a copy to another member offaculty, and/or communicate a copy of this assignment to a plagiarism checking service or in-house computer program, and that a copy of the assignmentmay be maintained by the service or the School of Computer Science for the purpose of future plagiarism checking.Page 10 of 10


Author admin

More posts by admin