Package chemaxon.formats.recognizer
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 Summary
Fields Modifier and Type Field Description protected boolean
needsMore
-
Constructor Summary
Constructors Constructor Description Recognizer()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description int
getLastProcessedLineNum()
Deprecated.as of Marvin 2014.07.21.0 not usedString
guessFormat(String line)
Tries to guess the format of the given line.boolean
isLastLine()
Tests whether it is the last line of file.boolean
needsMore()
Should we read more lines?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.void
tryToRecognize(String line, int linenum, RecognizerList reclist)
Deprecated.as of Marvin 2014.07.21.0 not used in recognition.
-
-
-
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. ImplementtryToRecognize(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 linelinenum
- the line numberreclist
- 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 usedGets 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 stringlineNumber
- 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
-
-