commentaar isValidLocation

This commit is contained in:
Leen Dereu
2018-03-08 10:55:44 +01:00
parent 14603fa5ca
commit 42300e5b5c

View File

@@ -160,6 +160,15 @@ public class Worm {
this.location = location;
}
/**
* check whether the given location is a valid location for the worm
*
* @param location
* the location to check
* @return True if and only if the location is not equal to null and the coordinates of
* the worm are numbers
* |result == (location != null) && (!Double.isNaN(location.item1)) && (!Double.isNaN(location.item2))
*/
private boolean isValidLocation(Tuple<Double, Double>location) {
return location != null && !Double.isNaN(location.item1) && !Double.isNaN(location.item2);
}