Class Recognizer

    • Field Detail

      • needsMore

        protected boolean needsMore
    • Constructor Detail

      • Recognizer

        public Recognizer()
    • Method Detail

      • tryToRecognize

        @Deprecated
        public void tryToRecognize​(String line,
                                   int linenum,
                                   RecognizerList reclist)
        Deprecated.
        as of Marvin 2014.07.21.0 not used in recognition. Implement tryToRecognize(String, int) instead.
        Tries to recognize a line. If a format becomes impossible, then it is removed from the set of possible formats.
        Parameters:
        line - the line
        linenum - the line number
        reclist - the list of possible formats
      • needsMore

        public boolean needsMore()
        Should we read more lines?
        Returns:
        true if more lines are needed, false otherwise
      • getLastProcessedLineNum

        @Deprecated
        public int getLastProcessedLineNum()
        Deprecated.
        as of Marvin 2014.07.21.0 not used
        Gets the number of the last processed line.
        Returns:
        the line number
      • isLastLine

        public boolean isLastLine()
        Tests whether it is the last line of file.
        Returns:
        true if it is the last line, false otherwise
      • guessFormat

        public String guessFormat​(String line)
        Tries to guess the format of the given line. It is useful for single line formats.
        Parameters:
        line - the line
        Returns:
        the name of the most likely format, that this recognizer can recognize, or null the format could not be decided
      • tryToRecognize

        public chemaxon.common.util.Pair<Boolean,​Collection<String>> tryToRecognize​(String line,
                                                                                          int lineNumber)
        Checks whether the parameter line can be part of a valid (format specified) file on the given file position.
        Parameters:
        line - the line string
        lineNumber - the position of the line
        Returns:
        a Pair of which second parameter gives the format name collection that is:
        • Recognized to be excluded if the first parameter is false
        • Positively recognized if the first parameter is true