Package net.sf.freecol.common.model
Interface Location
-
- All Superinterfaces:
ObjectWithId
- All Known Implementing Classes:
Building,Colony,ColonyTile,Europe,GoodsLocation,HighSeas,IndianSettlement,Map,ServerBuilding,ServerColony,ServerColonyTile,ServerEurope,ServerIndianSettlement,ServerUnit,Settlement,Tile,Unit,UnitLocation,WorkLocation
public interface Location extends ObjectWithId
A place where aLocatablecan be put.- See Also:
Locatable
-
-
Field Summary
Fields Modifier and Type Field Description static intLOCATION_RANK_EUROPEstatic intLOCATION_RANK_HIGHSEASstatic intLOCATION_RANK_NOWHERE
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description booleanadd(Locatable locatable)Adds aLocatableto this Location.booleancanAdd(Locatable locatable)Checks whether or not the specified locatable may be added to thisLocation.booleancontains(Locatable locatable)Checks if thisLocationcontains the specifiedLocatable.ColonygetColony()Get the colony at this location.GoodsContainergetGoodsContainer()Gets theGoodsContainerthisLocationuse for storing it's goods.java.lang.StringgetId()Gets the identifier of thisLocation.IndianSettlementgetIndianSettlement()Gets the native settlement at this location.default java.lang.StringgetLocationImageKey()Get an image key for this location.StringTemplategetLocationLabel()Get a label for this location.StringTemplategetLocationLabelFor(Player player)Get a label for this location for a particular player.intgetRank()Get a integer for this location, for the benefit of location comparators.SettlementgetSettlement()Gets theSettlementthisLocationis located in.TilegetTile()Gets the Tile associated with this Location.intgetUnitCount()Gets the number of units at this Location.java.util.List<Unit>getUnitList()Gets a list of all the units present at this location.java.util.stream.Stream<Unit>getUnits()Gets a stream of all the units present at this location.static intrankOf(Location loc)Static front end to getRank.booleanremove(Locatable locatable)Removes aLocatablefrom this Location.java.lang.StringtoShortString()Get a short description of this location.Locationup()Promote this location to a more meaningful one if possible.static LocationupLoc(Location loc)Static frontend to up().
-
-
-
Field Detail
-
LOCATION_RANK_NOWHERE
static final int LOCATION_RANK_NOWHERE
- See Also:
- Constant Field Values
-
LOCATION_RANK_EUROPE
static final int LOCATION_RANK_EUROPE
- See Also:
- Constant Field Values
-
LOCATION_RANK_HIGHSEAS
static final int LOCATION_RANK_HIGHSEAS
- See Also:
- Constant Field Values
-
-
Method Detail
-
getId
java.lang.String getId()
Gets the identifier of thisLocation.- Specified by:
getIdin interfaceObjectWithId- Returns:
- The object identifier.
- See Also:
FreeColObject.getId()
-
getTile
Tile getTile()
Gets the Tile associated with this Location.- Returns:
- The Tile associated with this Location, or null if none found.
-
getLocationLabel
StringTemplate getLocationLabel()
Get a label for this location.- Returns:
- A label for this location.
-
getLocationLabelFor
StringTemplate getLocationLabelFor(Player player)
Get a label for this location for a particular player.- Parameters:
player- ThePlayerto return the name for.- Returns:
- A label for this location.
-
add
boolean add(Locatable locatable)
Adds aLocatableto this Location.- Parameters:
locatable- TheLocatableto add to this Location.- Returns:
- True if the locatable was added.
-
remove
boolean remove(Locatable locatable)
Removes aLocatablefrom this Location.- Parameters:
locatable- TheLocatableto remove from this Location.- Returns:
- True if the locatable was removed.
-
contains
boolean contains(Locatable locatable)
Checks if thisLocationcontains the specifiedLocatable.- Parameters:
locatable- TheLocatableto test the presence of.- Returns:
- True if the locatable is present at this location.
-
canAdd
boolean canAdd(Locatable locatable)
Checks whether or not the specified locatable may be added to thisLocation.- Parameters:
locatable- TheLocatableto add.- Returns:
- True if the locatable can be added to this location.
-
getUnitCount
int getUnitCount()
Gets the number of units at this Location.- Returns:
- The number of units at this Location.
-
getUnits
java.util.stream.Stream<Unit> getUnits()
Gets a stream of all the units present at this location.- Returns:
- A stream of all the units at this location.
-
getUnitList
java.util.List<Unit> getUnitList()
Gets a list of all the units present at this location.- Returns:
- A list of all the units at this location.
-
getGoodsContainer
GoodsContainer getGoodsContainer()
Gets theGoodsContainerthisLocationuse for storing it's goods.- Returns:
- The
GoodsContainerornullif theLocationcannot store any goods.
-
getSettlement
Settlement getSettlement()
Gets theSettlementthisLocationis located in.- Returns:
- The associated
Settlement, or null if none.
-
getColony
Colony getColony()
Get the colony at this location.- Returns:
- A
Colonyat this location if any, or null if none found.
-
getIndianSettlement
IndianSettlement getIndianSettlement()
Gets the native settlement at this location.- Returns:
- The
IndianSettlementat this location if any, or null if none found.
-
up
Location up()
Promote this location to a more meaningful one if possible. For example: a settlement is more meaningful than the tile it occupies.- Returns:
- A more meaningful
Location, or this one.
-
getRank
int getRank()
Get a integer for this location, for the benefit of location comparators.- Returns:
- A suitable integer.
-
toShortString
java.lang.String toShortString()
Get a short description of this location.- Returns:
- A short description.
-
upLoc
static Location upLoc(Location loc)
Static frontend to up().- Parameters:
loc- TheLocationto improve.- Returns:
- The improved
Location.
-
rankOf
static int rankOf(Location loc)
Static front end to getRank.- Parameters:
loc- ALocationto check.- Returns:
- The integer rank of the given location.
-
getLocationImageKey
default java.lang.String getLocationImageKey()
Get an image key for this location.- Returns:
- A key for image lookup, null by default.
-
-