Class PushbackTokenizer


  • public class PushbackTokenizer
    extends java.lang.Object
    This class is used to parse a search string and split it into tokens. It provides methods to parse numbers and extract strings.
    Since:
    12656 (moved from actions.search package)
    • Constructor Detail

      • PushbackTokenizer

        public PushbackTokenizer​(java.io.Reader search)
        Creates a new PushbackTokenizer
        Parameters:
        search - The search string reader to read the tokens from
    • Method Detail

      • getString

        private java.lang.String getString​(boolean quoted)
      • getString

        private java.lang.String getString()
      • nextToken

        public PushbackTokenizer.Token nextToken()
        The token returned is null or starts with an identifier character: - for an '-'. This will be the only character : for an key. The value is the next token | for "OR" ^ for "XOR" ' ' for anything else.
        Returns:
        The next token in the stream.
      • readIfEqual

        public boolean readIfEqual​(PushbackTokenizer.Token token)
        Reads the next token if it is equal to the given, suggested token
        Parameters:
        token - The token the next one should be equal to
        Returns:
        true if it has been read
      • readTextOrNumber

        public java.lang.String readTextOrNumber()
        Reads the next token. If it is a text, return that text. If not, advance
        Returns:
        the text or null if the reader was advanced
      • readNumber

        public long readNumber​(java.lang.String errorMessage)
                        throws SearchParseError
        Reads a number
        Parameters:
        errorMessage - The error if the number cannot be read
        Returns:
        The number that was found
        Throws:
        SearchParseError - if there is no number
      • getReadNumber

        public long getReadNumber()
        Gets the last number that was read
        Returns:
        The last number
      • getText

        public java.lang.String getText()
        Gets the last text that was found
        Returns:
        The text