public static class Rectangle.Impl extends Zone.Skeleton implements Rectangle
Rectangle.Impl, Rectangle.UtilsZone.Helper, Zone.Skeleton| Modifier and Type | Field and Description |
|---|---|
protected Coord |
bottomLeft |
protected int |
height |
protected int |
width |
| Constructor and Description |
|---|
Impl(Coord bottomLeft,
int width,
int height) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(Coord c) |
boolean |
contains(int x,
int y) |
boolean |
equals(java.lang.Object obj) |
Rectangle |
extend()
Gets a new Zone that contains all the Coords in
this plus all
neighboring Coords, which can be orthogonally or diagonally adjacent
to any Coord this has in it. |
java.util.List<Coord> |
getAll() |
Coord |
getBottomLeft() |
Coord |
getCenter() |
java.util.Collection<Coord> |
getExternalBorder()
Gets a Collection of Coord values that are not in this Zone, but are
adjacent to it, either orthogonally or diagonally.
|
int |
getHeight() |
java.util.List<Coord> |
getInternalBorder() |
int |
getWidth() |
int |
hashCode() |
boolean |
isEmpty() |
java.util.Iterator<Coord> |
iterator() |
int |
size() |
java.lang.String |
toString() |
Zone |
translate(int x,
int y) |
int |
xBound(boolean smallestBound) |
int |
yBound(boolean smallestBound) |
contains, getDiagonal, intersectsWith, translateclone, finalize, getClass, notify, notifyAll, wait, wait, waitcontains, getDiagonal, intersectsWith, translateprotected final Coord bottomLeft
protected final int width
protected final int height
public Impl(Coord bottomLeft, int width, int height)
public Coord getBottomLeft()
getBottomLeft in interface Rectanglepublic int getWidth()
public int getHeight()
public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean isEmpty()
public int size()
size in interface Zonesize in class Zone.SkeletonZone.getAll()).public boolean contains(int x,
int y)
contains in interface Zonecontains in class Zone.Skeletonpublic boolean contains(Coord c)
contains in interface Zonecontains in class Zone.Skeletonc.public int xBound(boolean smallestBound)
xBound in interface ZonexBound in class Zone.SkeletonsmallestBound - if true, finds the smallest x-coordinate value;
if false, finds the biggest.this that has the
smallest (or biggest) x-coordinate. Or -1 if the zone is empty.public int yBound(boolean smallestBound)
yBound in interface ZoneyBound in class Zone.SkeletonsmallestBound - if true, finds the smallest y-coordinate value;
if false, finds the biggest.this that has the
smallest (or biggest) y-coordinate. Or -1 if the zone is empty.public Coord getCenter()
getCenter in interface ZonegetCenter in class Zone.Skeletonpublic java.util.List<Coord> getAll()
public Zone translate(int x, int y)
translate in interface Zonetranslate in class Zone.Skeletonthis shifted by (x,y)public java.util.List<Coord> getInternalBorder()
getInternalBorder in interface ZonegetInternalBorder in class Zone.Skeletonthis that are adjacent to a cell not in
thispublic java.util.Collection<Coord> getExternalBorder()
ZonegetExternalBorder in interface ZonegetExternalBorder in class Zone.Skeletonthis (orthogonally or diagonally) that
aren't in thispublic Rectangle extend()
Zonethis plus all
neighboring Coords, which can be orthogonally or diagonally adjacent
to any Coord this has in it. Related to the expand() methods in
CoordPacker and GreasedRegion, but guaranteed to use 8-way adjacency
and to return a new Zone.extend in interface Zoneextend in class Zone.Skeletonthis where cells adjacent to this
(orthogonally or diagonally) have been added (i.e. it's this
plus Zone.getExternalBorder()).public java.util.Iterator<Coord> iterator()
iterator in interface java.lang.Iterable<Coord>iterator in class Zone.SkeletonCopyright © Eben Howard 2012–2022. All rights reserved.