org.jagatoo.loaders.textures.cache
Class TextureCache

java.lang.Object
  extended by org.jagatoo.loaders.textures.cache.TextureCache
Direct Known Subclasses:
HashTextureCache, WeakLinkedTextureCache

public abstract class TextureCache
extends java.lang.Object

A TextureCache caches Textures, so that they don't get loaded multiple times.


Constructor Summary
protected TextureCache()
           
 
Method Summary
 void add(java.lang.String key, AbstractTexture texture)
          Removes the Texture from the cache.
protected abstract  void addImpl(java.lang.String key, AbstractTexture texture)
          Removes the Texture from the cache.
abstract  void clear()
          Clears the Texture-cache.
abstract  AbstractTexture get(java.lang.String key)
           
 java.lang.String[] getCachedKeys()
           
abstract  java.util.Collection<AbstractTexture> getCachedTextures()
           
 boolean isEnabled()
           
 void popEnabled()
           
 void pushEnabled(boolean enabled)
           
 void remove(AbstractTexture texture)
          Removes the Texture from the cache.
protected abstract  void removeImpl(AbstractTexture texture)
          Removes the Texture from the cache.
 void setEnabled(boolean enabled)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextureCache

protected TextureCache()
Method Detail

setEnabled

public void setEnabled(boolean enabled)

pushEnabled

public void pushEnabled(boolean enabled)

popEnabled

public void popEnabled()

isEnabled

public final boolean isEnabled()

addImpl

protected abstract void addImpl(java.lang.String key,
                                AbstractTexture texture)
Removes the Texture from the cache.

Parameters:
key - the cache-key of the Texture to be removed.

add

public final void add(java.lang.String key,
                      AbstractTexture texture)
Removes the Texture from the cache.

Parameters:
key - the cache-key of the Texture to be removed.

removeImpl

protected abstract void removeImpl(AbstractTexture texture)
Removes the Texture from the cache.

Parameters:
texture - the Texture to be removed

remove

public final void remove(AbstractTexture texture)
Removes the Texture from the cache.

Parameters:
texture - the Texture to be removed

get

public abstract AbstractTexture get(java.lang.String key)
Parameters:
key -
Returns:
the Texture cached under the given key or null.

getCachedKeys

public final java.lang.String[] getCachedKeys()

getCachedTextures

public abstract java.util.Collection<AbstractTexture> getCachedTextures()

clear

public abstract void clear()
Clears the Texture-cache.