[关闭]
@w1024020103 2017-03-21T19:42:22.000000Z 字数 2281 阅读 1103

Proj2 Your Task

CS61B


Your Task
You are responsible for implementing the behavior described in the spec. Your provided skeleton code is as follows:

  1. package db;
  2. public class Database {
  3. public Database() {
  4. // YOUR CODE HERE
  5. }
  6. public String transact(String query) {
  7. return "YOUR CODE HERE";
  8. }
  9. }

You may not change the interface defined by this skeleton code. Your Database class must have a public zero argument constructor and a public transact method as defined above. The transact method takes in a string, to be treated as a query command, and returns a string: the output of executing that command on the database. It is fine to add more methods and fields though. Additionally, you may create as many of your own classes as you would like, but they must be part of the db package.
你不能改变这个框架代码所定义的接口。你的Database类必须有一个public的零参数的构造器,以及上面定义的一个public transact方法。这个transact方法接收一个string,被当做一个查询命令,然后返回一个string: 在那个数据库上执行该命令的输出。加更多的方法和成员变量是被允许的。并且,你可以创建任何数量你乐意的类,但是他们必须是db package的一部分。

A note on your database's functionality: it is very important that your implementation of print and load work correctly! We will be using them to test many other functions of your project as it is the simplest way to quickly create a table and see its contents. A solution that has bugs in either of these functions will receive very few points, regardless of the quality of the rest of the implementation.
一点关于你的数据库功能的注意事项:你的print和load功能实施得顺利非常重要!我们会用到他们来测试你项目中的其他很多功能,因为最简单的方式就是很快地创建一个table然后看它的内容。

You must not allow your program to crash as the result of bad input (or incorrect code that causes exceptions). If a query is malformed or attempts to perform an illegal operation (such as add an int and a String), an appropriate error message should be returned to the user. These error messages must take the form ERROR: <relevant message here>. It does not matter exactly what the relevant message is, but for your own debugging purposes, good messages would help.
你不能让你的程序因为错误的输入而崩溃(或者是因为那些导致异常的代码)。如果一个查询是畸形的或者试图进行不合法的运算(比如使一个int和一个string相加),一个适当的错误信息应该返回给用户。这些错误信息必须按照一下的格式:<relevant message here>。具体的信息是怎样的并不重要,但是为了你自己的debugging目标,好的信息是很有帮助的。

You may use any classes from the following standard library packages:
java.util
java.util.regex
java.io
java.nio

You may also use any packages provided in the skeleton javalib folder, including org.JUnit and jh61b.

If you use any packages outside of these or the provided code, your project will receive zero points.

If you feel you should be able to use a standard library class that is not included in these packages, ask on Piazza. It is unlikely, but possible. You may NOT use any third party libraries, e.g. Apache Commons library.

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注