Class MapLoader

java.lang.Object
  |
  +--MapLoader

public class MapLoader
extends java.lang.Object

Class to construct the Grid as specified in a mml file.

See Also:
Game, Grid

Field Summary
protected  boolean fin
          true iff finished Constructing the Grid
protected  Grid g
          The Grid constructing
 
Constructor Summary
MapLoader(java.io.BufferedReader br)
          Construct a new MapLoader using the BufferedReader specified.
 
Method Summary
 MapObject getDefault()
          Gets the deafult MapObject for the GridConstructed
 Grid getGrid()
          Get the Grid Constructed
protected  boolean isChar(int c)
          Returns true iff c is between A and Z case insensitive
protected  void processBlocker(java.io.BufferedReader br)
          Handle the Blocker
protected  void processBuilding(java.io.BufferedReader br)
          Handle the Building
protected  Item processItemForVector(java.io.BufferedReader br)
          Handle the Item
protected  void processItemVector(java.io.BufferedReader br, People p)
          Handle the Item Vector
protected  Monster processMonster(java.io.BufferedReader br)
          Handle the Monster
protected  void processMonstersAllowed(java.io.BufferedReader br)
          Handles the Monsters Allowed
protected  void processMonsterVector(java.io.BufferedReader br, People p)
          Handle the Monster Vector
protected  void processPerson(java.io.BufferedReader br, boolean person)
          Handle the Person
protected  void processPlayer(java.io.BufferedReader br)
          Handle the Player
protected  void processRedirect(java.io.BufferedReader br)
          Handle the Redirect
 boolean setFile(java.io.BufferedReader br)
          Sets the BufferedReader used to process the file, and begins processing.
protected  void startReading()
          Starts the processing of the file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

g

protected Grid g
The Grid constructing


fin

protected boolean fin
true iff finished Constructing the Grid

Constructor Detail

MapLoader

public MapLoader(java.io.BufferedReader br)
          throws java.io.IOException,
                 InvalidFileFormatException
Construct a new MapLoader using the BufferedReader specified.

Parameters:
br - the BufferedReader
Throws:
InvalidFileFormatException - iff the file is not properly formatted
java.io.IOException
Method Detail

setFile

public boolean setFile(java.io.BufferedReader br)
                throws java.io.IOException,
                       InvalidFileFormatException
Sets the BufferedReader used to process the file, and begins processing.

Parameters:
br - the BufferedReader
Throws:
InvalidFileFormatException - iff the file is not properly formatted
java.io.IOException

isChar

protected boolean isChar(int c)
Returns true iff c is between A and Z case insensitive

Returns:
true iff c is between A and Z case insensitive

getGrid

public Grid getGrid()
Get the Grid Constructed

Returns:
the Grid Constructed
See Also:
Grid

getDefault

public MapObject getDefault()
Gets the deafult MapObject for the GridConstructed

Returns:
the deafult MapObject for the GridConstructed

startReading

protected void startReading()
                     throws java.io.IOException,
                            InvalidFileFormatException
Starts the processing of the file.

Throws:
InvalidFileFormatException - iff the file is not properly formatted
java.io.IOException

processMonstersAllowed

protected void processMonstersAllowed(java.io.BufferedReader br)
                               throws java.io.IOException,
                                      InvalidFileFormatException
Handles the Monsters Allowed

Parameters:
br - the BufferedReader to use
Throws:
InvalidFileFormatException - iff the file is not properly formatted
java.io.IOException

processPlayer

protected void processPlayer(java.io.BufferedReader br)
                      throws java.io.IOException,
                             InvalidFileFormatException
Handle the Player

Parameters:
br - the BufferedReader to use
Throws:
InvalidFileFormatException - iff the file is not properly formatted
java.io.IOException

processPerson

protected void processPerson(java.io.BufferedReader br,
                             boolean person)
                      throws java.io.IOException,
                             InvalidFileFormatException
Handle the Person

Parameters:
br - the BufferedReader to use
person - pass true if a Person false if a Trainer
Throws:
InvalidFileFormatException - iff the file is not properly formatted
java.io.IOException

processMonsterVector

protected void processMonsterVector(java.io.BufferedReader br,
                                    People p)
                             throws java.io.IOException,
                                    InvalidFileFormatException
Handle the Monster Vector

Parameters:
br - the BufferedReader to use
p - the People to add the Monsters to
Throws:
InvalidFileFormatException - iff the file is not properly formatted
java.io.IOException

processMonster

protected Monster processMonster(java.io.BufferedReader br)
                          throws java.io.IOException,
                                 InvalidFileFormatException
Handle the Monster

Parameters:
br - the BufferedReader to use
Returns:
the Monster specified in th mml
Throws:
InvalidFileFormatException - iff the file is not properly formatted
java.io.IOException

processItemVector

protected void processItemVector(java.io.BufferedReader br,
                                 People p)
                          throws java.io.IOException,
                                 InvalidFileFormatException
Handle the Item Vector

Parameters:
br - the BufferedReader to use
p - the People to add the Item to
Throws:
InvalidFileFormatException - iff the file is not properly formatted
java.io.IOException

processItemForVector

protected Item processItemForVector(java.io.BufferedReader br)
                             throws java.io.IOException,
                                    InvalidFileFormatException
Handle the Item

Parameters:
br - the BufferedReader to use
Returns:
the Item created
Throws:
InvalidFileFormatException - iff the file is not properly formatted
java.io.IOException

processBlocker

protected void processBlocker(java.io.BufferedReader br)
                       throws java.io.IOException,
                              InvalidFileFormatException
Handle the Blocker

Parameters:
br - the BufferedReader to use
Throws:
InvalidFileFormatException - iff the file is not properly formatted
java.io.IOException

processBuilding

protected void processBuilding(java.io.BufferedReader br)
                        throws java.io.IOException,
                               InvalidFileFormatException
Handle the Building

Parameters:
br - the BufferedReader to use
Throws:
InvalidFileFormatException - iff the file is not properly formatted
java.io.IOException

processRedirect

protected void processRedirect(java.io.BufferedReader br)
                        throws java.io.IOException,
                               InvalidFileFormatException
Handle the Redirect

Parameters:
br - the BufferedReader to use
Throws:
InvalidFileFormatException - iff the file is not properly formatted
java.io.IOException