Class TileCache.Key

java.lang.Object
org.apache.sis.image.TileCache.Key
Enclosing class:
TileCache

static final class TileCache.Key extends Object
A compound key identifying a tile of a ComputedImage.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final ComputedTiles
    The image which own the tile as a weak reference.
    private final int
    Index of the tile owned by the image.
    private final int
    Index of the tile owned by the image.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Key(ComputedTiles image, int tileX, int tileY)
    Creates a new key identifying a tile or a cached image.
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) final void
    Removes the raster associated to this key.
    boolean
    Compares this key with the given object for equality.
    (package private) final String
    error(short key)
    Returns the error message when this tile cannot be computed.
    int
    Returns a hash code value for this key.
    (package private) final Point
    Returns the tile indices.
    (package private) final boolean
    Returns true if the reference to the image has been cleared.
    Returns a string representation of this key for debugging purposes.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • image

      private final ComputedTiles image
      The image which own the tile as a weak reference. All TileCache.Key instances for the same image will share the same reference. Consequently, it is okay to compare image fields directly instead of image.get().
    • tileX

      private final int tileX
      Index of the tile owned by the image.
    • tileY

      private final int tileY
      Index of the tile owned by the image.
  • Constructor Details

    • Key

      Key(ComputedTiles image, int tileX, int tileY)
      Creates a new key identifying a tile or a cached image.
      Parameters:
      image - the image which own the tile.
      tileX - the column index of the cached tile.
      tileY - the row index of the cached tile.
  • Method Details

    • indices

      final Point indices()
      Returns the tile indices.
    • error

      final String error(short key)
      Returns the error message when this tile cannot be computed.
      Parameters:
      key - Resources.Keys.CanNotComputeTile_2 or Resources.Keys.TileErrorFlagSet_2.
    • dispose

      final void dispose()
      Removes the raster associated to this key. This method is invoked for all tiles in an image being disposed. The disposal may happen either by an explicit call to ComputedImage.dispose(), or because the image has been garbage collected.
    • isEmpty

      final boolean isEmpty()
      Returns true if the reference to the image has been cleared. The dispose() should have been invoked in such cases.
    • hashCode

      public int hashCode()
      Returns a hash code value for this key. Note that this is okay to use image directly in hash code computation instead of Reference.get() because we maintain a one-to-one relationship between ComputedImage and its Reference.
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Compares this key with the given object for equality. See hashCode() for a note about direct comparison of image references.
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Returns a string representation of this key for debugging purposes.
      Overrides:
      toString in class Object