Commit accd5fdf authored by Ari Trachtenberg's avatar Ari Trachtenberg
Browse files

Working version

parent d4c25358
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ public abstract class Canvas implements Iterable<CanvasPoint> {
     * @return true iff unit circles centered at the points in <code>centers</code>
     *    cover all the points in this data structure.
     */
    public boolean checkCovering(ArrayList<CanvasPoint> centers) {
    final public boolean checkCovering(ArrayList<CanvasPoint> centers) {
        // check each point, one by one
        for (CanvasPoint pnt: this) {
            boolean foundCenter = false;
@@ -85,12 +85,12 @@ public abstract class Canvas implements Iterable<CanvasPoint> {
        return true;
    }

    private void _checkPoint(CanvasPoint pnt) {
    final private void _checkPoint(CanvasPoint pnt) {
        if ((pnt.x<0) || (pnt.x>Xsize) || (pnt.x<0) || (pnt.y>Ysize))
            throw new RuntimeException("Point coordinates off canvas");
    }

    private double _distance(CanvasPoint pnt1, CanvasPoint pnt2) {
    final private double _distance(CanvasPoint pnt1, CanvasPoint pnt2) {
        return Math.sqrt(
            Math.pow(pnt1.x - pnt2.x,2) +
            Math.pow(pnt1.y - pnt2.y,2)
@@ -102,7 +102,7 @@ public abstract class Canvas implements Iterable<CanvasPoint> {
    /**
     * A point on the canvas.
     */
    public static class CanvasPoint {
    final public static class CanvasPoint {
        CanvasPoint(double theX, double theY) {
            x = theX; y=theY;
        }