题意:使用JAVA通过动态数据类型去构建数据库解析:数据库中的所有条目都有一个唯一的键进行标识,条目和快照按照添加的顺序从1以此增加,快照需要以特定格式写入到可读文档中;数据库能够恢复快照,将当前数据重置为快照的状态。同时数据库需要支持一些指令:BYE 清空数据库并退出HELP 显示提示信息LIST KEYS 显示所有的KEY值LIST ENTRIES 显示所有最近添加的条目LIST SNAPSHOTS 显示数据库中所有的快照GET < key > 显示输入key值的条目DEL < key > 删除输入key值的条目PURGE < key > 删除输入key值的条目并清楚快照SET < key >
bye
Examples (1)
> LIST KEYS
no keys
> LIST ENTRIES
no entries
> LIST SNAPSHOTS
no snapshots
> SET a 1
ok
> GET a
[1]
> POP a
1
> GET a
[]
> POP a
nil
> PUSH a 2 1
ok
> GET a
[1 2]
> APPEND a 3 4
ok
> GET a
[1 2 3 4]
> DEL a
ok
> DEL a
no such key
> BYE
bye
Examples (2)
> SET a 1
ok
> SET b 2 3
ok
> LIST KEYS
b
a
> LIST ENTRIES
b [2 3]
a [1]
> LIST SNAPSHOTS
no snapshots
> PICK a 0
index out of range
> PICK b 1
2
> GET b
[2 3]
> PLUCK b 2
3
> GET b
[2]
> DEL b
ok
> GET b
no such key
> PURGE b
ok
> BYE
bye
Examples (3)
> DROP 1
no such snapshot
> ROLLBACK 1
no such snapshot
> SET a 1 2
ok
> SET b 3 4
ok
> LIST ENTRIES
b [3 4]
a [1 2]
> SNAPSHOT
saved as snapshot 1
> SET c 5 6
ok
> LIST ENTRIES
c [5 6]
b [3 4]
a [1 2]
> SNAPSHOT
saved as snapshot 2
> PURGE b
ok
> ROLLBACK 1
ok
> CHECKOUT 2
no such snapshot
> LIST ENTRIES
a [1 2]
> LIST SNAPSHOTS
1
> BYE
bye
Examples (4)
> SET a 1 4 2 3 4 2
ok
> SNAPSHOT
saved as snapshot 1
> MIN a
1
> MAX a
4
> SUM a
16
> LEN a
6
> REV a
ok
> GET a
[2 4 3 2 4 1]
> SORT a
ok
> GET a
[1 2 2 3 4 4]
> UNIQ a
ok
> GET a
[1 2 3 4]
> CHECKOUT 1
ok
> LIST SNAPSHOTS
1
> LIST ENTRIES
a [1 4 2 3 4 2]
> BYE
bye
Examples (5)
> SET a 1 2
ok
> SET b 3 4
ok
> ARCHIVE 1 example_file.txt
no such snapshot
> SNAPSHOT
saved as snapshot 1
> LIST ENTRIES
b [3 4]
a [1 2]
> ARCHIVE 1 example_file.txt
ok
> SET c 5 6
> LIST SNAPSHOTS
1
> LIST ENTRIES
c [5 6]
b [3 4]
a [1 2]
> SNAPSHOT
saved as snapshot 2
> LIST SNAPSHOTS
2
1
> RESTORE example_file.txt
ok
> LIST ENTRIES
b [3 4]
a [1 2]
> LIST SNAPSHOTS
no snapshots
> BYE
bye
Writing 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. get-set.in and sort-uniq.in 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.Academic 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 specifically acknowledged, the work contained in this assignment/project is my own work, and has not been copied from other sources or been previously submitted for award or assessment.I understand that failure to comply with the Student Plagiarism: Coursework Policy and Procedure can lead to severe penalties as outlined under Chapter 8 of the University of Sydney By-Law 1999 (as amended). These penalties may be imposed in cases where any significant portion of my submitted work has been copied without proper acknowledgment from other sources, including published works, the Internet, existing programs, the work 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 material by 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 of faculty, and/or communicate a copy of this assignment to a plagiarism checking service or in-house computer program, and that a copy of the assignment may be maintained by the service or the School of Computer Science for the purpose of future plagiarism checking.