MzMLRawDataFile.java
/*
* (C) Copyright 2015-2016 by MSDK Development Team
*
* This software is dual-licensed under either
*
* (a) the terms of the GNU Lesser General Public License version 2.1 as published by the Free
* Software Foundation
*
* or (per the licensee's choosing)
*
* (b) the terms of the Eclipse Public License v1.0 as published by the Eclipse Foundation.
*/
package io.github.msdk.io.mzml.data;
import java.io.File;
import java.util.List;
import java.util.Optional;
import javax.annotation.Nonnull;
import com.google.common.collect.ImmutableList;
import io.github.msdk.datamodel.chromatograms.Chromatogram;
import io.github.msdk.datamodel.files.FileType;
import io.github.msdk.datamodel.rawdata.MsScan;
import io.github.msdk.datamodel.rawdata.RawDataFile;
/**
* <p>MzMLRawDataFile class.</p>
*
*/
public class MzMLRawDataFile implements RawDataFile {
private static final @Nonnull FileType fileType = FileType.MZML;
private final File sourceFile;
private final @Nonnull List<String> msFunctions;
private final @Nonnull List<MsScan> msScans;
private final @Nonnull List<Chromatogram> chromatograms;
private @Nonnull String name;
/**
* <p>
* Constructor for MzMLRawDataFile.
* </p>
*
* @param sourceFile a {@link java.io.File} object.
* @param msFunctions a {@link java.util.List} object.
* @param msScans a {@link java.util.List} object.
* @param chromatograms a {@link java.util.List} object.
*/
@SuppressWarnings("null")
public MzMLRawDataFile(File sourceFile, List<String> msFunctions, List<MsScan> msScans,
List<Chromatogram> chromatograms) {
this.sourceFile = sourceFile;
this.name = sourceFile != null ? sourceFile.getName() : null;
this.msFunctions = msFunctions;
this.msScans = msScans;
this.chromatograms = chromatograms;
}
/** {@inheritDoc} */
@Override
@Nonnull
public String getName() {
return name;
}
/** {@inheritDoc} */
@Override
public Optional<File> getOriginalFile() {
return Optional.ofNullable(sourceFile);
}
/** {@inheritDoc} */
@Override
@Nonnull
public FileType getRawDataFileType() {
return fileType;
}
/** {@inheritDoc} */
@SuppressWarnings("null")
@Override
@Nonnull
public List<String> getMsFunctions() {
return ImmutableList.copyOf(msFunctions);
}
/** {@inheritDoc} */
@SuppressWarnings("null")
@Override
@Nonnull
public List<MsScan> getScans() {
return ImmutableList.copyOf(msScans);
}
/** {@inheritDoc} */
@SuppressWarnings("null")
@Override
@Nonnull
public List<Chromatogram> getChromatograms() {
return ImmutableList.copyOf(chromatograms);
}
/** {@inheritDoc} */
@Override
public void dispose() {}
}