Class Recognizer

java.lang.Object
chemaxon.formats.recognizer.Recognizer
Direct Known Subclasses:
AbbrevGroupRecognizer, PDBRecognizer, PeptideRecognizer, SMILESRecognizer, chemaxon.formats.recognizer.XYZRecognizer

@PublicApi public abstract class Recognizer extends Object
File format recognizer.
Since:
Marvin 5.0, 06/07/2007
  • Field Details

    • needsMore

      protected boolean needsMore
  • Constructor Details

    • Recognizer

      public Recognizer()
  • Method Details

    • tryToRecognize

      @SubjectToRemoval(date=JUL_01_2025) @Deprecated(forRemoval=true) public void tryToRecognize(String line, int linenum, RecognizerList reclist)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Not used in recognition and will be removed. 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(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public int getLastProcessedLineNum()
      Deprecated, for removal: This API element is subject to removal in a future version.
      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