diff --git a/chemclipse/plugins/org.eclipse.chemclipse.msd.model/src/org/eclipse/chemclipse/msd/model/noise/Calculator.java b/chemclipse/plugins/org.eclipse.chemclipse.msd.model/src/org/eclipse/chemclipse/msd/model/noise/Calculator.java index 994b59d591..b4f9b992b9 100644 --- a/chemclipse/plugins/org.eclipse.chemclipse.msd.model/src/org/eclipse/chemclipse/msd/model/noise/Calculator.java +++ b/chemclipse/plugins/org.eclipse.chemclipse.msd.model/src/org/eclipse/chemclipse/msd/model/noise/Calculator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2019 Lablicate GmbH. + * Copyright (c) 2010, 2020 Lablicate GmbH. * * All rights reserved. This * program and the accompanying materials are made available under the terms of @@ -25,7 +25,6 @@ import org.eclipse.chemclipse.msd.model.core.support.IMarkedIons; import org.eclipse.chemclipse.msd.model.exceptions.FilterException; import org.eclipse.chemclipse.msd.model.support.CombinedMassSpectrumCalculator; -import org.eclipse.chemclipse.msd.model.support.ICombinedMassSpectrumCalculator; import org.eclipse.chemclipse.msd.model.xic.IExtractedIonSignal; import org.eclipse.chemclipse.msd.model.xic.IExtractedIonSignals; import org.eclipse.chemclipse.numeric.statistics.Calculations; @@ -53,7 +52,7 @@ public Calculator() { */ public ICombinedMassSpectrum getNoiseMassSpectrum(List noiseMassSpectra, IMarkedIons ionsToPreserve, IProgressMonitor monitor) { - ICombinedMassSpectrumCalculator combinedMassSpectrumCalculator = new CombinedMassSpectrumCalculator(); + CombinedMassSpectrumCalculator combinedMassSpectrumCalculator = new CombinedMassSpectrumCalculator(); /* * Iterate through all given noise mass spectra. */ @@ -126,7 +125,7 @@ private List calculateNoiseSegments(List analys * with the segment. The noise segment will be stored in the * noise segment list. */ - ICombinedMassSpectrumCalculator combinedMassSpectrumCalculator = calculatorSupport.getCombinedMassSpectrumCalculator(analysisSegment, extractedIonSignals); + CombinedMassSpectrumCalculator combinedMassSpectrumCalculator = calculatorSupport.getCombinedMassSpectrumCalculator(analysisSegment, extractedIonSignals); ICombinedMassSpectrum noiseMassSpectrum = calculatorSupport.getNoiseMassSpectrum(combinedMassSpectrumCalculator, ionsToPreserve, monitor); INoiseSegment noiseSegment = new NoiseSegment(analysisSegment, noiseMassSpectrum); noiseSegments.add(noiseSegment); diff --git a/chemclipse/plugins/org.eclipse.chemclipse.msd.model/src/org/eclipse/chemclipse/msd/model/noise/CalculatorSupport.java b/chemclipse/plugins/org.eclipse.chemclipse.msd.model/src/org/eclipse/chemclipse/msd/model/noise/CalculatorSupport.java index 8723681411..d0d52d25cd 100644 --- a/chemclipse/plugins/org.eclipse.chemclipse.msd.model/src/org/eclipse/chemclipse/msd/model/noise/CalculatorSupport.java +++ b/chemclipse/plugins/org.eclipse.chemclipse.msd.model/src/org/eclipse/chemclipse/msd/model/noise/CalculatorSupport.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2019 Lablicate GmbH. + * Copyright (c) 2010, 2020 Lablicate GmbH. * * All rights reserved. This * program and the accompanying materials are made available under the terms of @@ -29,7 +29,6 @@ import org.eclipse.chemclipse.msd.model.implementation.CombinedMassSpectrum; import org.eclipse.chemclipse.msd.model.implementation.Ion; import org.eclipse.chemclipse.msd.model.support.CombinedMassSpectrumCalculator; -import org.eclipse.chemclipse.msd.model.support.ICombinedMassSpectrumCalculator; import org.eclipse.chemclipse.msd.model.xic.IExtractedIonSignal; import org.eclipse.chemclipse.msd.model.xic.IExtractedIonSignals; import org.eclipse.core.runtime.IProgressMonitor; @@ -61,10 +60,10 @@ public boolean acceptSegment(double[] values, double mean) { * * @return */ - public ICombinedMassSpectrumCalculator getCombinedMassSpectrumCalculator(IAnalysisSegment analysisSegment, IExtractedIonSignals extractedIonSignals) { + public CombinedMassSpectrumCalculator getCombinedMassSpectrumCalculator(IAnalysisSegment analysisSegment, IExtractedIonSignals extractedIonSignals) { IExtractedIonSignal extractedIonSignal; - ICombinedMassSpectrumCalculator combinedMassSpectrumCalculator = new CombinedMassSpectrumCalculator(); + CombinedMassSpectrumCalculator combinedMassSpectrumCalculator = new CombinedMassSpectrumCalculator(); for(int scan = analysisSegment.getStartScan(); scan <= analysisSegment.getStopScan(); scan++) { try { extractedIonSignal = extractedIonSignals.getExtractedIonSignal(scan); @@ -83,7 +82,7 @@ public ICombinedMassSpectrumCalculator getCombinedMassSpectrumCalculator(IAnalys public static ICombinedMassSpectrum getCombinedMassSpectrum(IExtractedIonSignals extractedIonSignals, IScanRange range) { - ICombinedMassSpectrumCalculator combinedMassSpectrumCalculator = new CombinedMassSpectrumCalculator(); + CombinedMassSpectrumCalculator combinedMassSpectrumCalculator = new CombinedMassSpectrumCalculator(); for(int scan = range.getStartScan(); scan <= range.getStopScan(); scan++) { try { IExtractedIonSignal extractedIonSignal = extractedIonSignals.getExtractedIonSignal(scan); @@ -100,7 +99,7 @@ public static ICombinedMassSpectrum getCombinedMassSpectrum(IExtractedIonSignals float abundance; ICombinedMassSpectrum noiseMassSpectrum = new CombinedMassSpectrum(); IIon noiseIon; - Map ions = combinedMassSpectrumCalculator.getValues(); + Map ions = combinedMassSpectrumCalculator.getValuesIntensities(); for(Integer ion : ions.keySet()) { /* * Check the abundance. @@ -121,7 +120,7 @@ public static ICombinedMassSpectrum getCombinedMassSpectrum(IExtractedIonSignals /* * Returns a combined mass spectrum. */ - public ICombinedMassSpectrum getNoiseMassSpectrum(ICombinedMassSpectrumCalculator combinedMassSpectrumCalculator, IMarkedIons ionsToPreserve, IProgressMonitor monitor) { + public ICombinedMassSpectrum getNoiseMassSpectrum(CombinedMassSpectrumCalculator combinedMassSpectrumCalculator, IMarkedIons ionsToPreserve, IProgressMonitor monitor) { /* * Remove the ions to preserve. @@ -138,7 +137,7 @@ public ICombinedMassSpectrum getNoiseMassSpectrum(ICombinedMassSpectrumCalculato float abundance; ICombinedMassSpectrum noiseMassSpectrum = new CombinedMassSpectrum(); IIon noiseIon; - Map ions = combinedMassSpectrumCalculator.getValues(); + Map ions = combinedMassSpectrumCalculator.getValuesIntensities(); for(Integer ion : ions.keySet()) { /* * Check the abundance. diff --git a/chemclipse/plugins/org.eclipse.chemclipse.msd.model/src/org/eclipse/chemclipse/msd/model/support/CombinedMassSpectrumCalculator.java b/chemclipse/plugins/org.eclipse.chemclipse.msd.model/src/org/eclipse/chemclipse/msd/model/support/CombinedMassSpectrumCalculator.java index dc63383244..14320d5832 100644 --- a/chemclipse/plugins/org.eclipse.chemclipse.msd.model/src/org/eclipse/chemclipse/msd/model/support/CombinedMassSpectrumCalculator.java +++ b/chemclipse/plugins/org.eclipse.chemclipse.msd.model/src/org/eclipse/chemclipse/msd/model/support/CombinedMassSpectrumCalculator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2018 Lablicate GmbH. + * Copyright (c) 2008, 2020 Lablicate GmbH. * * All rights reserved. * This program and the accompanying materials are made available under the @@ -11,6 +11,7 @@ *******************************************************************************/ package org.eclipse.chemclipse.msd.model.support; +import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -20,41 +21,38 @@ import org.eclipse.chemclipse.msd.model.core.AbstractIon; import org.eclipse.chemclipse.msd.model.core.IIon; import org.eclipse.chemclipse.msd.model.core.support.IMarkedIons; +import org.eclipse.chemclipse.numeric.statistics.Calculations; -public class CombinedMassSpectrumCalculator implements ICombinedMassSpectrumCalculator { +public class CombinedMassSpectrumCalculator { - private Map combinedMassSpectrum; + private Map> combinedMassSpectrum = new HashMap>(); - public CombinedMassSpectrumCalculator() { - combinedMassSpectrum = new HashMap(); - } - - @Override - public void addIon(double ion, float abundance) { + public void addIon(double ion, double abundance) { /* * If the abundance is zero, do nothing and return. */ - if(abundance == 0.0f) { + if(abundance == 0.0d) { return; } int key = AbstractIon.getIon(ion); /* * Add the abundance if still a ion exists, otherwise still add the ion. */ - if(combinedMassSpectrum.containsKey(key)) { - combinedMassSpectrum.put(key, combinedMassSpectrum.get(key) + abundance); - } else { - combinedMassSpectrum.put(key, (double)abundance); + List intensities = combinedMassSpectrum.get(key); + if(intensities == null) { + intensities = new ArrayList(); + combinedMassSpectrum.put(key, intensities); } + intensities.add(abundance); } - @Override public void addIons(List ions, IMarkedIons excludedIons) { if(ions == null || excludedIons == null) { return; } + // Set excludedIonsNominal = excludedIons.getIonsNominal(); for(IIon ion : ions) { if(!excludedIonsNominal.contains(ion.getIon())) { @@ -63,14 +61,12 @@ public void addIons(List ions, IMarkedIons excludedIons) { } } - @Override public void removeIon(double ion) { int key = AbstractIon.getIon(ion); combinedMassSpectrum.remove(key); } - @Override public void removeIons(IMarkedIons excludedIons) { for(Integer ion : excludedIons.getIonsNominal()) { @@ -78,24 +74,26 @@ public void removeIons(IMarkedIons excludedIons) { } } - @Override public double getAbundance(double ion) { - double result = 0.0d; int key = AbstractIon.getIon(ion); - if(combinedMassSpectrum.containsKey(key)) { - result = combinedMassSpectrum.get(key); - } - return result; + return calculateSumIntensity(combinedMassSpectrum.get(key)); } - @Override - public Map getValues() { + public Map> getValues() { return combinedMassSpectrum; } - @Override + public Map getValuesIntensities() { + + Map map = new HashMap<>(); + for(Integer key : combinedMassSpectrum.keySet()) { + map.put(key, calculateSumIntensity(combinedMassSpectrum.get(key))); + } + return map; + } + public void normalize(float normalizationFactor) { /* @@ -107,15 +105,38 @@ public void normalize(float normalizationFactor) { /* * If max is zero it doesn't even make sense to go further on. */ - double max = Collections.max(combinedMassSpectrum.values()); + double max = Collections.max(getValuesIntensities().values()); if(max == 0.0d) { return; } + // double correlationFactor = normalizationFactor / max; - double value; for(Integer key : combinedMassSpectrum.keySet()) { - value = correlationFactor * combinedMassSpectrum.get(key); - combinedMassSpectrum.put(key, value); + List adjustedIntensities = new ArrayList<>(); + for(double intensity : combinedMassSpectrum.get(key)) { + adjustedIntensities.add(correlationFactor * intensity); + } + combinedMassSpectrum.put(key, adjustedIntensities); + } + } + + public double calculateSumIntensity(List intensities) { + + double sum = 0.0d; + if(intensities != null) { + int size = intensities.size(); + double[] values = new double[size]; + for(int i = 0; i < size; i++) { + values[i] = intensities.get(i); + } + /* + * Add an option here to calculate the sum, + * mean or median signal. + */ + sum = Calculations.getSum(values); + // sum = Calculations.getMean(values); + // sum = Calculations.getMedian(values); } + return sum; } } diff --git a/chemclipse/plugins/org.eclipse.chemclipse.msd.model/src/org/eclipse/chemclipse/msd/model/support/FilterSupport.java b/chemclipse/plugins/org.eclipse.chemclipse.msd.model/src/org/eclipse/chemclipse/msd/model/support/FilterSupport.java index 17d4952f15..566fa9d5d5 100644 --- a/chemclipse/plugins/org.eclipse.chemclipse.msd.model/src/org/eclipse/chemclipse/msd/model/support/FilterSupport.java +++ b/chemclipse/plugins/org.eclipse.chemclipse.msd.model/src/org/eclipse/chemclipse/msd/model/support/FilterSupport.java @@ -51,7 +51,7 @@ public static IScanMSD getCombinedMassSpectrum(IChromatogramSelectionMSD chromat IChromatogramMSD chromatogram = chromatogramSelection.getChromatogram(); int startScan = chromatogram.getScanNumber(chromatogramSelection.getStartRetentionTime()); int stopScan = chromatogram.getScanNumber(chromatogramSelection.getStopRetentionTime()); - ICombinedMassSpectrumCalculator massSpectrumCalculator = new CombinedMassSpectrumCalculator(); + CombinedMassSpectrumCalculator massSpectrumCalculator = new CombinedMassSpectrumCalculator(); /* * Merge all selected scans.
All scan intensities will be added. * Afterwards, they will be normalized.
It would be also possible @@ -88,7 +88,7 @@ public static IScanMSD getCombinedMassSpectrum(IScanMSD massSpectrum1, IScanMSD * If one of the mass spectra is null, take only the valid one to calculate the normalized mass spectrum. */ excludedIons = validateExcludedIons(excludedIons); - ICombinedMassSpectrumCalculator massSpectrumCalculator = new CombinedMassSpectrumCalculator(); + CombinedMassSpectrumCalculator massSpectrumCalculator = new CombinedMassSpectrumCalculator(); // if(massSpectrum1 == null) { addIonsToCalculator(massSpectrum2, excludedIons, massSpectrumCalculator, useNormalize); @@ -104,7 +104,7 @@ public static IScanMSD getCombinedMassSpectrum(IScanMSD massSpectrum1, IScanMSD return getMassSpectrum(massSpectrumCalculator, useNormalize); } - private static void addIonsToCalculator(IScanMSD massSpectrum, IMarkedIons excludedIons, ICombinedMassSpectrumCalculator massSpectrumCalculator, boolean useNormalize) { + private static void addIonsToCalculator(IScanMSD massSpectrum, IMarkedIons excludedIons, CombinedMassSpectrumCalculator massSpectrumCalculator, boolean useNormalize) { IScanMSD massSpectrumCalculated = getCalculatedMassSpectrum(massSpectrum, excludedIons, useNormalize); massSpectrumCalculator.addIons(massSpectrumCalculated.getIons(), excludedIons); @@ -125,7 +125,7 @@ public static IScanMSD getCalculatedMassSpectrum(IScanMSD massSpectrum, IMarkedI } excludedIons = validateExcludedIons(excludedIons); // - ICombinedMassSpectrumCalculator massSpectrumCalculator = new CombinedMassSpectrumCalculator(); + CombinedMassSpectrumCalculator massSpectrumCalculator = new CombinedMassSpectrumCalculator(); massSpectrumCalculator.addIons(massSpectrum.getIons(), excludedIons); return getMassSpectrum(massSpectrumCalculator, useNormalize); } @@ -153,12 +153,12 @@ private static IMarkedIons validateExcludedIons(IMarkedIons excludedIons) { * @param massSpectrumCalculator * @return IMassSpectrum */ - private static IScanMSD getMassSpectrum(ICombinedMassSpectrumCalculator massSpectrumCalculator, boolean useNormalize) { + private static IScanMSD getMassSpectrum(CombinedMassSpectrumCalculator massSpectrumCalculator, boolean useNormalize) { if(useNormalize) { massSpectrumCalculator.normalize(NORMALIZATION_FACTOR); } - Map ions = massSpectrumCalculator.getValues(); + Map ions = massSpectrumCalculator.getValuesIntensities(); return getMassSpectrum(ions); } diff --git a/chemclipse/plugins/org.eclipse.chemclipse.msd.model/src/org/eclipse/chemclipse/msd/model/support/ICombinedMassSpectrumCalculator.java b/chemclipse/plugins/org.eclipse.chemclipse.msd.model/src/org/eclipse/chemclipse/msd/model/support/ICombinedMassSpectrumCalculator.java deleted file mode 100644 index ff1e086cb6..0000000000 --- a/chemclipse/plugins/org.eclipse.chemclipse.msd.model/src/org/eclipse/chemclipse/msd/model/support/ICombinedMassSpectrumCalculator.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2018 Lablicate GmbH. - * - * All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Dr. Philip Wenig - initial API and implementation - *******************************************************************************/ -package org.eclipse.chemclipse.msd.model.support; - -import java.util.List; -import java.util.Map; - -import org.eclipse.chemclipse.msd.model.core.IIon; -import org.eclipse.chemclipse.msd.model.core.support.IMarkedIons; - -// TODO JUnit -public interface ICombinedMassSpectrumCalculator { - - /** - * Adds the abundance of the given ion to the calculator. - * - * @param ion - * @param abundance - */ - void addIon(double ion, float abundance); - - /** - * Adds the ions given in the list to the calculator.
- * All ions listed in excludedIons will not be - * considered. - * - * @param ions - * @param excludedIons - */ - void addIons(List ions, IMarkedIons excludedIons); - - /** - * Removes the given ion. - * - * @param ion - */ - void removeIon(double ion); - - /** - * Removes the given ions. - * - * @param excludedIons - */ - void removeIons(IMarkedIons excludedIons); - - /** - * Normalizes the stored values to the given normalization factor.
- * The biggest value gets the normalization factor. All others get values - * relative to it.
- * The normalization factor must not be smaller or equal zero. That doesn't - * make sense. - * - * @param normalizationFactor - */ - void normalize(float normalizationFactor); - - /** - * Returns the abundance value to the given ion (ion). - * - * @param ion - * @return double - */ - double getAbundance(double ion); - - /** - * Returns a list of the stored key - values mappings.
- * Use it as:
- * key - ion
- * value - abundance
- * - * @return Map - */ - Map getValues(); -} diff --git a/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/noise/CalculatorSupport_2_Test.java b/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/noise/CalculatorSupport_2_Test.java index 74357f0c1c..26c5892399 100644 --- a/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/noise/CalculatorSupport_2_Test.java +++ b/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/noise/CalculatorSupport_2_Test.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2019 Lablicate GmbH. + * Copyright (c) 2010, 2020 Lablicate GmbH. * * All rights reserved. This * program and the accompanying materials are made available under the terms of @@ -12,7 +12,7 @@ package org.eclipse.chemclipse.msd.model.noise; import org.eclipse.chemclipse.model.support.AnalysisSegment; -import org.eclipse.chemclipse.msd.model.support.ICombinedMassSpectrumCalculator; +import org.eclipse.chemclipse.msd.model.support.CombinedMassSpectrumCalculator; import org.eclipse.chemclipse.msd.model.xic.ExtractedIonSignal; import org.eclipse.chemclipse.msd.model.xic.ExtractedIonSignals; import org.eclipse.chemclipse.msd.model.xic.IExtractedIonSignal; @@ -26,7 +26,7 @@ public class CalculatorSupport_2_Test extends TestCase { private AnalysisSegment analysisSegment; private IExtractedIonSignals extractedIonSignals; private IExtractedIonSignal extractedIonSignal; - private ICombinedMassSpectrumCalculator combinedMassSpectrumCalculator; + private CombinedMassSpectrumCalculator combinedMassSpectrumCalculator; @Override protected void setUp() throws Exception { diff --git a/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/noise/CalculatorSupport_4_Test.java b/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/noise/CalculatorSupport_4_Test.java index 42e40d1c46..82ae18657f 100644 --- a/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/noise/CalculatorSupport_4_Test.java +++ b/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/noise/CalculatorSupport_4_Test.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2019 Lablicate GmbH. + * Copyright (c) 2010, 2020 Lablicate GmbH. * * All rights reserved. This * program and the accompanying materials are made available under the terms of @@ -16,7 +16,7 @@ import org.eclipse.chemclipse.msd.model.core.support.IMarkedIons; import org.eclipse.chemclipse.msd.model.core.support.MarkedIon; import org.eclipse.chemclipse.msd.model.core.support.MarkedIons; -import org.eclipse.chemclipse.msd.model.support.ICombinedMassSpectrumCalculator; +import org.eclipse.chemclipse.msd.model.support.CombinedMassSpectrumCalculator; import org.eclipse.chemclipse.msd.model.xic.ExtractedIonSignal; import org.eclipse.chemclipse.msd.model.xic.ExtractedIonSignals; import org.eclipse.chemclipse.msd.model.xic.IExtractedIonSignal; @@ -31,7 +31,7 @@ public class CalculatorSupport_4_Test extends TestCase { private AnalysisSegment analysisSegment; private IExtractedIonSignals extractedIonSignals; private IExtractedIonSignal extractedIonSignal; - private ICombinedMassSpectrumCalculator combinedMassSpectrumCalculator; + private CombinedMassSpectrumCalculator combinedMassSpectrumCalculator; private IMarkedIons ionsToPreserve; private ICombinedMassSpectrum noiseMassSpectrum; diff --git a/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/support/CombinedMassSpectrumCalculator_1_Test.java b/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/support/CombinedMassSpectrumCalculator_1_Test.java index ff6cb08f54..f88434e0a1 100644 --- a/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/support/CombinedMassSpectrumCalculator_1_Test.java +++ b/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/support/CombinedMassSpectrumCalculator_1_Test.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2018 Lablicate GmbH. + * Copyright (c) 2008, 2020 Lablicate GmbH. * * All rights reserved. * This program and the accompanying materials are made available under the @@ -11,14 +11,11 @@ *******************************************************************************/ package org.eclipse.chemclipse.msd.model.support; -import org.eclipse.chemclipse.msd.model.support.CombinedMassSpectrumCalculator; -import org.eclipse.chemclipse.msd.model.support.ICombinedMassSpectrumCalculator; - import junit.framework.TestCase; public class CombinedMassSpectrumCalculator_1_Test extends TestCase { - private ICombinedMassSpectrumCalculator combinedMassSpectrumCalculator; + private CombinedMassSpectrumCalculator combinedMassSpectrumCalculator; @Override protected void setUp() throws Exception { diff --git a/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/support/CombinedMassSpectrumCalculator_2_Test.java b/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/support/CombinedMassSpectrumCalculator_2_Test.java index bcefeb35c5..76f208027b 100644 --- a/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/support/CombinedMassSpectrumCalculator_2_Test.java +++ b/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/support/CombinedMassSpectrumCalculator_2_Test.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2019 Lablicate GmbH. + * Copyright (c) 2008, 2020 Lablicate GmbH. * * All rights reserved. * This program and the accompanying materials are made available under the @@ -25,7 +25,7 @@ public class CombinedMassSpectrumCalculator_2_Test extends TestCase { - private ICombinedMassSpectrumCalculator combinedMassSpectrumCalculator; + private CombinedMassSpectrumCalculator combinedMassSpectrumCalculator; private IMarkedIons excludedIons; private List ions; diff --git a/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/support/CombinedMassSpectrumCalculator_3_Test.java b/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/support/CombinedMassSpectrumCalculator_3_Test.java index 7446ab4222..256b4a4358 100644 --- a/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/support/CombinedMassSpectrumCalculator_3_Test.java +++ b/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/support/CombinedMassSpectrumCalculator_3_Test.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2018 Lablicate GmbH. + * Copyright (c) 2008, 2020 Lablicate GmbH. * * All rights reserved. * This program and the accompanying materials are made available under the @@ -11,14 +11,11 @@ *******************************************************************************/ package org.eclipse.chemclipse.msd.model.support; -import org.eclipse.chemclipse.msd.model.support.CombinedMassSpectrumCalculator; -import org.eclipse.chemclipse.msd.model.support.ICombinedMassSpectrumCalculator; - import junit.framework.TestCase; public class CombinedMassSpectrumCalculator_3_Test extends TestCase { - private ICombinedMassSpectrumCalculator combinedMassSpectrumCalculator; + private CombinedMassSpectrumCalculator combinedMassSpectrumCalculator; @Override protected void setUp() throws Exception { @@ -41,7 +38,7 @@ protected void tearDown() throws Exception { public void testValues_1() { int ion = 103; - assertEquals(5500.0, combinedMassSpectrumCalculator.getValues().get(ion)); + assertEquals(5500.0, combinedMassSpectrumCalculator.getValues().get(ion).get(0)); combinedMassSpectrumCalculator.removeIon(ion); assertEquals(null, combinedMassSpectrumCalculator.getValues().get(ion)); } @@ -49,15 +46,15 @@ public void testValues_1() { public void testValues_2() { int ion = 104; - assertEquals(5300.0, combinedMassSpectrumCalculator.getValues().get(ion)); + assertEquals(5300.0, combinedMassSpectrumCalculator.getValues().get(ion).get(0)); combinedMassSpectrumCalculator.removeIon(ion); assertEquals(null, combinedMassSpectrumCalculator.getValues().get(ion)); } public void testValues_3() { - assertEquals(5100.0, combinedMassSpectrumCalculator.getValues().get(56)); - assertEquals(5500.0, combinedMassSpectrumCalculator.getValues().get(103)); + assertEquals(5100.0, combinedMassSpectrumCalculator.getValues().get(56).get(0)); + assertEquals(5500.0, combinedMassSpectrumCalculator.getValues().get(103).get(0)); combinedMassSpectrumCalculator.removeIon(56); combinedMassSpectrumCalculator.removeIon(103); assertEquals(null, combinedMassSpectrumCalculator.getValues().get(56)); diff --git a/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/support/CombinedMassSpectrumCalculator_4_Test.java b/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/support/CombinedMassSpectrumCalculator_4_Test.java index f981437797..8b31f002c8 100644 --- a/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/support/CombinedMassSpectrumCalculator_4_Test.java +++ b/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/support/CombinedMassSpectrumCalculator_4_Test.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2019 Lablicate GmbH. + * Copyright (c) 2008, 2020 Lablicate GmbH. * * All rights reserved. * This program and the accompanying materials are made available under the @@ -19,7 +19,7 @@ public class CombinedMassSpectrumCalculator_4_Test extends TestCase { - private ICombinedMassSpectrumCalculator combinedMassSpectrumCalculator; + private CombinedMassSpectrumCalculator combinedMassSpectrumCalculator; private IMarkedIons excludedIons; @Override @@ -44,7 +44,7 @@ protected void tearDown() throws Exception { public void testValues_1() { int ion = 103; - assertEquals(5500.0, combinedMassSpectrumCalculator.getValues().get(ion)); + assertEquals(5500.0, combinedMassSpectrumCalculator.getValues().get(ion).get(0)); excludedIons.add(new MarkedIon(ion)); combinedMassSpectrumCalculator.removeIons(excludedIons); assertEquals(null, combinedMassSpectrumCalculator.getValues().get(ion)); @@ -53,7 +53,7 @@ public void testValues_1() { public void testValues_2() { int ion = 104; - assertEquals(5300.0, combinedMassSpectrumCalculator.getValues().get(ion)); + assertEquals(5300.0, combinedMassSpectrumCalculator.getValues().get(ion).get(0)); excludedIons.add(new MarkedIon(ion)); combinedMassSpectrumCalculator.removeIons(excludedIons); assertEquals(null, combinedMassSpectrumCalculator.getValues().get(ion)); @@ -61,8 +61,8 @@ public void testValues_2() { public void testValues_3() { - assertEquals(5100.0, combinedMassSpectrumCalculator.getValues().get(56)); - assertEquals(5500.0, combinedMassSpectrumCalculator.getValues().get(103)); + assertEquals(5100.0, combinedMassSpectrumCalculator.getValues().get(56).get(0)); + assertEquals(5500.0, combinedMassSpectrumCalculator.getValues().get(103).get(0)); excludedIons.add(new MarkedIon(56)); excludedIons.add(new MarkedIon(103)); combinedMassSpectrumCalculator.removeIons(excludedIons); diff --git a/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/support/CombinedMassSpectrumCalculator_5_Test.java b/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/support/CombinedMassSpectrumCalculator_5_Test.java index 4606bbf1c1..fe39fcdc6c 100644 --- a/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/support/CombinedMassSpectrumCalculator_5_Test.java +++ b/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/support/CombinedMassSpectrumCalculator_5_Test.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2018 Lablicate GmbH. + * Copyright (c) 2008, 2020 Lablicate GmbH. * * All rights reserved. * This program and the accompanying materials are made available under the @@ -11,14 +11,11 @@ *******************************************************************************/ package org.eclipse.chemclipse.msd.model.support; -import org.eclipse.chemclipse.msd.model.support.CombinedMassSpectrumCalculator; -import org.eclipse.chemclipse.msd.model.support.ICombinedMassSpectrumCalculator; - import junit.framework.TestCase; public class CombinedMassSpectrumCalculator_5_Test extends TestCase { - private ICombinedMassSpectrumCalculator combinedMassSpectrumCalculator; + private CombinedMassSpectrumCalculator combinedMassSpectrumCalculator; @Override protected void setUp() throws Exception { @@ -37,6 +34,7 @@ public void testValues_1() { combinedMassSpectrumCalculator.addIon(56.0f, 5200.0f); combinedMassSpectrumCalculator.addIon(56.0f, 6800.0f); - assertEquals(12000.0, combinedMassSpectrumCalculator.getValues().get(56)); + assertEquals(5200.0, combinedMassSpectrumCalculator.getValues().get(56).get(0)); + assertEquals(6800.0, combinedMassSpectrumCalculator.getValues().get(56).get(1)); } } diff --git a/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/support/CombinedMassSpectrumCalculator_6_Test.java b/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/support/CombinedMassSpectrumCalculator_6_Test.java index c322c4520b..533f681f60 100644 --- a/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/support/CombinedMassSpectrumCalculator_6_Test.java +++ b/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/support/CombinedMassSpectrumCalculator_6_Test.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2019 Lablicate GmbH. + * Copyright (c) 2008, 2020 Lablicate GmbH. * * All rights reserved. * This program and the accompanying materials are made available under the @@ -19,7 +19,7 @@ public class CombinedMassSpectrumCalculator_6_Test extends TestCase { - private ICombinedMassSpectrumCalculator combinedMassSpectrumCalculator; + private CombinedMassSpectrumCalculator combinedMassSpectrumCalculator; private IMarkedIons excludedIons; @Override diff --git a/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/support/CombinedMassSpectrumCalculator_7_Test.java b/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/support/CombinedMassSpectrumCalculator_7_Test.java index b8d63d99b6..f5a774fc9a 100644 --- a/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/support/CombinedMassSpectrumCalculator_7_Test.java +++ b/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/support/CombinedMassSpectrumCalculator_7_Test.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2018 Lablicate GmbH. + * Copyright (c) 2008, 2020 Lablicate GmbH. * * All rights reserved. * This program and the accompanying materials are made available under the @@ -11,14 +11,11 @@ *******************************************************************************/ package org.eclipse.chemclipse.msd.model.support; -import org.eclipse.chemclipse.msd.model.support.CombinedMassSpectrumCalculator; -import org.eclipse.chemclipse.msd.model.support.ICombinedMassSpectrumCalculator; - import junit.framework.TestCase; public class CombinedMassSpectrumCalculator_7_Test extends TestCase { - private ICombinedMassSpectrumCalculator combinedMassSpectrumCalculator; + private CombinedMassSpectrumCalculator combinedMassSpectrumCalculator; private static final float NORMALIZATION_FACTOR = 1000.0f; @Override diff --git a/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/support/CombinedMassSpectrumCalculator_8_Test.java b/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/support/CombinedMassSpectrumCalculator_8_Test.java index 4139f2a0bc..13bba450ad 100644 --- a/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/support/CombinedMassSpectrumCalculator_8_Test.java +++ b/chemclipse/tests/org.eclipse.chemclipse.msd.model.fragment.test/src/org/eclipse/chemclipse/msd/model/support/CombinedMassSpectrumCalculator_8_Test.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2018 Lablicate GmbH. + * Copyright (c) 2008, 2020 Lablicate GmbH. * * All rights reserved. * This program and the accompanying materials are made available under the @@ -11,14 +11,11 @@ *******************************************************************************/ package org.eclipse.chemclipse.msd.model.support; -import org.eclipse.chemclipse.msd.model.support.CombinedMassSpectrumCalculator; -import org.eclipse.chemclipse.msd.model.support.ICombinedMassSpectrumCalculator; - import junit.framework.TestCase; public class CombinedMassSpectrumCalculator_8_Test extends TestCase { - private ICombinedMassSpectrumCalculator combinedMassSpectrumCalculator; + private CombinedMassSpectrumCalculator combinedMassSpectrumCalculator; @Override protected void setUp() throws Exception {