public class RectangleImpl extends java.lang.Object implements IRectangle
Constructor and Description |
---|
RectangleImpl(int width,
int height) |
RectangleImpl(int x,
int y,
int width,
int height) |
RectangleImpl(IRectangle other) |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(ILocation location)
Checks whether the point with the given location is inside the rectangle.
|
boolean |
contains(int x,
int y)
Checks whether the point with (x,y) is inside the rectangle.
|
boolean |
equals(java.lang.Object o) |
IDimension |
expand(int dw,
int dh) |
IDimension |
getDimensionCopy() |
int |
getHeight()
Gets the height.
|
ILocation |
getLocationCopy() |
IRectangle |
getRectangleCopy() |
int |
getWidth()
Gets the width.
|
int |
getX()
Gets the x value.
|
int |
getY()
Gets the y value.
|
int |
hashCode() |
void |
scale(double amount) |
IDimension |
setDimension(IDimension dimension) |
IDimension |
setDimension(int width,
int height) |
void |
setHeight(int height)
Sets the height.
|
ILocation |
setLocation(ILocation location) |
ILocation |
setLocation(int x,
int y) |
void |
setRectangle(int x,
int y,
int width,
int height)
Sets the location and dimension of the rectangle.
|
void |
setRectangle(IRectangle rectangle)
Sets the location and dimension of the rectangle to the values of the
given rectangle.
|
void |
setWidth(int width)
Sets the width.
|
void |
setX(int x)
Sets the x coordinate of this location.
|
void |
setY(int y)
Sets the y coordinate of this location.
|
java.lang.String |
toString() |
ILocation |
translate(int dx,
int dy) |
public RectangleImpl(int width, int height)
public RectangleImpl(int x, int y, int width, int height)
public RectangleImpl(IRectangle other)
public int getHeight()
IDimension
getHeight
in interface IDimension
public int getWidth()
IDimension
getWidth
in interface IDimension
public void setHeight(int height)
IDimension
setHeight
in interface IDimension
height
- the new height of this dimensionpublic void setWidth(int width)
IDimension
setWidth
in interface IDimension
width
- the new width of this dimensionpublic int getX()
ILocation
public int getY()
ILocation
public void setX(int x)
ILocation
public void setY(int y)
ILocation
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public IDimension expand(int dw, int dh)
public IDimension getDimensionCopy()
public void scale(double amount)
public IDimension setDimension(int width, int height)
public IDimension setDimension(IDimension dimension)
public ILocation getLocationCopy()
public ILocation setLocation(int x, int y)
public ILocation translate(int dx, int dy)
public IRectangle getRectangleCopy()
getRectangleCopy
in interface IRectangle
public void setRectangle(int x, int y, int width, int height)
IRectangle
setRectangle
in interface IRectangle
x
- the x coordinate of the rectangley
- the y coordinate of the rectanglewidth
- the width of the rectangleheight
- the height of the rectanglepublic void setRectangle(IRectangle rectangle)
IRectangle
setRectangle
in interface IRectangle
rectangle
- The rectangle which contains new location and dimension.public boolean contains(int x, int y)
IRectangle
contains
in interface IRectangle
x
- the x coordinate of the point to be testedy
- the y coordinate of the point to be testedpublic boolean contains(ILocation location)
IRectangle
contains
in interface IRectangle
location
- the location of the point to be tested