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

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

public class TextParser
extends java.lang.Object


Field Summary
protected  java.lang.String _actualId
           
protected  java.util.Hashtable<java.lang.String,java.util.Hashtable<java.lang.String,java.lang.String>> _allExits
           
protected  java.util.Hashtable<java.lang.String,Item> _allItems
           
protected  java.util.Hashtable<java.lang.String,Location> _allLocs
           
protected  java.util.Hashtable<java.lang.String,Obstacle> _allObstacles
           
protected  java.util.Hashtable<java.lang.String,java.util.Hashtable<java.lang.String,java.lang.String>> _allReactions
           
protected  java.util.Hashtable<java.lang.String,java.util.Hashtable<java.lang.String,java.lang.String>> _allReactionsFlags
           
protected  java.util.Hashtable<java.lang.String,Scene> _allScenes
           
protected  java.util.Hashtable<java.lang.String,Topic> _allTopics
           
protected  boolean _atLeastOne
           
protected  java.lang.String _author
           
protected  Location _currentLocation
           
protected  Topic _currentTopic
           
protected  java.lang.String _desc
           
protected  java.lang.String _gamePath
           
protected  java.io.InputStream _in
           
protected  java.lang.String _initialId
           
protected  ItemRepository _initialInventory
           
protected  Location _initialLocation
           
protected  java.lang.String _name
           
protected  java.util.Hashtable<java.lang.String,java.util.LinkedHashSet<java.lang.String>> _obstacleItemRel
           
protected  java.util.Hashtable<java.lang.String,java.util.LinkedHashSet<java.lang.String>> _obstacleRel
           
protected  boolean _parsed
           
protected  java.util.Hashtable<java.lang.String,java.util.Hashtable<java.lang.String,java.util.LinkedHashSet<java.lang.String>>> _reactionDisableRel
           
protected  java.util.Hashtable<java.lang.String,java.util.Hashtable<java.lang.String,java.util.LinkedHashSet<java.lang.String>>> _reactionEnableRel
           
protected  java.util.Hashtable<java.lang.String,java.util.LinkedHashSet<java.lang.String>> _sceneDisableRel
           
protected  java.util.Hashtable<java.lang.String,java.util.LinkedHashSet<java.lang.String>> _sceneEnableRel
           
protected  java.util.Hashtable<java.lang.String,java.util.LinkedHashSet<java.lang.String>> _topicDisableRel
           
protected  java.util.Hashtable<java.lang.String,java.util.LinkedHashSet<java.lang.String>> _topicEnableRel
           
protected  boolean _unassignedInitialLocation
           
protected  java.io.StreamTokenizer st
           
 
Constructor Summary
TextParser(java.lang.String path)
           
 
Method Summary
 java.lang.String getAuthor()
          It gets the game author, if the game was parsed
 java.lang.String getDesc()
          It gets the game description, if the game was parsed
 ItemRepository getInitialInventory()
          It gets the game initial inventory, if the game was parsed
 Location getInitialLocation()
          It gets the initial location, if the game was parsed
 java.lang.String getTitle()
          It gets the game title, if the game was parsed
 int getTotalLocations()
           
 void parse(java.io.InputStream gameDefinition)
          It tries to parse the game denoted by the Input Stream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_in

protected java.io.InputStream _in

_parsed

protected boolean _parsed

_unassignedInitialLocation

protected boolean _unassignedInitialLocation

_atLeastOne

protected boolean _atLeastOne

_initialLocation

protected Location _initialLocation

_currentLocation

protected Location _currentLocation

_actualId

protected java.lang.String _actualId

_name

protected java.lang.String _name

_author

protected java.lang.String _author

_desc

protected java.lang.String _desc

_initialId

protected java.lang.String _initialId

_initialInventory

protected ItemRepository _initialInventory

_currentTopic

protected Topic _currentTopic

_allLocs

protected java.util.Hashtable<java.lang.String,Location> _allLocs

_allExits

protected java.util.Hashtable<java.lang.String,java.util.Hashtable<java.lang.String,java.lang.String>> _allExits

_allReactions

protected java.util.Hashtable<java.lang.String,java.util.Hashtable<java.lang.String,java.lang.String>> _allReactions

_allReactionsFlags

protected java.util.Hashtable<java.lang.String,java.util.Hashtable<java.lang.String,java.lang.String>> _allReactionsFlags

_reactionEnableRel

protected java.util.Hashtable<java.lang.String,java.util.Hashtable<java.lang.String,java.util.LinkedHashSet<java.lang.String>>> _reactionEnableRel

_reactionDisableRel

protected java.util.Hashtable<java.lang.String,java.util.Hashtable<java.lang.String,java.util.LinkedHashSet<java.lang.String>>> _reactionDisableRel

_allObstacles

protected java.util.Hashtable<java.lang.String,Obstacle> _allObstacles

_allItems

protected java.util.Hashtable<java.lang.String,Item> _allItems

_obstacleRel

protected java.util.Hashtable<java.lang.String,java.util.LinkedHashSet<java.lang.String>> _obstacleRel

_obstacleItemRel

protected java.util.Hashtable<java.lang.String,java.util.LinkedHashSet<java.lang.String>> _obstacleItemRel

_sceneEnableRel

protected java.util.Hashtable<java.lang.String,java.util.LinkedHashSet<java.lang.String>> _sceneEnableRel

_topicEnableRel

protected java.util.Hashtable<java.lang.String,java.util.LinkedHashSet<java.lang.String>> _topicEnableRel

_sceneDisableRel

protected java.util.Hashtable<java.lang.String,java.util.LinkedHashSet<java.lang.String>> _sceneDisableRel

_topicDisableRel

protected java.util.Hashtable<java.lang.String,java.util.LinkedHashSet<java.lang.String>> _topicDisableRel

st

protected java.io.StreamTokenizer st

_allScenes

protected java.util.Hashtable<java.lang.String,Scene> _allScenes

_allTopics

protected java.util.Hashtable<java.lang.String,Topic> _allTopics

_gamePath

protected java.lang.String _gamePath
Constructor Detail

TextParser

public TextParser(java.lang.String path)
Method Detail

getInitialLocation

public Location getInitialLocation()
                            throws UnparsedGameDefinitionException,
                                   InvalidGameDefinitionException
It gets the initial location, if the game was parsed

Returns:
Initial Location
Throws:
UnparsedGameDefinitionException
InvalidGameDefinitionException

getTitle

public java.lang.String getTitle()
                          throws UnparsedGameDefinitionException,
                                 InvalidGameDefinitionException
It gets the game title, if the game was parsed

Returns:
Initial Location
Throws:
UnparsedGameDefinitionException
InvalidGameDefinitionException

getAuthor

public java.lang.String getAuthor()
                           throws UnparsedGameDefinitionException,
                                  InvalidGameDefinitionException
It gets the game author, if the game was parsed

Returns:
Initial Location
Throws:
UnparsedGameDefinitionException
InvalidGameDefinitionException

getDesc

public java.lang.String getDesc()
                         throws UnparsedGameDefinitionException,
                                InvalidGameDefinitionException
It gets the game description, if the game was parsed

Returns:
Initial Location
Throws:
UnparsedGameDefinitionException
InvalidGameDefinitionException

getTotalLocations

public int getTotalLocations()
                      throws UnparsedGameDefinitionException
Throws:
UnparsedGameDefinitionException

getInitialInventory

public ItemRepository getInitialInventory()
                                   throws UnparsedGameDefinitionException,
                                          InvalidGameDefinitionException
It gets the game initial inventory, if the game was parsed

Returns:
Initial Location
Throws:
UnparsedGameDefinitionException
InvalidGameDefinitionException

parse

public void parse(java.io.InputStream gameDefinition)
           throws java.lang.IllegalArgumentException,
                  InvalidGameDefinitionException
It tries to parse the game denoted by the Input Stream

Parameters:
gameDefinition - The input stream to the game
Throws:
java.lang.IllegalArgumentException
InvalidGameDefinitionException