Class TextParser


  • public class TextParser
    extends java.lang.Object
    This class parses text form player into a set of commands This class is currently not being used in our game, though it will be implemented at a later date
    • Constructor Summary

      Constructors 
      Constructor Description
      TextParser()  
    • Method Summary

      Modifier and Type Method Description
      private void parseBattleAction​(java.lang.String action)
      Calls corresponding action to user input
      private void parseBattlePerson​(java.lang.String personText)
      Finds battle person based on text input and sets it as actor of action
      private void parseBattleTarget​(java.lang.String targetText)
      Finds battle person based on text input and sets it as target of action
      void parseBattleText​(java.lang.String text)
      Separates incoming text into parts and passes them on to be parsed further
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • textToParse

        private java.lang.String textToParse
      • battle

        private Battle battle
      • item

        private Item item
      • action

        private java.lang.String action
    • Constructor Detail

      • TextParser

        public TextParser()
    • Method Detail

      • parseBattleText

        public void parseBattleText​(java.lang.String text)
        Separates incoming text into parts and passes them on to be parsed further
        Parameters:
        text - is input from player
      • parseBattlePerson

        private void parseBattlePerson​(java.lang.String personText)
        Finds battle person based on text input and sets it as actor of action
        Parameters:
        personText - is name of battle person
      • parseBattleAction

        private void parseBattleAction​(java.lang.String action)
        Calls corresponding action to user input
        Parameters:
        action - is name of action
      • parseBattleTarget

        private void parseBattleTarget​(java.lang.String targetText)
        Finds battle person based on text input and sets it as target of action
        Parameters:
        targetText - name of battle person