DefaultImageCache

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.ctdp.rfdynhud.util
Class DefaultImageCache

    java.lang.Object
      net.ctdp.rfdynhud.util.DefaultImageCache

All Implemented Interfaces:
  ImageCache

    public class DefaultImageCache

extends java.lang.Object
implements ImageCache

Default implementation of the image cache meant for game runtime.

Author:
  Marvin Froehlich (CTDP)

Constructor Summary
`DefaultImageCache()`

Method Summary
`ImageTemplate` | `add(java.lang.String name, long lastModified, ImageTemplate image)` Adds an image to the cache.
`void` | `check(java.lang.String name, long lastModified)` Checks, whether an image is cached by the given name and matches the given 'lastModified' date.
`boolean` | `contains(java.lang.String name)` Checks, whether an image exists in the cache by the given name.
`ImageTemplate` | `get(java.lang.String name)` Gets the cached image by the given name.
`int` | `getSize()`
`ImageTemplate` | `remove(java.lang.String name)` Removes an image from the cache.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DefaultImageCache

    public DefaultImageCache()

Method Detail

### getSize

    public final int getSize()

### add

    public ImageTemplate add(java.lang.String name,
                             long lastModified,
                             ImageTemplate image)

  Adds an image to the cache.

  Specified by:
    `add` in interface `ImageCache`
  Parameters:
    `name` - the name to cache by
    `lastModified` - the last modified timestamp
    `image` - the image to cache
  Returns:
    the previously cached image.

### remove

    public ImageTemplate remove(java.lang.String name)

  Removes an image from the cache.

  Specified by:
    `remove` in interface `ImageCache`
  Parameters:
    `name` - the name it is cached by
  Returns:
    the cached image, if present.

### check

    public void check(java.lang.String name,
                      long lastModified)

  Checks, whether an image is cached by the given name and matches the given 'lastModified' date.

  Specified by:
    `check` in interface `ImageCache`
  Parameters:
    `name` - the name to search for
    `lastModified` - the last modified timestamp

### contains

    public boolean contains(java.lang.String name)

  Checks, whether an image exists in the cache by the given name.

  Specified by:
    `contains` in interface `ImageCache`
  Parameters:
    `name` - the name to search for
  Returns:
    `true`, if the image is present, `false` otherwise.

### get

    public ImageTemplate get(java.lang.String name)

  Gets the cached image by the given name.

  Specified by:
    `get` in interface `ImageCache`
  Parameters:
    `name` - the name to search for
  Returns:
    the cached image or `null`, if not present.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD