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

  • Type Parameters:
    T - the type of belief bases
    S - the type of formulas

    public abstract class Parser<T extends BeliefBase,​S extends Formula>
    extends Object
    This class models an abstract parser for belief bases and formulas.
    Author:
    Matthias Thimm
    • Constructor Detail

      • Parser

        public Parser()
    • Method Detail

      • parseBeliefBase

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

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

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

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

        public static boolean isNumeric​(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