Package squidpony.squidgrid.mapping
Class Rectangle.Impl
java.lang.Object
squidpony.squidgrid.zone.Zone.Skeleton
squidpony.squidgrid.mapping.Rectangle.Impl
- All Implemented Interfaces:
Serializable,Iterable<Coord>,Rectangle,Zone
- Enclosing interface:
- Rectangle
public static class Rectangle.Impl extends Zone.Skeleton implements Rectangle
- Author:
- smelC
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from interface squidpony.squidgrid.mapping.Rectangle
Rectangle.Impl, Rectangle.UtilsNested classes/interfaces inherited from interface squidpony.squidgrid.zone.Zone
Zone.Helper, Zone.Skeleton -
Field Summary
Fields Modifier and Type Field Description protected CoordbottomLeftprotected intheightprotected intwidth -
Constructor Summary
-
Method Summary
Modifier and Type Method Description booleancontains(int x, int y)booleancontains(Coord c)booleanequals(Object obj)Rectangleextend()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.List<Coord>getAll()CoordgetBottomLeft()CoordgetCenter()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()List<Coord>getInternalBorder()intgetWidth()inthashCode()booleanisEmpty()Iterator<Coord>iterator()intsize()StringtoString()Zonetranslate(int x, int y)intxBound(boolean smallestOrBiggest)intyBound(boolean smallestOrBiggest)Methods inherited from class squidpony.squidgrid.zone.Zone.Skeleton
contains, getDiagonal, intersectsWith, translateMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface squidpony.squidgrid.zone.Zone
contains, getDiagonal, intersectsWith, translate
-
Field Details
-
Constructor Details
-
Method Details
-
getBottomLeft
- Specified by:
getBottomLeftin interfaceRectangle- Returns:
- The bottom left coordinate of the room.
-
getWidth
-
getHeight
-
hashCode
-
equals
-
toString
-
isEmpty
-
size
- Specified by:
sizein interfaceZone- Overrides:
sizein classZone.Skeleton- Returns:
- The number of cells that this zone contains (the size
Zone.getAll()).
-
contains
- Specified by:
containsin interfaceZone- Overrides:
containsin classZone.Skeleton- Returns:
- Whether this zone contains the coordinate (x,y).
-
contains
- Specified by:
containsin interfaceZone- Overrides:
containsin classZone.Skeleton- Returns:
- Whether this zone contains
c.
-
xBound
- Specified by:
xBoundin interfaceZone- Overrides:
xBoundin classZone.Skeleton- Parameters:
smallestOrBiggest- if true, finds the smallest x-coordinate value; if false, finds the biggest.- Returns:
- The x-coordinate of the Coord within
thisthat has the smallest (or biggest) x-coordinate. Or -1 if the zone is empty.
-
yBound
- Specified by:
yBoundin interfaceZone- Overrides:
yBoundin classZone.Skeleton- Parameters:
smallestOrBiggest- if true, finds the smallest y-coordinate value; if false, finds the biggest.- Returns:
- The y-coordinate of the Coord within
thisthat has the smallest (or biggest) y-coordinate. Or -1 if the zone is empty.
-
getCenter
- Specified by:
getCenterin interfaceZone- Overrides:
getCenterin classZone.Skeleton- Returns:
- The approximate center of this zone, or null if this zone is empty.
-
getAll
-
translate
- Specified by:
translatein interfaceZone- Overrides:
translatein classZone.Skeleton- Returns:
thisshifted by(x,y)
-
getInternalBorder
- Specified by:
getInternalBorderin interfaceZone- Overrides:
getInternalBorderin classZone.Skeleton- 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- Overrides:
getExternalBorderin classZone.Skeleton- 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- Overrides:
extendin classZone.Skeleton- Returns:
- A variant of
thiswhere cells adjacent tothis(orthogonally or diagonally) have been added (i.e. it'sthisplusZone.getExternalBorder()).
-
iterator
- Specified by:
iteratorin interfaceIterable<Coord>- Overrides:
iteratorin classZone.Skeleton
-