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.
      java.util.List<T> parseListOfBeliefBases​(java.lang.String text)
      Parses the given text into a list of belief bases of the given type.
      java.util.List<T> parseListOfBeliefBases​(java.lang.String text, java.lang.String delimiter)
      Parses the given text into a list of belief bases of the given type.
      java.util.List<T> parseListOfBeliefBasesFromFile​(java.lang.String filename)
      Parses the file of the given filename into a list of belief bases of the given type.
      java.util.List<T> parseListOfBeliefBasesFromFile​(java.lang.String filename, java.lang.String delimiter)
      Parses the file of the given filename into a list of belief bases 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.
      • parseListOfBeliefBasesFromFile

        public java.util.List<T> parseListOfBeliefBasesFromFile​(java.lang.String filename)
                                                         throws ParserException,
                                                                java.io.IOException
        Parses the file of the given filename into a list of belief bases of the given type. Belief bases are separated by three consecutive newline characters ("\n\n\n").
        Parameters:
        filename - a string
        Returns:
        a list of belief bases in the order in which they appear in the input string.
        Throws:
        java.io.IOException - if an IO error occurs
        ParserException - some parsing exception
      • parseListOfBeliefBasesFromFile

        public java.util.List<T> parseListOfBeliefBasesFromFile​(java.lang.String filename,
                                                                java.lang.String delimiter)
                                                         throws ParserException,
                                                                java.io.IOException
        Parses the file of the given filename into a list of belief bases of the given type. Belief bases are separated by the given delimiter.
        Parameters:
        filename - a string
        delimiter - for separating belief bases
        Returns:
        a list of belief bases in the order in which they appear in the input string.
        Throws:
        java.io.IOException - if an IO error occurs
        ParserException - some parsing exception
      • parseListOfBeliefBases

        public java.util.List<T> parseListOfBeliefBases​(java.lang.String text)
                                                 throws ParserException,
                                                        java.io.IOException
        Parses the given text into a list of belief bases of the given type. Belief bases are separated by three consecutive newline characters ("\n\n\n").
        Parameters:
        text - a string
        Returns:
        a list of belief bases in the order in which they appear in the input string.
        Throws:
        java.io.IOException - if an IO error occurs
        ParserException - some parsing exception
      • parseListOfBeliefBases

        public java.util.List<T> parseListOfBeliefBases​(java.lang.String text,
                                                        java.lang.String delimiter)
                                                 throws ParserException,
                                                        java.io.IOException
        Parses the given text into a list of belief bases of the given type. Belief bases are separated by the given delimiter.
        Parameters:
        text - a string
        delimiter - for separating belief bases
        Returns:
        a list of belief bases in the order in which they appear in the input string.
        Throws:
        java.io.IOException - if an IO error occurs
        ParserException - some parsing exception
      • 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