es.ucm.fdi.hysteria.game.parser
Class GameParser

java.lang.Object
  extended by es.ucm.fdi.hysteria.game.parser.GameParser

public class GameParser
extends java.lang.Object

This class parses the game, with a given Input Stream

Author:
MiniSandor

Constructor Summary
GameParser(java.io.InputStream in, java.lang.String path)
           
 
Method Summary
 java.lang.String getAuthor()
           
 java.lang.String getDesc()
           
 ItemRepository getInitialInventory()
           
 Location getInitialLocation()
           
 java.lang.String getTitle()
           
 int getTotalLocations()
           
 void parse()
          If a operation mode was selected, try to parse the game.
 void setTXT()
          Try to parse it as a TXT file
 void setXML()
          Try to parse it as a XML file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GameParser

public GameParser(java.io.InputStream in,
                  java.lang.String path)
Parameters:
in - The input stream to the Game Definition
Method Detail

setTXT

public void setTXT()
Try to parse it as a TXT file


setXML

public void setXML()
Try to parse it as a XML file


parse

public void parse()
           throws InvalidGameDefinitionException,
                  java.io.IOException
If a operation mode was selected, try to parse the game.

Throws:
InvalidGameDefinitionException
java.io.IOException

getInitialLocation

public Location getInitialLocation()
                            throws UnparsedGameDefinitionException,
                                   InvalidGameDefinitionException
Returns:
The game initial location
Throws:
UnparsedGameDefinitionException
InvalidGameDefinitionException

getTitle

public java.lang.String getTitle()
                          throws UnparsedGameDefinitionException,
                                 InvalidGameDefinitionException
Returns:
The game title
Throws:
UnparsedGameDefinitionException
InvalidGameDefinitionException

getAuthor

public java.lang.String getAuthor()
                           throws UnparsedGameDefinitionException,
                                  InvalidGameDefinitionException
Returns:
The game author
Throws:
UnparsedGameDefinitionException
InvalidGameDefinitionException

getDesc

public java.lang.String getDesc()
                         throws UnparsedGameDefinitionException,
                                InvalidGameDefinitionException
Returns:
The game description
Throws:
UnparsedGameDefinitionException
InvalidGameDefinitionException

getInitialInventory

public ItemRepository getInitialInventory()
                                   throws UnparsedGameDefinitionException,
                                          InvalidGameDefinitionException
Returns:
The game initial inventory
Throws:
UnparsedGameDefinitionException
InvalidGameDefinitionException

getTotalLocations

public int getTotalLocations()
                      throws UnparsedGameDefinitionException
Throws:
UnparsedGameDefinitionException