Package squidpony.squidgrid.zone
Class Zone.Skeleton
java.lang.Object
squidpony.squidgrid.zone.Zone.Skeleton
- All Implemented Interfaces:
Serializable,Iterable<Coord>,Zone
- Direct Known Subclasses:
CoordPackerZone,GreasedRegion,ListZone,Rectangle.Impl
- Enclosing interface:
- Zone
public abstract static class Zone.Skeleton extends Object implements Zone
A convenience partial implementation. Please try for all new
implementations of
Zone to be subtypes of this class. It usually
prove handy at some point to have a common superclass.- Author:
- smelC
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from interface squidpony.squidgrid.zone.Zone
Zone.Helper, Zone.Skeleton -
Field Summary
-
Constructor Summary
Constructors Constructor Description Skeleton() -
Method Summary
Modifier and Type Method Description booleancontains(int x, int y)booleancontains(Zone other)booleancontains(Coord c)Zoneextend()Gets a new Zone that contains all the Coords inthisplus all neighboring Coords, which can be orthogonally or diagonally adjacent to any Coord this has in it.CoordgetCenter()doublegetDiagonal()Collection<Coord>getExternalBorder()Gets a Collection of Coord values that are not in this Zone, but are adjacent to it, either orthogonally or diagonally.intgetHeight()Collection<Coord>getInternalBorder()intgetWidth()booleanintersectsWith(Zone other)Iterator<Coord>iterator()intsize()Zonetranslate(int x, int y)Zonetranslate(Coord c)intxBound(boolean smallestOrBiggest)intyBound(boolean smallestOrBiggest)
-
Field Details
-
Constructor Details
-
Method Details
-
size
- Specified by:
sizein interfaceZone- Returns:
- The number of cells that this zone contains (the size
Zone.getAll()).
-
contains
-
contains
-
contains
-
intersectsWith
- Specified by:
intersectsWithin interfaceZone- Returns:
- true if
thisandotherhave a common cell.
-
iterator
-
getWidth
-
getHeight
-
getDiagonal
- Specified by:
getDiagonalin interfaceZone- Returns:
- The approximation of the zone's diagonal, using
Zone.getWidth()andZone.getHeight().
-
xBound
-
yBound
-
getCenter
-
translate
-
translate
-
getInternalBorder
- Specified by:
getInternalBorderin interfaceZone- Returns:
- Cells in
thisthat are adjacent to a cell not inthis
-
getExternalBorder
Description copied from interface:ZoneGets a Collection of Coord values that are not in this Zone, but are adjacent to it, either orthogonally or diagonally. Related to the fringe() methods in CoordPacker and GreasedRegion, but guaranteed to use 8-way adjacency and to return a new Collection of Coord.- Specified by:
getExternalBorderin interfaceZone- Returns:
- Cells adjacent to
this(orthogonally or diagonally) that aren't inthis
-
extend
Description copied from interface:ZoneGets a new Zone that contains all the Coords inthisplus 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.- Specified by:
extendin interfaceZone- Returns:
- A variant of
thiswhere cells adjacent tothis(orthogonally or diagonally) have been added (i.e. it'sthisplusZone.getExternalBorder()).
-