Class Parser<T extends BeliefBase,​S extends Formula>

    • Constructor Summary

      Constructors 
      Constructor Description
      Parser()  
    • Method Summary

      Modifier and Type Method Description
      static boolean isNumeric​(java.lang.String str)
      Checks whether the given string is a number.
      abstract T parseBeliefBase​(java.io.Reader reader)
      Parses the given reader into a belief base of the given type.
      T parseBeliefBase​(java.lang.String text)
      Parses the given text into a belief base of the given type.
      T parseBeliefBaseFromFile​(java.lang.String filename)
      Parses the file of the given filename into a belief base of the given type.
      abstract S parseFormula​(java.io.Reader reader)
      Parses the given reader into a formula of the given type.
      S parseFormula​(java.lang.String text)
      Parses the given text into a formula of the given type.
      S parseFormulaFromFile​(java.lang.String filename)
      Parses the file of the given filename into a formula of the given type.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Parser

        public Parser()
    • Method Detail

      • parseBeliefBaseFromFile

        public T parseBeliefBaseFromFile​(java.lang.String filename)
                                  throws java.io.FileNotFoundException,
                                         java.io.IOException,
                                         ParserException
        Parses the file of the given filename into a belief base of the given type.
        Parameters:
        filename - the name of a file
        Returns:
        a belief base
        Throws:
        java.io.FileNotFoundException - if the file is not found
        java.io.IOException - if some IO issue occurred.
        ParserException - some parsing exceptions may be added here.
      • parseBeliefBase

        public T parseBeliefBase​(java.lang.String text)
                          throws java.io.IOException,
                                 ParserException
        Parses the given text into a belief base of the given type.
        Parameters:
        text - a string
        Returns:
        a belief base.
        Throws:
        java.io.IOException - if some IO issue occurred.
        ParserException - some parsing exceptions may be added here.
      • parseBeliefBase

        public abstract T parseBeliefBase​(java.io.Reader reader)
                                   throws java.io.IOException,
                                          ParserException
        Parses the given reader into a belief base of the given type.
        Parameters:
        reader - a reader
        Returns:
        a belief base
        Throws:
        java.io.IOException - if some IO issue occurred.
        ParserException - some parsing exceptions may be added here.
      • parseFormulaFromFile

        public S parseFormulaFromFile​(java.lang.String filename)
                               throws java.io.FileNotFoundException,
                                      java.io.IOException,
                                      ParserException
        Parses the file of the given filename into a formula of the given type.
        Parameters:
        filename - the name of a file
        Returns:
        a formula
        Throws:
        java.io.FileNotFoundException - if the file is not found
        java.io.IOException - if some IO issue occurred.
        ParserException - some parsing exceptions may be added here.
      • parseFormula

        public S parseFormula​(java.lang.String text)
                       throws java.io.IOException,
                              ParserException
        Parses the given text into a formula of the given type.
        Parameters:
        text - a string
        Returns:
        a formula
        Throws:
        java.io.IOException - if some IO issue occurred.
        ParserException - some parsing exceptions may be added here.
      • parseFormula

        public abstract S parseFormula​(java.io.Reader reader)
                                throws java.io.IOException,
                                       ParserException
        Parses the given reader into a formula of the given type.
        Parameters:
        reader - a reader
        Returns:
        a formula
        Throws:
        java.io.IOException - if some IO issue occurred.
        ParserException - some parsing exceptions may be added here.
      • isNumeric

        public static boolean isNumeric​(java.lang.String str)
        Checks whether the given string is a number.
        Parameters:
        str - some string
        Returns:
        "true" if the given string can be parsed as a number