All Implemented Interfaces:
ICustomPropertyProvider, ITile

public class Tile extends CustomPropertyProvider implements ITile
  • Field Details

  • Constructor Details

    • Tile

      public Tile()
      Instantiates a new Tile instance.
    • Tile

      public Tile(Tile original)
      Instantiates a new Tile instance with the same attributes as a given Tile.
      Parameters:
      original - The original tile from which the values will be copied to this new instance.
    • Tile

      public Tile(int gidBitmask)
      Instantiates a new Tile instance.
      Parameters:
      gidBitmask - The grid ID bitmask used to identify flags of this instance.
      See Also:
  • Method Details

    • hasCustomProperty

      public boolean hasCustomProperty(String name)
      Description copied from interface: ICustomPropertyProvider
      Checks if a custom property with the given name is present.
      Specified by:
      hasCustomProperty in interface ICustomPropertyProvider
      Overrides:
      hasCustomProperty in class CustomPropertyProvider
      Parameters:
      name - the name of the custom property
      Returns:
      true if a custom property with the given name is present. False otherwise.
    • getProperties

      public Map<String,ICustomProperty> getProperties()
      Description copied from interface: ICustomPropertyProvider
      Returns a Map view of the custom properties for this ICustomPropertyProvider.
      Specified by:
      getProperties in interface ICustomPropertyProvider
      Overrides:
      getProperties in class CustomPropertyProvider
      Returns:
      a Map view of the custom properties for this ICustomPropertyProvider
    • setProperties

      public void setProperties(Map<String,ICustomProperty> props)
      Description copied from interface: ICustomPropertyProvider
      Sets all the custom properties on this object to the provided values. Properties are added when they only exist in the provided properties, and deleted when they only exist in the current properties.
      Specified by:
      setProperties in interface ICustomPropertyProvider
      Overrides:
      setProperties in class CustomPropertyProvider
      Parameters:
      props - the new list of properties
    • isFlippedDiagonally

      public boolean isFlippedDiagonally()
      Specified by:
      isFlippedDiagonally in interface ITile
    • isFlippedHorizontally

      public boolean isFlippedHorizontally()
      Specified by:
      isFlippedHorizontally in interface ITile
    • isFlippedVertically

      public boolean isFlippedVertically()
      Specified by:
      isFlippedVertically in interface ITile
    • isFlipped

      public boolean isFlipped()
      Specified by:
      isFlipped in interface ITile
    • getImage

      public BufferedImage getImage()
      Specified by:
      getImage in interface ITile
    • getGridId

      public int getGridId()
      Description copied from interface: ITile
      Gets the grid id.
      Specified by:
      getGridId in interface ITile
      Returns:
      the grid id
    • getTileCoordinate

      public Point getTileCoordinate()
      Description copied from interface: ITile
      Gets the tile coordinate.
      Specified by:
      getTileCoordinate in interface ITile
      Returns:
      the tile coordinate
    • getTilesetEntry

      public ITilesetEntry getTilesetEntry()
      Specified by:
      getTilesetEntry in interface ITile
    • equals

      public boolean equals(Object anObject)
      Description copied from interface: ITile
      Tests for equality between two tiles. Two tiles are equal if they have the same grid ID, flipped flags, and tileset entry.
      Specified by:
      equals in interface ITile
      Overrides:
      equals in class Object
      Parameters:
      anObject - The tile to test equality for
      Returns:
      Whether the provided tile is equal to this tile, or false if anObject is not a tile
    • hashCode

      public int hashCode()
      Description copied from interface: ITile
      Computes a hash code for this tile. A tile's hash code is equal to its stored grid ID, i.e. the gid bitmask, xor the tileset entry's hash code.
      Specified by:
      hashCode in interface ITile
      Overrides:
      hashCode in class Object
      Returns:
      The hash code for this tile
    • toString

      public String toString()
      Overrides:
      toString in class Object