public abstract class AreaImpl extends java.lang.Object implements Area
Modifier and Type | Field and Description |
---|---|
protected java.util.List<Area> |
accessibleNeighbors |
protected java.util.List<Base> |
bases |
protected TilePosition |
bottomRight |
protected int |
buildableTileCount |
protected java.util.List<ChokePoint> |
chokePoints |
protected java.util.Map<Area,java.util.List<ChokePoint>> |
chokePointsByArea |
protected java.util.List<Geyser> |
geysers |
protected GroupId |
groupId |
protected Altitude |
highestAltitude |
protected int |
highGroundTileCount |
protected java.util.List<Mineral> |
minerals |
protected int |
tileCount |
protected TilePosition |
topLeft |
protected int |
veryHighGroundTileCount |
Modifier | Constructor and Description |
---|---|
protected |
AreaImpl(AreaId areaId,
WalkPosition top,
int miniTileCount) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object object) |
java.util.List<Area> |
getAccessibleNeighbors()
Returns the accessible neighboring Areas.
- The accessible neighboring Areas are a subset of the neighboring Areas (the neighboring Areas can be iterated using ChokePointsByArea()). - Two neighboring Areas are accessible from each over if at least one the ChokePoints they share is not Blocked. |
java.util.List<Base> |
getBases()
Returns the Bases contained in this Area.
|
TilePosition |
getBottomRight()
Returns the bottom right position of the bounding box of this area.
|
TilePosition |
getBoundingBoxSize()
Returns the bounding box size of this area.
|
java.util.List<ChokePoint> |
getChokePoints()
Returns the ChokePoints between this Area and the neighboring ones.
- Note: if there are no neighboring Areas, then an empty set is returned. - Note: there may be more ChokePoints returned than the number of neighboring Areas, as there may be several ChokePoints between two Areas. |
java.util.List<ChokePoint> |
getChokePoints(Area area)
Returns the ChokePoints between this Area and the specified area.
- Assumes the specified area is a neighbor of this area, i.e. |
java.util.Map<Area,java.util.List<ChokePoint>> |
getChokePointsByArea()
Returns the ChokePoints of this Area grouped by neighboring Areas.
|
java.util.List<Geyser> |
getGeysers()
Returns the Geysers contained in this Area.
|
GroupId |
getGroupId()
- Unique id > 0 of the group of Areas which are accessible from this Area.
- For each pair (a, b) of Areas: a->GroupId() == b->GroupId() <==> a->AccessibleFrom(b) - A groupId uniquely identifies a maximum set of mutually accessible Areas, that is, in the absence of blocking ChokePoints, a continent. |
Altitude |
getHighestAltitude()
Returns the highest altitude observed in this area.
|
int |
getHighGroundPercentage()
Returns the percentage of high ground tiles in this area.
|
AreaId |
getId()
- Unique id > 0 of this Area.
|
int |
getLowGroundPercentage()
Returns the percentage of low ground tiles in this area.
|
java.util.List<Mineral> |
getMinerals()
Returns the Minerals contained in this Area.
|
int |
getSize()
Returns the number of MiniTiles in this area.
|
WalkPosition |
getTop()
|
TilePosition |
getTopLeft()
Returns the top left position of the bounding box of this area.
|
int |
getVeryHighGroundPercentage()
Returns the percentage of very high ground tiles in this area.
|
WalkPosition |
getWalkPositionWithHighestAltitude()
Returns the position of the MiniTile with the highest altitude value.
|
int |
hashCode() |
boolean |
isAccessibleFrom(Area area)
Returns whether this Area is accessible from the specified area, that is, if they share the
same GroupId().
- Note: accessibility is always symmetrical. - Note: even if a and b are neighboring Areas, we can have: a->AccessibleFrom(b) and not: contains(a->AccessibleNeighbors(), b) |
void |
onMineralDestroyed(Mineral mineral) |
protected GroupId groupId
protected Altitude highestAltitude
protected TilePosition topLeft
protected TilePosition bottomRight
protected int tileCount
protected int buildableTileCount
protected int highGroundTileCount
protected int veryHighGroundTileCount
protected final java.util.Map<Area,java.util.List<ChokePoint>> chokePointsByArea
protected final java.util.List<Area> accessibleNeighbors
protected final java.util.List<ChokePoint> chokePoints
protected final java.util.List<Mineral> minerals
protected final java.util.List<Geyser> geysers
protected final java.util.List<Base> bases
protected AreaImpl(AreaId areaId, WalkPosition top, int miniTileCount)
public AreaId getId()
Area
public GroupId getGroupId()
Area
getGroupId
in interface Area
public TilePosition getTopLeft()
Area
getTopLeft
in interface Area
public TilePosition getBottomRight()
Area
getBottomRight
in interface Area
public TilePosition getBoundingBoxSize()
Area
getBoundingBoxSize
in interface Area
public WalkPosition getWalkPositionWithHighestAltitude()
Area
getWalkPositionWithHighestAltitude
in interface Area
public WalkPosition getTop()
Area
public Altitude getHighestAltitude()
Area
getHighestAltitude
in interface Area
public int getSize()
Area
public int getLowGroundPercentage()
Area
getLowGroundPercentage
in interface Area
public int getHighGroundPercentage()
Area
getHighGroundPercentage
in interface Area
public int getVeryHighGroundPercentage()
Area
getVeryHighGroundPercentage
in interface Area
public java.util.List<ChokePoint> getChokePoints()
Area
getChokePoints
in interface Area
Area.getChokePoints(Area)
public java.util.List<ChokePoint> getChokePoints(Area area)
Area
getChokePoints
in interface Area
area
- the specified areapublic java.util.Map<Area,java.util.List<ChokePoint>> getChokePointsByArea()
Area
getChokePointsByArea
in interface Area
public java.util.List<Area> getAccessibleNeighbors()
Area
getAccessibleNeighbors
in interface Area
ChokePoint.isBlocked()
public boolean isAccessibleFrom(Area area)
Area
isAccessibleFrom
in interface Area
area
- the specified areaArea.getGroupId()
public java.util.List<Mineral> getMinerals()
Area
getMinerals
in interface Area
public java.util.List<Geyser> getGeysers()
Area
getGeysers
in interface Area
public java.util.List<Base> getBases()
Area
public void onMineralDestroyed(Mineral mineral)
public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object