@Test public void buildIndexTestLocation() throws Exception { String file = "DDA-1-scan-broken-index.mzXML"; int expectedCount = 1; long expectedOffset = 1426; int expectedLen = 11721; final Path path = ResourceUtils.getResource(this.getClass(), RESOURCE_LOCATION, file); if (!Files.exists(path)) { throw new IllegalStateException("Test file " + file + " was probably deleted."); } final MZXMLFile mzxml = new MZXMLFile(path.toString()); final MZXMLIndex index = mzxml.fetchIndex(); assertEquals("Wrong number of scans in the build index: " + file, expectedCount, index.size()); final MZXMLIndexElement elem = index.getMapByNum().firstEntry().getValue(); assertEquals("Wrong offset: " + file, expectedOffset, elem.getOffsetLength().offset); assertEquals("Wrong length: " + file, expectedLen, elem.getOffsetLength().length); }
@Override public MZXMLIndex fetchIndex() throws FileParsingException { MZXMLIndex tmp = index; if (tmp == null) { synchronized (this) { tmp = getIndex(); if (tmp == null) { tmp = parseIndex(); index = tmp; } } } return tmp; }
MZXMLFile extends AbstractXMLBasedDataSource<MZXMLIndexElement, MZXMLIndex> { @Override public MZXMLIndex fetchIndex() throws FileParsingException { MZXMLIndex tmp = index; if (tmp == null) { synchronized (this) { tmp = getIndex(); if (tmp == null) { tmp = parseIndex(); index = tmp; } } } return tmp; } }
MZXMLFile extends AbstractXMLBasedDataSource<MZXMLIndexElement, MZXMLIndex> { @Override public MZXMLIndex fetchIndex() throws FileParsingException { MZXMLIndex tmp = index; if (tmp == null) { synchronized (this) { tmp = getIndex(); if (tmp == null) { tmp = parseIndex(); index = tmp; } } } return tmp; } MZXMLFile(String path);  MZXMLFile(String path, boolean excludeEmptyScans); }
MZXMLFile extends AbstractXMLBasedDataSource<MZXMLIndexElement, MZXMLIndex> { @Override public MZXMLIndex fetchIndex() throws FileParsingException { MZXMLIndex tmp = index; if (tmp == null) { synchronized (this) { tmp = getIndex(); if (tmp == null) { tmp = parseIndex(); index = tmp; } } } return tmp; } MZXMLFile(String path);  MZXMLFile(String path, boolean excludeEmptyScans); ObjectPool<XMLStreamReaderImpl> getReaderPool(); @Override MZXMLIndex getIndex(); @Override MZXMLIndex parseIndex(); @Override MZXMLIndex fetchIndex(); @Override LCMSRunInfo parseRunInfo(); @Override MZXMLMultiSpectraParser getSpectraParser(InputStream inputStream,
      LCMSDataSubset subset, ObjectPool<XMLStreamReaderImpl> readerPool, Integer numSpectra); @Override IndexBuilder<MZXMLIndexElement> getIndexBuilder(IndexBuilder.Info info); }
MZXMLFile extends AbstractXMLBasedDataSource<MZXMLIndexElement, MZXMLIndex> { @Override public MZXMLIndex fetchIndex() throws FileParsingException { MZXMLIndex tmp = index; if (tmp == null) { synchronized (this) { tmp = getIndex(); if (tmp == null) { tmp = parseIndex(); index = tmp; } } } return tmp; } MZXMLFile(String path);  MZXMLFile(String path, boolean excludeEmptyScans); ObjectPool<XMLStreamReaderImpl> getReaderPool(); @Override MZXMLIndex getIndex(); @Override MZXMLIndex parseIndex(); @Override MZXMLIndex fetchIndex(); @Override LCMSRunInfo parseRunInfo(); @Override MZXMLMultiSpectraParser getSpectraParser(InputStream inputStream,
      LCMSDataSubset subset, ObjectPool<XMLStreamReaderImpl> readerPool, Integer numSpectra); @Override IndexBuilder<MZXMLIndexElement> getIndexBuilder(IndexBuilder.Info info);  }