package cse1030.test2; import cse1030.drawing.Point2D; /** * A class for finding two dimensional points that are strictly within a square * neighbourhood surrounding a point. * * @author CSE1030_F13_14 * */ public class PointInSquare extends PointMatcher { /** * Your fields should go here if you need them. */ /** * Creates an object that matches all points strictly within a square * neighbourhood surrounding the point p. The size of the square * is determined by the parameter halfLength which is one half of * the length of the side of the square (see figure below). * *

* *

* * @param p * the point at the center of the square neighbourhood * @param halfLength * half the length of the side of the square */ public PointInSquare(Point2D p, double halfLength) { } /** * Returns the size of the square neighbourhood used for matching. * The size is equal to one-half of the length of the side of the square. * * @return the half length of the side of the square neighbourhood */ public double getHalfLength() { } /** * Checks if the point other is strictly inside the square * neighbourhood surrounding the point held by this matcher. If * other has coordinates (x, y), and the point held by * this matcher has coordinates (px, py), and the half length of * the square neighbourhood is h, then the result is * true if and only if: * *

* | px - x | < h  is  true * *

* AND * *

* | py - y | < h  is  true * * @param other * the point to check for a match * @return true if other is strictly inside the * square neighbourhood surround the point held by this matcher * @see cse1030.test2.PointMatcher#matches(cse1030.drawing.Point2D) */ @Override public boolean matches(Point2D other) { } }