class ImageRect {

	public void validate() {
		Integer croph = getHeight();
		Integer cropw = getWidth();
		Integer startx = getStartX();
		Integer starty = getStartY();
		// Check whether all required crop parameters have been set when at least one crop parameter has been set.
		boolean hasOneCropParameter = croph != null || cropw != null || startx != null || starty != null;
		if (hasOneCropParameter) {
			if (croph != null && croph <= 0) {
				throw error(BAD_REQUEST, "image_error_parameter_positive", ImageManipulationParameters.RECT_QUERY_PARAM_KEY, String.valueOf(croph));
			}

			if (cropw != null && cropw <= 0) {
				throw error(BAD_REQUEST, "image_error_parameter_positive", ImageManipulationParameters.RECT_QUERY_PARAM_KEY, String.valueOf(cropw));
			}

			if (startx != null && startx <= -1) {
				throw error(BAD_REQUEST, "image_error_crop_start_not_negative", ImageManipulationParameters.RECT_QUERY_PARAM_KEY, String.valueOf(
						startx));
			}

			if (starty != null && starty <= -1) {
				throw error(BAD_REQUEST, "image_error_crop_start_not_negative", ImageManipulationParameters.RECT_QUERY_PARAM_KEY, String.valueOf(
						starty));
			}
		}

	}

	public  ImageRect(String dimensions);
	public  ImageRect(int startX, int startY, int height, int width);
	public  ImageRect();

}