package com.nilhcem.mowitnow.core;

import java.awt.Point;
import java.security.InvalidParameterException;

/**
 * Environment (garden) that contains mowers.
 * <p>It may also contain grass, flowers, trees, moles... but we won't be too picky</p>
 */
public final class Field {
	private final int width;
	private final int height;

	/**
	 * Creates a new field, specifying its dimensions.
	 *
	 * @param width maximum width of the field.
	 * @param height maximum height of the field.
	 * @throws InvalidParameterException when width or height < 1.
	 */
	public Field(int width, int height) {
		if (width < 1) {
			throw new InvalidParameterException("Width should not be < 1");
		}
		if (height < 1) {
			throw new InvalidParameterException("Height should not be < 1");
		}

		this.width = width;
		this.height = height;
	}

	/**
	 * Indicates whether coordinates are valid.
	 *
	 * @param coordinate the coordinate to check.
	 * @return true if coordinate is in field, or false if outside field boundaries.
	 */
	public boolean isValidLocation(Point location) {
		return (location.x >= 0 && location.x < width &&
				location.y >= 0 && location.y < height);
	}
}

@@ -818,16 +818,108 @@
 ht;%0A%09%7D%0A%0A
+%09public int getWidth() %7B%0A%09%09return width;%0A%09%7D%0A%0A%09public int getHeight() %7B%0A%09%09return height;%0A%09%7D%0A%0A
 %09/**%0A%09 *

Add getWidth/Height method for Field