Skip to content

Commit

Permalink
Move File to IVendorStandaloneMassSpectrum
Browse files Browse the repository at this point in the history
  • Loading branch information
eselmeister committed Feb 23, 2022
1 parent 168aad2 commit 9c0d6ba
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.eclipse.chemclipse.msd.converter.io.IMassSpectraReader;
import org.eclipse.chemclipse.msd.model.core.AbstractIon;
import org.eclipse.chemclipse.msd.model.core.IMassSpectra;
import org.eclipse.chemclipse.msd.model.core.IVendorMassSpectrum;
import org.eclipse.chemclipse.msd.model.core.IVendorStandaloneMassSpectrum;
import org.eclipse.chemclipse.msd.model.exceptions.IonLimitExceededException;
import org.eclipse.chemclipse.msd.model.implementation.VendorMassSpectrum;
import org.eclipse.core.runtime.IProgressMonitor;
Expand Down Expand Up @@ -54,7 +54,7 @@ public class MassSpectrumReader extends AbstractMassSpectraReader implements IMa
@Override
public IMassSpectra read(File file, IProgressMonitor monitor) throws IOException {

IVendorMassSpectrum massSpectrum = null;
IVendorStandaloneMassSpectrum massSpectrum = null;
//
try {
AnIMLType animl = XmlReader.getAnIML(file);
Expand Down Expand Up @@ -143,10 +143,10 @@ public IMassSpectra read(File file, IProgressMonitor monitor) throws IOException
return massSpectra;
}

private IVendorMassSpectrum readSample(AnIMLType animl, IVendorMassSpectrum massSpectrum) {
private IVendorStandaloneMassSpectrum readSample(AnIMLType animl, IVendorStandaloneMassSpectrum massSpectrum) {

SampleType sample = animl.getSampleSet().getSample().get(0);
massSpectrum.setIdentifier(sample.getSampleID());
return massSpectrum;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.eclipse.chemclipse.msd.model.core.IMassSpectra;
import org.eclipse.chemclipse.msd.model.core.IScanMSD;
import org.eclipse.chemclipse.msd.model.core.IVendorMassSpectrum;
import org.eclipse.chemclipse.msd.model.core.IVendorStandaloneMassSpectrum;
import org.eclipse.core.runtime.IProgressMonitor;

import net.openchrom.xxd.converter.supplier.animl.internal.converter.BinaryReader;
Expand Down Expand Up @@ -87,13 +88,15 @@ private void writeMassSpectra(FileWriter fileWriter, IMassSpectra massSpectra, I
public void writeMassSpectrum(FileWriter fileWriter, IScanMSD massSpectrum, IProgressMonitor monitor) throws IOException {

try {
writeAnIML(fileWriter, (IVendorMassSpectrum)massSpectrum);
if(massSpectrum instanceof IVendorStandaloneMassSpectrum) {
writeAnIML(fileWriter, (IVendorStandaloneMassSpectrum)massSpectrum);
}
} catch(JAXBException e) {
logger.warn(e);
}
}

private void writeAnIML(FileWriter fileWriter, IVendorMassSpectrum massSpectrum) throws JAXBException {
private void writeAnIML(FileWriter fileWriter, IVendorStandaloneMassSpectrum massSpectrum) throws JAXBException {

JAXBContext jaxbContext = JAXBContext.newInstance(AnIMLType.class);
Marshaller marshaller = jaxbContext.createMarshaller();
Expand All @@ -106,7 +109,7 @@ private void writeAnIML(FileWriter fileWriter, IVendorMassSpectrum massSpectrum)
marshaller.marshal(anIML, fileWriter);
}

private SampleSetType createSampleSet(IVendorMassSpectrum massSpectrum) {
private SampleSetType createSampleSet(IVendorStandaloneMassSpectrum massSpectrum) {

SampleSetType sampleSet = new SampleSetType();
SampleType sample = new SampleType();
Expand Down Expand Up @@ -225,4 +228,4 @@ private AuditTrailEntrySetType createAuditTrail() {
auditTrail.setSoftware(Common.createSoftware());
return auditTrailEntrySet;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2021 Lablicate GmbH.
* Copyright (c) 2008, 2022 Lablicate GmbH.
*
* All rights reserved.
* This program and the accompanying materials are made available under the
Expand All @@ -11,7 +11,7 @@
*******************************************************************************/
package net.openchrom.msd.converter.supplier.animl.model;

import org.eclipse.chemclipse.msd.model.core.IVendorMassSpectrum;
import org.eclipse.chemclipse.msd.model.core.IVendorStandaloneMassSpectrum;

public interface IVendorScan extends IVendorMassSpectrum {
}
public interface IVendorScan extends IVendorStandaloneMassSpectrum {
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2013, 2021 Lablicate GmbH.
* Copyright (c) 2013, 2022 Lablicate GmbH.
*
* All rights reserved.
* This program and the accompanying materials are made available under the
Expand All @@ -13,18 +13,18 @@

import org.eclipse.chemclipse.msd.model.core.AbstractMassSpectra;
import org.eclipse.chemclipse.msd.model.core.IScanMSD;
import org.eclipse.chemclipse.msd.model.core.IVendorMassSpectrum;
import org.eclipse.chemclipse.msd.model.core.IVendorStandaloneMassSpectrum;

public class VendorMassSpectra extends AbstractMassSpectra implements IVendorMassSpectra {

@Override
public String getName() {

IScanMSD scanMSD = this.getMassSpectrum(1);
if(scanMSD instanceof IVendorMassSpectrum) {
return ((IVendorMassSpectrum)scanMSD).getName();
if(scanMSD instanceof IVendorStandaloneMassSpectrum) {
return ((IVendorStandaloneMassSpectrum)scanMSD).getName();
} else {
return super.getName();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2021 Lablicate GmbH.
* Copyright (c) 2008, 2022 Lablicate GmbH.
*
* All rights reserved.
* This program and the accompanying materials are made available under the
Expand All @@ -13,24 +13,15 @@

import org.eclipse.chemclipse.logging.core.Logger;
import org.eclipse.chemclipse.model.exceptions.AbundanceLimitExceededException;
import org.eclipse.chemclipse.msd.model.core.AbstractVendorMassSpectrum;
import org.eclipse.chemclipse.msd.model.core.AbstractVendorStandaloneMassSpectrum;
import org.eclipse.chemclipse.msd.model.core.IIon;
import org.eclipse.chemclipse.msd.model.exceptions.IonLimitExceededException;

public class VendorScan extends AbstractVendorMassSpectrum implements IVendorScan {
public class VendorScan extends AbstractVendorStandaloneMassSpectrum implements IVendorScan {

/**
* Renew the serialVersionUID any time you have changed some fields or
* methods.
*/
private static final long serialVersionUID = -4140714855668296421L;
private static final long serialVersionUID = -2505351166336940676L;
private static final Logger logger = Logger.getLogger(VendorScan.class);
/**
* MAX_IONS The total amount of ions to be stored in the
* cdf chromatogram.<br/>
* It does not mean, that ion 65535 is the upper bound, but only 65535 mass
* fragments can be stored in a mass spectrum.
*/
//
public static final int MAX_IONS = 65535;
public static final int MIN_RETENTION_TIME = 0;
public static final int MAX_RETENTION_TIME = Integer.MAX_VALUE;
Expand Down Expand Up @@ -84,4 +75,4 @@ protected Object clone() throws CloneNotSupportedException {

return makeDeepCopy();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2013, 2021 Lablicate GmbH.
* Copyright (c) 2013, 2022 Lablicate GmbH.
*
* All rights reserved.
* This program and the accompanying materials are made available under the
Expand All @@ -13,18 +13,18 @@

import org.eclipse.chemclipse.msd.model.core.AbstractMassSpectra;
import org.eclipse.chemclipse.msd.model.core.IScanMSD;
import org.eclipse.chemclipse.msd.model.core.IVendorMassSpectrum;
import org.eclipse.chemclipse.msd.model.core.IVendorStandaloneMassSpectrum;

public class VendorMassSpectra extends AbstractMassSpectra implements IVendorMassSpectra {

@Override
public String getName() {

IScanMSD scanMSD = this.getMassSpectrum(1);
if(scanMSD instanceof IVendorMassSpectrum) {
return ((IVendorMassSpectrum)scanMSD).getName();
if(scanMSD instanceof IVendorStandaloneMassSpectrum) {
return ((IVendorStandaloneMassSpectrum)scanMSD).getName();
} else {
return super.getName();
}
}
}
}

0 comments on commit 9c0d6ba

Please sign in to comment.