Package org.apache.sis.image
Class TileCache.Key
java.lang.Object
org.apache.sis.image.TileCache.Key
- Enclosing class:
- TileCache
A compound key identifying a tile of a
ComputedImage
.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate 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
ConstructorsConstructorDescriptionKey
(ComputedTiles image, int tileX, int tileY) Creates a new key identifying a tile or a cached image. -
Method Summary
Modifier and TypeMethodDescription(package private) final void
dispose()
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
hashCode()
Returns a hash code value for this key.(package private) final Point
indices()
Returns the tile indices.(package private) final boolean
isEmpty()
Returnstrue
if the reference to the image has been cleared.toString()
Returns a string representation of this key for debugging purposes.
-
Field Details
-
image
The image which own the tile as a weak reference. AllTileCache.Key
instances for the same image will share the same reference. Consequently, it is okay to compareimage
fields directly instead ofimage.get()
. -
tileX
private final int tileXIndex of the tile owned by the image. -
tileY
private final int tileYIndex 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
Returns the tile indices. -
error
Returns the error message when this tile cannot be computed.- Parameters:
key
-Resources.Keys.CanNotComputeTile_2
orResources.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 toComputedImage.dispose()
, or because the image has been garbage collected. -
isEmpty
final boolean isEmpty()Returnstrue
if the reference to the image has been cleared. Thedispose()
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 useimage
directly in hash code computation instead ofReference.get()
because we maintain a one-to-one relationship betweenComputedImage
and itsReference
. -
equals
Compares this key with the given object for equality. SeehashCode()
for a note about direct comparison ofimage
references. -
toString
Returns a string representation of this key for debugging purposes.
-