一:有步骤地进行编写ADT
为什么先要写specific ,test,然后再写方法呢?
我地一点小小的理解是:只要test写对了,那么在实现方法后可以马上调用对用地test方法进行检查,遇到报错咱们就要去修正、完善自己的方法。
高效的流程:
All your classes must have clear documented specifications.
Deciding on its spec, devise, document, and implement tests for a class.
And then to implement the class ,once you implement one function in the class, you can use the corresponding testfunction to test it.
二:关于构造器与变量的关系
如果类中的变量只是声明,没有赋值,那么generate constructor就会生成对应的赋值方法。
如果类中的变量全都赋值了,不需要生成constructor,默认的空参构造器就好了。
三:问题记录(存在我没懂得东西,P1/graph/ConcreteEdgesGraph.java)
for(Edge<String> edge:edges)
{
if (edge.edgeEqual(newEdge)){
back = edge.getWeight();
edges.remove(edge);
break;
// return back;
//为什么这一行删了就不行呢,很奇怪
}
}
四:语法的替代:
edges.removeIf(edge -> Objects.equals(edge.getSource(), vertex) | Objects.equals(edge.getTarget(), vertex));
五:这是什么原因:
六:
一:Wrapping the FileReader in a BufferedReader
You should really taste the processing where wrapping the FileReader in a BufferedReader.
File corpus = "src/poet/mugar-omni-theater.txt";
FileReader fileReader = new FileReader(corpus);
BufferedReader bufferedReader = new BufferedReader(fileReader);