public class Area extends Object
Constructor and Description |
---|
Area()
Constructor that sets start and end points to 0|0.
|
Area(double endX,
double endY)
Constructor that sets start point to 0|0.
|
Area(double startX,
double startY,
double endX,
double endY)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
double |
calculateHeight()
Calculates this areas height from
getStartY() and getEndY() . |
double |
calculateWidth()
Calculates this areas width from
getStartX() and getEndX() . |
boolean |
containsPoint(double x,
double y)
Returns true, if this area contains the point.
|
Area |
copy()
Creates a copy of this class.
|
Area |
endX(double newEndX) |
Area |
endY(double newEndY) |
boolean |
equals(Object obj) |
double |
getEndX() |
double |
getEndY() |
double |
getStartX() |
double |
getStartY() |
int |
hashCode() |
void |
move(double xIncrement,
double yIncrement)
Moves the area.
|
void |
setEndX(double endX) |
void |
setEndY(double endY) |
void |
setStartX(double startX) |
void |
setStartY(double startY) |
Area |
startX(double newStartX) |
Area |
startY(double newStartY) |
String |
toString() |
Area |
unite(Area area)
Returns an area surrounding this area and the one coming in.
|
public Area()
public Area(double endX, double endY)
endX
- end point's XendY
- end point's Ypublic Area(double startX, double startY, double endX, double endY)
startX
- start point's XstartY
- start point's YendX
- end point's XendY
- end point's Ypublic double calculateWidth()
getStartX()
and getEndX()
.public double calculateHeight()
getStartY()
and getEndY()
.public Area unite(Area area)
area
- the area to unite withpublic boolean containsPoint(double x, double y)
x
- point's xy
- point's ypublic void move(double xIncrement, double yIncrement)
xIncrement
- the x movementyIncrement
- the y movementpublic double getEndX()
public Area endX(double newEndX)
public void setEndX(double endX)
public double getEndY()
public Area endY(double newEndY)
public void setEndY(double endY)
public double getStartX()
public Area startX(double newStartX)
public void setStartX(double startX)
public double getStartY()
public Area startY(double newStartY)
public void setStartY(double startY)
public Area copy()
Copyright © 2020. All rights reserved.