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()
IDimensiongetHeight in interface IDimensionpublic int getWidth()
IDimensiongetWidth in interface IDimensionpublic void setHeight(int height)
IDimensionsetHeight in interface IDimensionheight - the new height of this dimensionpublic void setWidth(int width)
IDimensionsetWidth in interface IDimensionwidth - the new width of this dimensionpublic int getX()
ILocationpublic int getY()
ILocationpublic void setX(int x)
ILocationpublic void setY(int y)
ILocationpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic 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 IRectanglepublic void setRectangle(int x,
int y,
int width,
int height)
IRectanglesetRectangle in interface IRectanglex - 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)
IRectanglesetRectangle in interface IRectanglerectangle - The rectangle which contains new location and dimension.public boolean contains(int x,
int y)
IRectanglecontains in interface IRectanglex - the x coordinate of the point to be testedy - the y coordinate of the point to be testedpublic boolean contains(ILocation location)
IRectanglecontains in interface IRectanglelocation - the location of the point to be tested