Interface Parser<T>

  • Type Parameters:
    T - Type of input to the Parser
    All Known Implementing Classes:
    NumberParser, StringParser

    public interface Parser<T>
    A parser accepts a string and returns a Predicate depending on its implementation.
    • Method Detail

      • operators

        List<String> operators()
        Returns the list of operators which can be used with this parser.
        Returns:
        A list of operators.
      • getSymbol

        String getSymbol​(String text)
        Return the symbol related to an operator text which can be used with this parser.
        Parameters:
        text - The operator text
        Returns:
        A symbol.
      • isValid

        boolean isValid​(String text)
        Checks if the supplied text is valid or not.
        Parameters:
        text - The text to be validated.
        Returns:
        true if text is valid, else returns false.
      • getErrorMessage

        String getErrorMessage()
        A string with the error message if the parser fails to parse the supplied string.
        Returns:
        An error message if the parse fails.
      • aggregate

        default Predicate<T> aggregate​(String text)
        Aggregates a text i.e. performs aggregation before parsing the text.
        Parameters:
        text - The text on which aggregation is to be performed
        Returns:
        A predicated by aggregating the text or null if the text cannot be aggregated.