public abstract class AbstractRectangle extends Object implements IRectangle
IRectangle
, obtaining only the location and
dimensions from the derived class.OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP
Constructor and Description |
---|
AbstractRectangle() |
Modifier and Type | Method and Description |
---|---|
Rectangle |
bounds()
Returns a copy of the bounding rectangle for this shape.
|
Rectangle |
bounds(Rectangle target)
Initializes the supplied rectangle with this shape's bounding rectangle.
|
Rectangle |
clone()
Returns a mutable copy of this rectangle.
|
boolean |
contains(int px,
int py)
Returns true if this shape contains the specified point.
|
boolean |
contains(int rx,
int ry,
int rw,
int rh)
Returns true if this shape completely contains the specified rectangle.
|
boolean |
contains(IPoint point)
Returns true if this shape contains the supplied point.
|
boolean |
contains(IRectangle rect)
Returns true if this shape completely contains the supplied rectangle.
|
boolean |
equals(Object obj) |
int |
hashCode() |
Rectangle |
intersection(int rx,
int ry,
int rw,
int rh)
Returns the intersection of the specified rectangle and this rectangle (i.e.
|
Rectangle |
intersection(IRectangle r)
Returns the intersection of the supplied rectangle and this rectangle (i.e.
|
boolean |
intersects(int rx,
int ry,
int rw,
int rh)
Returns true if this shape intersects the specified rectangle.
|
boolean |
intersects(IRectangle rect)
Returns true if this shape intersects the supplied rectangle.
|
boolean |
isEmpty()
Returns true if this shape encloses no area.
|
Point |
location()
Returns a copy of this rectangle's upper-left corner.
|
Point |
location(Point target)
Initializes the supplied point with this rectangle's upper-left corner.
|
int |
maxX()
Returns the maximum x-coordinate of the framing rectangle.
|
int |
maxY()
Returns the maximum y-coordinate of the framing rectangle.
|
int |
minX()
Returns the minimum x-coordinate of the framing rectangle.
|
int |
minY()
Returns the minimum y-coordinate of the framing rectangle.
|
int |
outcode(int px,
int py)
Returns a set of flags indicating where the specified point lies in relation to the bounds
of this rectangle.
|
int |
outcode(IPoint p)
Returns a set of flags indicating where the supplied point lies in relation to the bounds of
this rectangle.
|
Dimension |
size()
Returns a copy of this rectangle's size.
|
Dimension |
size(Dimension target)
Initializes the supplied dimension with this rectangle's size.
|
String |
toString() |
Rectangle |
union(IRectangle r)
Returns the union of the supplied rectangle and this rectangle (i.e.
|
height, width, x, y
public int minX()
IRectangle
minX
in interface IRectangle
public int minY()
IRectangle
minY
in interface IRectangle
public int maxX()
IRectangle
(x + width - 1)
to
be a rectangle's maximum x-coordinate.maxX
in interface IRectangle
public int maxY()
IRectangle
(y + height - 1)
to be a rectangle's maximum x-coordinate.maxY
in interface IRectangle
public Point location()
IRectangle
location
in interface IRectangle
public Point location(Point target)
IRectangle
location
in interface IRectangle
public Dimension size()
IRectangle
size
in interface IRectangle
public Dimension size(Dimension target)
IRectangle
size
in interface IRectangle
public Rectangle intersection(int rx, int ry, int rw, int rh)
IRectangle
intersection
in interface IRectangle
public Rectangle intersection(IRectangle r)
IRectangle
intersection
in interface IRectangle
public Rectangle union(IRectangle r)
IRectangle
union
in interface IRectangle
public int outcode(int px, int py)
IRectangle
IRectangle.OUT_LEFT
, etc.outcode
in interface IRectangle
public int outcode(IPoint p)
IRectangle
IRectangle.OUT_LEFT
, etc.outcode
in interface IRectangle
public Rectangle clone()
IRectangle
clone
in interface IRectangle
clone
in class Object
public boolean isEmpty()
IShape
public boolean contains(int px, int py)
IShape
public boolean contains(IPoint point)
IShape
public boolean contains(int rx, int ry, int rw, int rh)
IShape
public boolean contains(IRectangle rect)
IShape
public boolean intersects(int rx, int ry, int rw, int rh)
IShape
intersects
in interface IShape
public boolean intersects(IRectangle rect)
IShape
intersects
in interface IShape
public Rectangle bounds()
IShape
public Rectangle bounds(Rectangle target)
IShape
Copyright © 2017. All rights reserved.