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 ComputedTilesThe image which own the tile as a weak reference.private final intIndex of the tile owned by the image.private final intIndex 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 voiddispose()Removes the raster associated to this key.booleanCompares this key with the given object for equality.(package private) final Stringerror(short key) Returns the error message when this tile cannot be computed.inthashCode()Returns a hash code value for this key.(package private) final Pointindices()Returns the tile indices.(package private) final booleanisEmpty()Returnstrueif 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.Keyinstances for the same image will share the same reference. Consequently, it is okay to compareimagefields 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_2orResources.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()Returnstrueif 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 useimagedirectly in hash code computation instead ofReference.get()because we maintain a one-to-one relationship betweenComputedImageand itsReference. -
equals
Compares this key with the given object for equality. SeehashCode()for a note about direct comparison ofimagereferences. -
toString
Returns a string representation of this key for debugging purposes.
-