legacy.resource
Class ResourceManager

java.lang.Object
  extended by legacy.resource.ResourceManager

public class ResourceManager
extends java.lang.Object

ResourceManager.class

Author:
Benjamin Tarrant

Method Summary
protected  void addGroup(ResourceGroup group)
          addGroup is called from inside the ResourceGroup class to additself to the singleton ResourceManager
Warning this will not allow groups of the same name to be added.
 java.util.List<java.lang.String> getAllResources()
          getAllResources() simply returns all known resource groups.
 java.util.List<java.lang.String> getChachedResources()
          getChachedResources() simply returns all chached or ready resource groups.
 Codec[] getFontCodecs()
          getFontCodecsFor(String ext) returns a list of codecs for this type
 Codec[] getFontCodecsFor(java.lang.String ext)
          getFontCodecsFor(String ext) returns a list of codecs which may be associated with this extension
 Codec[] getImageCodecs()
          getImageCodecsFor(String ext) returns a list of codecs for this type
 Codec[] getImageCodecsFor(java.lang.String ext)
          getImageCodecsFor(String ext) returns a list of codecs which may be associated with this extension
 float getLoadStatus()
          Returns the load status as a fraction of 100% of loadedSize items in required group
 Codec[] getMidiCodecs()
          getMidiCodecsFor(String ext) returns a list of codecs for this type
 Codec[] getMidiCodecsFor(java.lang.String ext)
          getMidiCodecsFor(String ext) returns a list of codecs which may be associated with this extension
 Codec[] getPalletCodecs()
          getPalletCodecsFor(String ext) returns a list of codecs for this type
 Codec[] getPalletCodecsFor(java.lang.String ext)
          getPalletCodecsFor(String ext) returns a list of codecs which may be associated with this extension
static ResourceManager getResourceManager()
          getResourceManager allows for acces to a singlular instance or singlton ResourceManage
 Codec[] getSoundCodecs()
          getSoundCodecsFor(String ext) returns a list of codecs for this type
 Codec[] getSoundCodecsFor(java.lang.String ext)
          getSoundCodecsFor(String ext) returns a list of codecs which may be associated with this extension
static VideoCodecToolkit getVideoCodecToolkit()
          getVideoCodecToolkit() allows access to the initialized VideoAdapter for codec use
Note has been left not protected or not Restricted as access to functions as yet have not been deemed detrimental to use by any class as should always be set before access to can be called except for instances where an attempt to access has been made from a legacy.Legacy.getConfiguration() call.
 void installCodecs(java.util.Properties codex)
          installCodecs(Properties) allows the end user to add additional codecs which the ResourceManager can use load resoruces for use.
the codex list allows is a properties list and sould be formated as follows
 boolean isReady()
          isReady returns weather or not required resources are ready to use
 void setResources(java.util.List<java.lang.String> groups)
          setResources(List) defines the resource groups required for use.
Note set is used as resources may already be loadedSize and tells the manager that these resources will be required.
static void setVideoCodecToolkit(VideoCodecToolkit toolkit)
          setVideoCodecToolkit(VideoCodecToolkit) applies a toolkit to make availible for classes which may not in general have acccess to it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getResourceManager

public static final ResourceManager getResourceManager()
getResourceManager allows for acces to a singlular instance or singlton ResourceManage

Returns:
the usable ResourceManager

installCodecs

public void installCodecs(java.util.Properties codex)
installCodecs(Properties) allows the end user to add additional codecs which the ResourceManager can use load resoruces for use.
the codex list allows is a properties list and sould be formated as follows
 //Codex Properties File for my game
 mygame.codex.worldmap = "codec to read a map as an image"
 mygame.codex.tile = "codec to read a tile"

Parameters:
codex - a properties file containg a list of classes to use.

setVideoCodecToolkit

public static void setVideoCodecToolkit(VideoCodecToolkit toolkit)
setVideoCodecToolkit(VideoCodecToolkit) applies a toolkit to make availible for classes which may not in general have acccess to it.

Parameters:
toolkit - Video Adapter Toolit

getVideoCodecToolkit

public static VideoCodecToolkit getVideoCodecToolkit()
getVideoCodecToolkit() allows access to the initialized VideoAdapter for codec use
Note has been left not protected or not Restricted as access to functions as yet have not been deemed detrimental to use by any class as should always be set before access to can be called except for instances where an attempt to access has been made from a legacy.Legacy.getConfiguration() call.

Returns:
the toolkit

addGroup

protected void addGroup(ResourceGroup group)
addGroup is called from inside the ResourceGroup class to additself to the singleton ResourceManager
Warning this will not allow groups of the same name to be added.

Parameters:
group - the group to add.

setResources

public void setResources(java.util.List<java.lang.String> groups)
setResources(List) defines the resource groups required for use.
Note set is used as resources may already be loadedSize and tells the manager that these resources will be required.

Parameters:
groups - to mark as required and load.

getAllResources

public java.util.List<java.lang.String> getAllResources()
getAllResources() simply returns all known resource groups.

Returns:
a list of known resource groups

getChachedResources

public java.util.List<java.lang.String> getChachedResources()
getChachedResources() simply returns all chached or ready resource groups.

Returns:
a list of chached or ready resource groups

isReady

public boolean isReady()
isReady returns weather or not required resources are ready to use

Returns:
true if valid and loadedSize false otherwise

getLoadStatus

public float getLoadStatus()
Returns the load status as a fraction of 100% of loadedSize items in required group

Returns:
percentile of loadedSize resources.

getImageCodecsFor

public Codec[] getImageCodecsFor(java.lang.String ext)
getImageCodecsFor(String ext) returns a list of codecs which may be associated with this extension

Parameters:
ext - to find codecs for
Returns:
a list of codecs.

getImageCodecs

public Codec[] getImageCodecs()
getImageCodecsFor(String ext) returns a list of codecs for this type

Returns:
a list of codecs.

getPalletCodecsFor

public Codec[] getPalletCodecsFor(java.lang.String ext)
getPalletCodecsFor(String ext) returns a list of codecs which may be associated with this extension

Parameters:
ext - to find codecs for
Returns:
a list of codecs.

getPalletCodecs

public Codec[] getPalletCodecs()
getPalletCodecsFor(String ext) returns a list of codecs for this type

Returns:
a list of codecs.

getMidiCodecsFor

public Codec[] getMidiCodecsFor(java.lang.String ext)
getMidiCodecsFor(String ext) returns a list of codecs which may be associated with this extension

Parameters:
ext - to find codecs for
Returns:
a list of codecs.

getMidiCodecs

public Codec[] getMidiCodecs()
getMidiCodecsFor(String ext) returns a list of codecs for this type

Returns:
a list of codecs.

getSoundCodecsFor

public Codec[] getSoundCodecsFor(java.lang.String ext)
getSoundCodecsFor(String ext) returns a list of codecs which may be associated with this extension

Parameters:
ext - to find codecs for
Returns:
a list of codecs.

getSoundCodecs

public Codec[] getSoundCodecs()
getSoundCodecsFor(String ext) returns a list of codecs for this type

Returns:
a list of codecs.

getFontCodecsFor

public Codec[] getFontCodecsFor(java.lang.String ext)
getFontCodecsFor(String ext) returns a list of codecs which may be associated with this extension

Parameters:
ext - to find codecs for
Returns:
a list of codecs.

getFontCodecs

public Codec[] getFontCodecs()
getFontCodecsFor(String ext) returns a list of codecs for this type

Returns:
a list of codecs.