public class Region extends Object
| Constructor and Description |
|---|
Region(int left,
int top,
int width,
int height) |
Region(Location location,
RectangleSize size) |
Region(Region other) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(Location location)
Check if a specified location is contained within this region.
|
boolean |
contains(Region other)
Check if a region is contained within the current region.
|
boolean |
equals(Object obj) |
int |
getHeight() |
int |
getLeft() |
Location |
getLocation() |
Location |
getMiddleOffset() |
RectangleSize |
getSize() |
Iterable<Region> |
getSubRegions(RectangleSize subRegionSize)
|
Iterable<Region> |
getSubRegions(RectangleSize subRegionSize,
boolean isFixedSize)
Returns a list of sub-regions which compose the current region.
|
int |
getTop() |
int |
getWidth() |
int |
hashCode() |
void |
intersect(Region other)
Replaces this region with the intersection of itself and
other |
boolean |
isEmpty() |
boolean |
isIntersected(Region other)
Check if a region is intersected with the current region.
|
protected void |
makeEmpty() |
void |
offset(int dx,
int dy)
Offsets the region's location (in place).
|
void |
setLocation(Location location)
Set the (top,left) position of the current region
|
String |
toString() |
public static final Region EMPTY
public Region(int left,
int top,
int width,
int height)
public Region(Location location, RectangleSize size)
public Region(Region other)
protected void makeEmpty()
public boolean isEmpty()
public Location getLocation()
public void offset(int dx,
int dy)
dx - The X axis offset.dy - The Y axis offset.public RectangleSize getSize()
public void setLocation(Location location)
location - The (top,left) position to set.public Iterable<Region> getSubRegions(RectangleSize subRegionSize, boolean isFixedSize)
subRegionSize - The default sub-region size to use.isFixedSize - If false, then sub-regions might have a
size which is smaller then subRegionSize
(thus there will be no overlap of regions).
Otherwise, all sub-regions will have the same
size, but sub-regions might overlap.subRegionSize is equal or greater than the current region,
only a single region is returned.public Iterable<Region> getSubRegions(RectangleSize subRegionSize)
public boolean contains(Region other)
other - The region to check if it is contained within the current
region.other is contained within the current region,
false otherwise.public boolean contains(Location location)
location - The location to test.public boolean isIntersected(Region other)
other - The region to check intersection with.public void intersect(Region other)
otherother - The region with which to intersect.public int getLeft()
public int getTop()
public int getWidth()
public int getHeight()
public Location getMiddleOffset()
Copyright © 2016. All rights reserved.