antsnest.level
Class LevelManager

java.lang.Object
  extended by antsnest.level.LevelManager

public class LevelManager
extends Object

Responsible for managing the levels in the application

Author:
Chris Clohosy

Constructor Summary
LevelManager(File file)
          Constructs a new manager
 
Method Summary
 void addLevel(Level level)
          Adds a level to be managed
 Level getCurrentLevel()
          Gets the current level being viewed
 Level getLevel(int position)
          Gets a level from a specified position
 Level getLevel(String classname)
          Gets a level by classname
 Level[] getLevels()
          Gets the levels being managed
 int getLevelSize()
          Gets the number of levels currently being managed
 void load()
          Loads manager information from a file
 void removeLevel(Level level)
          Stops a level being managed
 void save()
          Saves the manager information to a file
 void setCurrentLevel(Level level)
          Sets the current level being viewed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LevelManager

public LevelManager(File file)
Constructs a new manager

Parameters:
file - the file to save the manager to
Method Detail

addLevel

public void addLevel(Level level)
Adds a level to be managed

Parameters:
level - the level to add

removeLevel

public void removeLevel(Level level)
Stops a level being managed

Parameters:
level - the level to stop managing

getLevel

public Level getLevel(int position)
Gets a level from a specified position

Parameters:
position - the position of the level
Returns:
a Level, the requested level

getLevels

public Level[] getLevels()
Gets the levels being managed

Returns:
a Level[], the levels being managed

getLevelSize

public int getLevelSize()
Gets the number of levels currently being managed

Returns:
an int, the number of levels

save

public void save()
          throws IOException
Saves the manager information to a file

Throws:
an - IOException if there's a problem saving
IOException

load

public void load()
          throws IOException
Loads manager information from a file

Throws:
an - IOException if there's a problem loading
IOException

setCurrentLevel

public void setCurrentLevel(Level level)
Sets the current level being viewed

Parameters:
level - the currently viewed level

getCurrentLevel

public Level getCurrentLevel()
Gets the current level being viewed

Returns:
a Level, the currently viewed level

getLevel

public Level getLevel(String classname)
Gets a level by classname

Parameters:
classname - the classname of the required level
Returns:
a Level, the required level