package model;

import java.awt.geom.Point2D;

public class Rectangle {
	private Point2D.Double topleft;
	private double width;
	private double height;
	
	public Rectangle(Point2D.Double topleft, double width, double height){
		this.topleft = topleft;
		this.width = width;
		this.height = height;
	}
	
	public Rectangle(double topY, double leftX, double width, double height){
		this.topleft = new Point2D.Double(leftX, topY);
		this.width = width;
		this.height = height;
	}
	
	public static boolean collide(Rectangle r1, Rectangle r2){
		if(r1.height + r1.topleft.y < r2.topleft.y)
			return false;
		if(r2.height + r2.topleft.y < r1.topleft.y)
			return false;
		if(r1.width + r1.topleft.x < r2.topleft.x)
			return false;
		if(r2.width + r2.topleft.x < r1.topleft.x)
			return false;
		return true;
	}
	
	public boolean collidesWith(Rectangle r){
		return collide(this, r);
	}
}

@@ -40,16 +40,73 @@
 int2D;%0A%0A
+/**%0A * Represents a Rectangle.%0A * @author florian%0A *%0A */%0A
 public c
@@ -209,331 +209,1074 @@
 %0A%09%0A%09
-public Rectangle(Point2D.Double topleft, double width, double height)%7B%0A%09%09this.topleft = topleft;%0A%09%09this.width = width;%0A%09%09this.height = height;%0A%09%7D%0A%09%0A%09public Rectangle(double topY, double leftX, double width, double height)%7B%0A%09%09this.topleft = new Point2D.Double(leftX, topY);%0A%09%09this.width = width;%0A%09%09this.height = height;%0A%09%7D%0A%09
+/**%0A%09 * Creates a rectangle with the following parameters:%0A%09 * @param topleft The point to the top left of the rectangle.%0A%09 * @param width The width of the rectangle.%0A%09 * @param height The height of the rectangle.%0A%09 */%0A%09public Rectangle(Point2D.Double topleft, double width, double height)%7B%0A%09%09this.topleft = topleft;%0A%09%09this.width = width;%0A%09%09this.height = height;%0A%09%7D%0A%09%0A%09/**%0A%09 * Creates a rectangle with the following parameters:%0A%09 * @param topY The y-coordinate of the top left point of the rectangle.%0A%09 * @param leftX The x-coordinate of the top left point of the rectangle.%0A%09 * @param width The width of the rectangle.%0A%09 * @param height The height of the rectangle.%0A%09 */%0A%09public Rectangle(double topY, double leftX, double width, double height)%7B%0A%09%09this.topleft = new Point2D.Double(leftX, topY);%0A%09%09this.width = width;%0A%09%09this.height = height;%0A%09%7D%0A%09%0A%09/**%0A%09 * Checks two rectangles on whether or not they do collide.%0A%09 * @param r1 The first rectangle to check.%0A%09 * @param r2 The second rectangle to check.%0A%09 * @return true if and only if the rectangles do collide.%0A%09 */
 %0A%09pu
@@ -1602,16 +1602,202 @@
 e;%0A%09%7D%0A%09%0A
+%09/**%0A%09 * Checks if this rectangle does collide with the specified other rectangle r.%0A%09 * @param r The rectangle to check.%0A%09 * @return true if and only if the rectangles do collide.%0A%09 */%0A
 %09public 

Add documentation in class Rectangle