public abstract class AbstractMsReader<A extends PeakAnnotation,S extends Spectrum<A>> extends Object implements IterativeReader<S>
| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractMsReader.ParseContext |
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
acceptUnsortedSpectra |
protected PeakList.Precision |
precision |
EMPTY_READER| Modifier | Constructor and Description |
|---|---|
protected |
AbstractMsReader(Reader reader,
URI source,
PeakList.Precision precision,
PeakProcessorChain<A> processorChain) |
| Modifier and Type | Method and Description |
|---|---|
void |
acceptUnsortedSpectra() |
protected void |
addPeaksToSpectrum(S spectrum,
double[] mzs,
double[] intensities,
int size)
Potentially non-order add peaks to spectrum.
|
protected int |
addPeakToSpectrum(Spectrum<A> spectrum,
double mz,
double intensity,
AbstractMsReader.ParseContext context)
Potentially non-order add peak to spectrum.
|
void |
close()
Closes the reader and releases any system resources associated with
it.
|
AbstractMsReader.ParseContext |
getContext() |
String |
getHeader() |
boolean |
hasNext()
Returns
true if the reader has more elements. |
protected void |
init(AbstractMsReader.ParseContext parseContext) |
S |
next()
Returns the next element in the reader.
|
protected abstract String |
parseHeader(AbstractMsReader.ParseContext context)
This is called on reader initialization.
|
protected abstract S |
parseNextEntry(AbstractMsReader.ParseContext context) |
protected final PeakList.Precision precision
protected boolean acceptUnsortedSpectra
protected AbstractMsReader(Reader reader, URI source, PeakList.Precision precision, PeakProcessorChain<A> processorChain) throws IOException
IOExceptionprotected void init(AbstractMsReader.ParseContext parseContext) throws IOException
IOExceptionprotected abstract S parseNextEntry(AbstractMsReader.ParseContext context) throws IOException
IOExceptionpublic AbstractMsReader.ParseContext getContext()
public boolean hasNext()
IterativeReadertrue if the reader has more elements.
(In other words, returns true if IterativeReader.next() would
return an element rather than throwing an exception.)hasNext in interface IterativeReader<S extends Spectrum<A>>true if the reader has more elementspublic S next() throws IOException
IterativeReadernext in interface IterativeReader<S extends Spectrum<A>>IOException - if there is an io exceptionpublic void close()
throws IOException
IterativeReaderclose in interface IterativeReader<S extends Spectrum<A>>IOException - If an I/O error occurspublic void acceptUnsortedSpectra()
protected abstract String parseHeader(AbstractMsReader.ParseContext context) throws IOException
context - the parser contextIOExceptionpublic String getHeader()
protected void addPeaksToSpectrum(S spectrum, double[] mzs, double[] intensities, int size)
spectrum - the spectrum to add peaks into.mzs - the peak's m/zs.intensities - the peak's intensities.size - the spectrum sizeUnsortedPeakListException - if reader is not allowed to add unsorted peaklists.protected int addPeakToSpectrum(Spectrum<A> spectrum, double mz, double intensity, AbstractMsReader.ParseContext context)
spectrum - the spectrum to add peak into.mz - the peak's m/z.intensity - the peak's intensity.context - the parse contextUnsortedPeakListException - if reader is not allowed to add unsorted peaklists.Copyright © 2016. All Rights Reserved.