net.sf.freecol.common.model
Interface Location

All Known Subinterfaces:
WorkLocation
All Known Implementing Classes:
Building, Colony, ColonyTile, Europe, IndianSettlement, Settlement, Tile, Unit

public interface Location

A place where a Locatable can be put.

See Also:
Locatable

Method Summary
 void add(Locatable locatable)
          Adds a Locatable to this Location.
 boolean canAdd(Locatable locatable)
          Checks whether or not the specified locatable may be added to this Location.
 boolean contains(Locatable locatable)
          Checks if this Location contains the specified Locatable.
 Colony getColony()
          Returns the Colony this Location is located in or null if this Location does not belong to a colony.
 GoodsContainer getGoodsContainer()
          Gets the GoodsContainer this Location use for storing it's goods.
 java.lang.String getId()
          Gets the ID of this Location.
 Tile getTile()
          Returns the Tile where this Location is located.
 int getUnitCount()
          Returns the amount of Units at this Location.
 java.util.Iterator<Unit> getUnitIterator()
          Gets a Iterator of every Unit directly located on this Location.
 java.util.List<Unit> getUnitList()
          Returns a list containing all the Units present at this Location.
 void remove(Locatable locatable)
          Removes a Locatable from this Location.
 

Method Detail

getTile

Tile getTile()
Returns the Tile where this Location is located. Or null if no Tile applies.

Returns:
The Tile where this Location is located. Or null if no Tile applies.

add

void add(Locatable locatable)
Adds a Locatable to this Location.

Parameters:
locatable - The Locatable to add to this Location.

remove

void remove(Locatable locatable)
Removes a Locatable from this Location.

Parameters:
locatable - The Locatable to remove from this Location.

contains

boolean contains(Locatable locatable)
Checks if this Location contains the specified Locatable.

Parameters:
locatable - The Locatable to test the presence of.
Returns:
  • true if the specified Locatable is on this Location and
  • false otherwise.

canAdd

boolean canAdd(Locatable locatable)
Checks whether or not the specified locatable may be added to this Location.

Parameters:
locatable - The Locatable to add.
Returns:
The result.

getUnitCount

int getUnitCount()
Returns the amount of Units at this Location.

Returns:
The amount of Units at this Location.

getUnitList

java.util.List<Unit> getUnitList()
Returns a list containing all the Units present at this Location.

Returns:
a list containing the Units present at this location.

getUnitIterator

java.util.Iterator<Unit> getUnitIterator()
Gets a Iterator of every Unit directly located on this Location.

Returns:
The Iterator.

getId

java.lang.String getId()
Gets the ID of this Location.

Returns:
The ID.
See Also:
FreeColObject.getId()

getGoodsContainer

GoodsContainer getGoodsContainer()
Gets the GoodsContainer this Location use for storing it's goods.

Returns:
The GoodsContainer or null if the Location cannot store any goods.

getColony

Colony getColony()
Returns the Colony this Location is located in or null if this Location does not belong to a colony.

Returns:
The Colony or null if not in a colony.