Class TileItem

    • Field Detail

      • logger

        private static final java.util.logging.Logger logger
      • tile

        protected Tile tile
        The tile where the tile item is.
    • Constructor Detail

      • TileItem

        protected TileItem​(Game game,
                           Tile tile)
        Creates a new TileItem.
        Parameters:
        game - The enclosing Game.
        tile - The location of this TileItem.
      • TileItem

        public TileItem​(Game game,
                        FreeColXMLReader xr)
        Creates a new TileItem from an XML stream.
        Parameters:
        game - The enclosing Game.
        xr - The input stream containing the XML.
      • TileItem

        public TileItem​(Game game,
                        java.lang.String id)
        Initiates a new TileItem with the given identifier. The object should later be initialized by calling either FreeColGameObject.readFromXML(FreeColXMLReader).
        Parameters:
        game - The enclosing Game.
        id - The object identifier.
    • Method Detail

      • getZIndex

        public abstract int getZIndex()
        Get the ZIndex value.
        Returns:
        The z-index.
      • isTileTypeAllowed

        public abstract boolean isTileTypeAllowed​(TileType tileType)
        Is a tile type compatible with this tile item?
        Parameters:
        tileType - The TileType to check.
        Returns:
        True if the tile type is compatible.
      • applyBonus

        public abstract int applyBonus​(GoodsType goodsType,
                                       UnitType unitType,
                                       int potential)
        Applies the production bonus for the given goods type and unit type to the given potential production.
        Parameters:
        goodsType - The GoodsType to produce.
        unitType - The UnitType that is to work.
        potential - The base potential production.
        Returns:
        The production with resource bonuses.
      • canProduce

        public abstract boolean canProduce​(GoodsType goodsType,
                                           UnitType unitType)
        Does this tile item allow its enclosing tile to produce a given goods type?
        Parameters:
        goodsType - The GoodsType to produce.
        unitType - The optional unitType to produce with.
        Returns:
        True if this tile item produces the goods.
      • getProductionModifiers

        public abstract java.util.stream.Stream<Modifier> getProductionModifiers​(GoodsType goodsType,
                                                                                 UnitType unitType)
        Gets the production modifiers for the given type of goods and unit.
        Parameters:
        goodsType - The GoodsType to produce.
        unitType - The optional unitType to produce them.
        Returns:
        A stream of the applicable modifiers.
      • isNatural

        public abstract boolean isNatural()
        Is this a natural TileItem?
        Returns:
        True if this is a natural TileItem.
      • isComplete

        public abstract boolean isComplete()
        Is this improvement complete?
        Returns:
        True if complete.
      • getLayer

        public abstract Map.Layer getLayer()
        Get the layer associated with this tile item.
        Returns:
        The layer.
      • getLocation

        public Location getLocation()
        Gets the location of this Locatable.
        Specified by:
        getLocation in interface Locatable
        Returns:
        The location of this Locatable.
      • setLocation

        public boolean setLocation​(Location newLocation)
        Sets the location for this Locatable.
        Specified by:
        setLocation in interface Locatable
        Parameters:
        newLocation - The new Location for the Locatable.
        Returns:
        True if the location change succeeds.
      • isInEurope

        public boolean isInEurope()
        Is this locatable in Europe.
        Specified by:
        isInEurope in interface Locatable
        Returns:
        True if the Locatable is in Europe.
      • getTile

        public Tile getTile()
        Get the Tile where this Locatable is located, or null if it is in Europe.
        Specified by:
        getTile in interface Locatable
        Returns:
        The Tile where this Locatable is located, if any.
      • getSpaceTaken

        public int getSpaceTaken()
        Gets the number of cargo slots consumed when this Locatable if put onto a carrier.
        Specified by:
        getSpaceTaken in interface Locatable
        Returns:
        The number of cargo slots required.
      • getNameKey

        public abstract java.lang.String getNameKey()
        Gets the name of this named object. Try to avoid using this directly except in i18n-related routines or to implement itself in more complext objects.
        Specified by:
        getNameKey in interface Named
        Returns:
        The name of the Named.
      • copyIn

        public <T extends FreeColObject> boolean copyIn​(T other)
        Copy another FreeColObject into this one if it is compatible.
        Overrides:
        copyIn in class FreeColGameObject
        Type Parameters:
        T - The FreeColObject subclass of the object to copy in.
        Parameters:
        other - The other object.
        Returns:
        True if the copy in is succesful.