package starpunk;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import java.util.HashMap;

public final class AssetManager
{
  private final HashMap<String, TextureAtlas.AtlasRegion> _sprites = new HashMap<String, TextureAtlas.AtlasRegion>();

  protected void initialize()
  {
    final TextureAtlas textureAtlas = new TextureAtlas( Gdx.files.internal( "target/assets/game" ) );
    for( final TextureAtlas.AtlasRegion r : textureAtlas.getRegions() )
    {
      _sprites.put( r.name, r );
    }
  }

  protected void dispose()
  {
    _sprites.clear();
  }

  public TextureAtlas.AtlasRegion getSprite( final String name )
  {
    return _sprites.get( name );
  }
}

@@ -117,16 +117,38 @@
 HashMap;
+%0Aimport java.util.Map;
 %0A%0Apublic
@@ -297,42 +297,190 @@
 ();%0A
-%0A  protected void initialize()%0A  %7B
+  private final HashMap%3CString, TextureAtlas%3E _textures = new HashMap%3CString, TextureAtlas%3E();%0A%0A  protected void initialize()%0A  %7B%0A    final String textureName = %22target/assets/game%22;
 %0A   
@@ -552,36 +552,27 @@
 ternal( 
-%22target/assets/g
+textureN
 ame
-%22
  ) );%0A  
@@ -692,41 +692,236 @@
 %7D%0A  
-%7D%0A%0A  protected void dispose()%0A  %7B
+  _textures.put( textureName, textureAtlas );%0A  %7D%0A%0A  protected void dispose()%0A  %7B%0A    for( final Map.Entry%3CString, TextureAtlas%3E entry : _textures.entrySet() )%0A    %7B%0A      entry.getValue().dispose();%0A    %7D%0A    _textures.clear();
 %0A   

Improve the dispose by disposing the containing atlas