public abstract static class Zone.Skeleton extends java.lang.Object implements Zone
Zone to be subtypes of this class. It usually
prove handy at some point to have a common superclass.Zone.Helper, Zone.Skeleton| Modifier and Type | Field and Description |
|---|---|
protected int |
height |
protected int |
width |
| Constructor and Description |
|---|
Skeleton() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(Coord c) |
boolean |
contains(int x,
int y) |
boolean |
contains(Zone other) |
Zone |
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. |
Coord |
getCenter() |
double |
getDiagonal() |
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.Collection<Coord> |
getInternalBorder() |
int |
getWidth() |
boolean |
intersectsWith(Zone other) |
java.util.Iterator<Coord> |
iterator() |
int |
size() |
Zone |
translate(Coord c) |
Zone |
translate(int x,
int y) |
int |
xBound(boolean smallestBound) |
int |
yBound(boolean smallestBound) |
public int size()
size in interface ZoneZone.getAll()).public boolean contains(int x,
int y)
public boolean contains(Coord c)
public boolean contains(Zone other)
public boolean intersectsWith(Zone other)
intersectsWith in interface Zonethis and other have a common cell.public java.util.Iterator<Coord> iterator()
iterator in interface java.lang.Iterable<Coord>public int getWidth()
public int getHeight()
public double getDiagonal()
getDiagonal in interface ZoneZone.getWidth() and Zone.getHeight().public int xBound(boolean smallestBound)
public int yBound(boolean smallestBound)
public Coord getCenter()
public Zone translate(int x, int y)
public java.util.Collection<Coord> getInternalBorder()
getInternalBorder in interface Zonethis that are adjacent to a cell not in
thispublic java.util.Collection<Coord> getExternalBorder()
ZonegetExternalBorder in interface Zonethis (orthogonally or diagonally) that
aren't in thispublic Zone 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 Zonethis where cells adjacent to this
(orthogonally or diagonally) have been added (i.e. it's this
plus Zone.getExternalBorder()).Copyright © Eben Howard 2012–2022. All rights reserved.