![]() |
.. (לתיקייה המכילה) | |
In part 1 - Are the provided tests sufficient? Meaning, is there a possibility that you will add another test cases?
|
Of course not. The provided tests may or may not cover everything that can go wrong with the code. We can (and will) add additional tests to make sure you did not changed the functionality of the code. |
In part 1 - After importing the dom4j project, we tried running the junit tests.
One of the tests in org.dom4j.rule.RuleTest.java fails.
|
This is OK. The rule package is out of the assignment scope as it does not test the classes you needed to change. |
In part 1 - Are we allowed to add import statement to the class?
|
Yes, as long as these are standard library classes. [Update] - You can also import other classes from the project. |
In part 2 - Are we allowed to add methods?
| Yes |
In part 2 - Can we change existing methods signatures?
| No |
In part 2 - regarding the following code in the Table class:
</br>
<br/>
if (guests.size() == capacity) { </br>
return false; </br>
}</br>
</br>
Should I replace such cases with a precondition?
if (guests.size() == capacity) { </br>
return false; </br>
}</br>
|
You should ask yourself, "is it a legal input?" The purpose of the preconditions is to not allow input which the method cannot handle. Since one can call the method in cases where the table is full (See the heuristic code) this is not something that should raise a precondition exception. Also the return value in such conditions is described in the Javadoc and should not change. |
In part 2 - Should we add a precondition which prevent adding guests which are already seated at the table?
|
Again, you should ask yourself - does it make sense? Do we want to write heuristics which will add the same guest twice? Does a code which tries adding the guests over and over is considered good? If the answer is No, you should write a precondition, otherwise you should handle it in the method body. In anyway, you should follow the description of the method in the Javadoc. Note, that if you decide to handle it in the method body, then it is not clear what the method returns. Does it return false because the guest couldn't be added, or true because basically he is seated at the table?The heuristic implemented in the il.ac.technion.heuristic package is an example code which can help you make your decisions.
|
In part 2 - When adding a new private method which will only be used in the conditions the compiler gives a warning that the method is not used.
Is this OK?
| Yes, since the compiler is clearly wrong this is not an issue. |
In part 1 - Are we allowed to add new classes / interfaces?
| No |
In part 2 - Can we override equals()?
No. Since equals() was not overridden in Guest or Person the default equals() implementation in Object is pointers comparison.Since you should only add contracts and fix bugs, this is not a property you are allowed to change. |
In part 1 - Are we allowed to change methods/classes other then those requested?
| No. You can only change the requested methods or add new methods in the same classes. |

