Class BasicLineMapParser<K,T>
- java.lang.Object
-
- ubic.gemma.core.loader.util.parser.BasicLineMapParser<K,T>
-
- All Implemented Interfaces:
LineParser<T>
,Parser<T>
- Direct Known Subclasses:
AffyProbeReader
,IlluminaProbeReader
,LineMapParser
,NcbiGeneEnsemblFileParser
,NcbiGeneHistoryParser
,NcbiGeneInfoParser
,ProbeSequenceParser
,TaxonParser
public abstract class BasicLineMapParser<K,T> extends Object implements LineParser<T>
A line parser that produces a Map instead of a Collection. Subclasses must provide a method to generate keys, which is generated from the values. A typical use case of this is when the keys are also known to another class that needs the data provided by the parser; to locate the data it uses the key.- Author:
- pavlidis
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
COMMENT_MARK
Lines starting with this will be ignored.protected org.apache.commons.logging.Log
log
-
Fields inherited from interface ubic.gemma.core.loader.util.parser.LineParser
MIN_PARSED_LINES_FOR_UPDATE, PARSE_ALERT_TIME_FREQUENCY_MS
-
Fields inherited from interface ubic.gemma.core.loader.util.parser.Parser
PARSE_ALERT_FREQUENCY
-
-
Constructor Summary
Constructors Constructor Description BasicLineMapParser()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract boolean
containsKey(K key)
abstract T
get(K key)
protected abstract K
getKey(T newItem)
abstract Collection<K>
getKeySet()
abstract Collection<T>
getResults()
void
parse(File file)
Parse aFile
void
parse(InputStream is)
Parse aInputStream
.void
parse(String filename)
Parse a file identified by its path.abstract T
parseOneLine(String line)
Handle the parsing of a single line from the input.protected abstract void
put(K key, T value)
-
-
-
Field Detail
-
COMMENT_MARK
protected static final String COMMENT_MARK
Lines starting with this will be ignored.- See Also:
- Constant Field Values
-
log
protected final org.apache.commons.logging.Log log
-
-
Method Detail
-
containsKey
public abstract boolean containsKey(K key)
-
getKeySet
public abstract Collection<K> getKeySet()
-
getResults
public abstract Collection<T> getResults()
- Specified by:
getResults
in interfaceParser<K>
- Returns:
- the results of the parse.
-
parse
public void parse(File file) throws IOException
Description copied from interface:Parser
Parse aFile
- Specified by:
parse
in interfaceParser<K>
- Parameters:
file
- file- Throws:
IOException
- if there is a problem while manipulating the file
-
parse
public void parse(InputStream is) throws IOException
Description copied from interface:Parser
Parse aInputStream
.- Specified by:
parse
in interfaceParser<K>
- Parameters:
is
- input stream- Throws:
IOException
- if there is a problem while manipulating the file
-
parse
public void parse(String filename) throws IOException
Description copied from interface:Parser
Parse a file identified by its path.- Specified by:
parse
in interfaceParser<K>
- Parameters:
filename
- Absolute path to the file- Throws:
IOException
- if there is a problem while manipulating the file
-
parseOneLine
public abstract T parseOneLine(String line)
Description copied from interface:LineParser
Handle the parsing of a single line from the input.- Specified by:
parseOneLine
in interfaceLineParser<K>
- Parameters:
line
- line to parse- Returns:
- parsed object
-
-