Package org.lifstools.jgoslin.parser
Class LipidParser
java.lang.Object
org.lifstools.jgoslin.parser.LipidParser
Implementation that uses all available parsers to parse a given lipid name.
First successful parser implementation wins.
- Author:
- Dominik Kopczynski, Nils Hoffmann
-
Constructor Summary
ConstructorDescriptionCreate a new lipid parser instance.LipidParser
(KnownFunctionalGroups knownFunctionalGroups) Create a new lipid parser instance. -
Method Summary
Modifier and TypeMethodDescriptionReturns the grammar name of the last successful parser.Returns the last successful parser instance.This method tries multiple parsers in a defined order to parse the provided lipid name.If no parser is able to parse the name successfully, an exception is thrown.
-
Constructor Details
-
LipidParser
public LipidParser()Create a new lipid parser instance. -
LipidParser
Create a new lipid parser instance.- Parameters:
knownFunctionalGroups
- the known functional groups
-
-
Method Details
-
parse
This method tries multiple parsers in a defined order to parse the provided lipid name.If no parser is able to parse the name successfully, an exception is thrown.- Parameters:
lipidName
- the lipid name to parse.- Returns:
- the
LipidAdduct
if parsing with at least one parser succeeded. - Throws:
LipidParsingException
- if now parser was able to parse the provided lipid name.
-
getLastSuccessfulParser
Returns the last successful parser instance. May be null, if either no parser has been applied yet, or no parser has been successfully applied for parsing the last lipid name.- Returns:
- the last successful parser instance.
-
getLastSuccessfulGrammar
Returns the grammar name of the last successful parser.- Returns:
- the grammar name of the last successful parser.
-