Class PlayerLoader

java.lang.Object
  |
  +--PlayerLoader

public class PlayerLoader
extends java.lang.Object

Class to load a Player from a pml file. This is based closely upon mml.

See Also:
MapLoader, Player

Field Summary
protected  boolean fin
          Finished marker
 
Constructor Summary
PlayerLoader(java.io.BufferedReader br)
          Construct a new PlayerLoader using the BufferedReader specified.
 
Method Summary
 Player getPlayer()
          Gets the Player created
protected  boolean isChar(int c)
          Returns true iff is between A and Z case-insensitive.
protected  void processBadge(java.io.BufferedReader br, Player p)
          Handles the Badge for the Player
protected  Item processItemForVector(java.io.BufferedReader br)
          Handles the Item for the Item Vector
protected  void processItemVector(java.io.BufferedReader br, Player p)
          Handles the Item Vector of the Player
protected  Monster processMonster(java.io.BufferedReader br)
          Handles the Monster for the Monster Vector
protected  void processMonsterVector(java.io.BufferedReader br, Player p, boolean hand)
          Handles the Monster Vector of the Player
protected  void startReading()
          Starts reading from the file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fin

protected boolean fin
Finished marker

Constructor Detail

PlayerLoader

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

Parameters:
br - the BufferedReader to load from
Throws:
InvalidFileFormatException - if the file is not a proper pml document
java.io.IOException
Method Detail

getPlayer

public Player getPlayer()
Gets the Player created

Returns:
the Player created
See Also:
Player

isChar

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

Parameters:
c - the charactr to compare
Returns:
true iff is between A and Z case-insensitive.

startReading

protected void startReading()
                     throws java.io.IOException,
                            InvalidFileFormatException
Starts reading from the file.

Throws:
InvalidFileFormatException - if the file is not a proper pml document
java.io.IOException

processMonsterVector

protected void processMonsterVector(java.io.BufferedReader br,
                                    Player p,
                                    boolean hand)
                             throws java.io.IOException,
                                    InvalidFileFormatException
Handles the Monster Vector of the Player

Parameters:
br - Read from
p - the Player to add to
Throws:
InvalidFileFormatException - if the file is not a proper pml document
java.io.IOException
See Also:
Player

processMonster

protected Monster processMonster(java.io.BufferedReader br)
                          throws java.io.IOException,
                                 InvalidFileFormatException
Handles the Monster for the Monster Vector

Parameters:
br - the BufferedReader to read from
Returns:
the Monster loaded
Throws:
InvalidFileFormatException - if the file is not a proper pml document
java.io.IOException
See Also:
Monster

processItemVector

protected void processItemVector(java.io.BufferedReader br,
                                 Player p)
                          throws java.io.IOException,
                                 InvalidFileFormatException
Handles the Item Vector of the Player

Parameters:
br - Read from
p - the Player to add to
Throws:
InvalidFileFormatException - if the file is not a proper pml document
java.io.IOException
See Also:
Player

processItemForVector

protected Item processItemForVector(java.io.BufferedReader br)
                             throws java.io.IOException,
                                    InvalidFileFormatException
Handles the Item for the Item Vector

Parameters:
br - the BufferedReader to read from
Returns:
the Item loaded
Throws:
InvalidFileFormatException - if the file is not a proper pml document
java.io.IOException
See Also:
Item

processBadge

protected void processBadge(java.io.BufferedReader br,
                            Player p)
                     throws java.io.IOException,
                            InvalidFileFormatException
Handles the Badge for the Player

Parameters:
br - the BufferedReader to read from
p - the Player to add the Badges to
Throws:
InvalidFileFormatException - if the file is not a proper pml document
java.io.IOException
See Also:
Player, Trainer