Skip to content

Commit

Permalink
Remove generics.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mailaender committed Jan 13, 2025
1 parent 2e7de8a commit 2d7923f
Show file tree
Hide file tree
Showing 21 changed files with 84 additions and 108 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2014, 2024 Lablicate GmbH.
* Copyright (c) 2014, 2025 Lablicate GmbH.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
Expand Down Expand Up @@ -37,8 +37,6 @@
import org.eclipse.chemclipse.csd.model.core.selection.IChromatogramSelectionCSD;
import org.eclipse.chemclipse.csd.model.core.support.PeakBuilderCSD;
import org.eclipse.chemclipse.logging.core.Logger;
import org.eclipse.chemclipse.model.core.IChromatogram;
import org.eclipse.chemclipse.model.core.IPeak;
import org.eclipse.chemclipse.model.core.IScan;
import org.eclipse.chemclipse.model.core.PeakType;
import org.eclipse.chemclipse.model.exceptions.PeakException;
Expand All @@ -60,17 +58,17 @@
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.e4.core.services.translation.TranslationService;

public class PeakDetectorCSD<P extends IPeak, C extends IChromatogram<P>, R> extends BasePeakDetector<P, C, R> implements IPeakDetectorCSD<P, C, R> {
public class PeakDetectorCSD extends BasePeakDetector implements IPeakDetectorCSD {

private static final Logger logger = Logger.getLogger(PeakDetectorCSD.class);

@Override
public IProcessingInfo<R> detect(IChromatogramSelectionCSD chromatogramSelection, IPeakDetectorSettingsCSD detectorSettings, IProgressMonitor monitor) {
public IProcessingInfo<?> detect(IChromatogramSelectionCSD chromatogramSelection, IPeakDetectorSettingsCSD detectorSettings, IProgressMonitor monitor) {

/*
* Check whether the chromatogram selection is null or not.
*/
IProcessingInfo<R> processingInfo = validate(chromatogramSelection, detectorSettings, monitor);
IProcessingInfo<?> processingInfo = validate(chromatogramSelection, detectorSettings, monitor);
if(!processingInfo.hasErrorMessages()) {
if(detectorSettings instanceof PeakDetectorSettingsCSD peakDetectorSettings) {
SubMonitor subMonitor = SubMonitor.convert(monitor, 100);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2014, 2021 Lablicate GmbH.
* Copyright (c) 2014, 2025 Lablicate GmbH.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
Expand All @@ -12,8 +12,6 @@
package org.eclipse.chemclipse.chromatogram.csd.peak.detector.core;

import org.eclipse.chemclipse.chromatogram.peak.detector.core.AbstractPeakDetector;
import org.eclipse.chemclipse.model.core.IChromatogram;
import org.eclipse.chemclipse.model.core.IPeak;

public abstract class AbstractPeakDetectorCSD<P extends IPeak, C extends IChromatogram<P>, R> extends AbstractPeakDetector<P, C, R> implements IPeakDetectorCSD<P, C, R> {
public abstract class AbstractPeakDetectorCSD extends AbstractPeakDetector implements IPeakDetectorCSD {
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@
import org.eclipse.chemclipse.chromatogram.peak.detector.core.IPeakDetector;
import org.eclipse.chemclipse.chromatogram.peak.detector.exceptions.ValueMustNotBeNullException;
import org.eclipse.chemclipse.csd.model.core.selection.IChromatogramSelectionCSD;
import org.eclipse.chemclipse.model.core.IChromatogram;
import org.eclipse.chemclipse.model.core.IPeak;
import org.eclipse.chemclipse.processing.core.IProcessingInfo;
import org.eclipse.core.runtime.IProgressMonitor;

public interface IPeakDetectorCSD<P extends IPeak, C extends IChromatogram<P>, R> extends IPeakDetector<P, C, R> {
public interface IPeakDetectorCSD extends IPeakDetector {

/**
* All peak detector plugins must implement this class.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2014, 2024 Lablicate GmbH.
* Copyright (c) 2014, 2025 Lablicate GmbH.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
Expand Down Expand Up @@ -58,7 +58,7 @@ private PeakDetectorCSD() {
public static IProcessingInfo<?> detect(IChromatogramSelectionCSD chromatogramSelection, IPeakDetectorSettingsCSD peakDetectorSettings, String peakDetectorId, IProgressMonitor monitor) {

IProcessingInfo<?> processingInfo;
IPeakDetectorCSD<?, ?, ?> peakDetector = getPeakDetector(peakDetectorId);
IPeakDetectorCSD peakDetector = getPeakDetector(peakDetectorId);
if(peakDetector != null) {
processingInfo = peakDetector.detect(chromatogramSelection, peakDetectorSettings, monitor);
chromatogramSelection.getChromatogram().setDirty(true);
Expand All @@ -80,7 +80,7 @@ public static IProcessingInfo<?> detect(IChromatogramSelectionCSD chromatogramSe
public static IProcessingInfo<?> detect(IChromatogramSelectionCSD chromatogramSelection, String peakDetectorId, IProgressMonitor monitor) {

IProcessingInfo<?> processingInfo;
IPeakDetectorCSD<?, ?, ?> peakDetector = getPeakDetector(peakDetectorId);
IPeakDetectorCSD peakDetector = getPeakDetector(peakDetectorId);
if(peakDetector != null) {
processingInfo = peakDetector.detect(chromatogramSelection, monitor);
chromatogramSelection.getChromatogram().setDirty(true);
Expand Down Expand Up @@ -121,14 +121,14 @@ public static IPeakDetectorCSDSupport getPeakDetectorSupport() {
return peakDetectorSupport;
}

private static IPeakDetectorCSD<?, ?, ?> getPeakDetector(final String peakDetectorId) {
private static IPeakDetectorCSD getPeakDetector(final String peakDetectorId) {

IConfigurationElement element;
element = getConfigurationElement(peakDetectorId);
IPeakDetectorCSD<?, ?, ?> instance = null;
IPeakDetectorCSD instance = null;
if(element != null) {
try {
instance = (IPeakDetectorCSD<?, ?, ?>)element.createExecutableExtension(PEAK_DETECTOR);
instance = (IPeakDetectorCSD)element.createExecutableExtension(PEAK_DETECTOR);
} catch(CoreException e) {
logger.warn(e);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2024 Lablicate GmbH.
* Copyright (c) 2008, 2025 Lablicate GmbH.
*
* All rights reserved.
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -38,8 +38,6 @@
import org.eclipse.chemclipse.chromatogram.xxd.peak.detector.supplier.firstderivative.support.IFirstDerivativeDetectorSlope;
import org.eclipse.chemclipse.chromatogram.xxd.peak.detector.supplier.firstderivative.support.IFirstDerivativeDetectorSlopes;
import org.eclipse.chemclipse.logging.core.Logger;
import org.eclipse.chemclipse.model.core.IChromatogram;
import org.eclipse.chemclipse.model.core.IPeak;
import org.eclipse.chemclipse.model.core.IScan;
import org.eclipse.chemclipse.model.core.MarkedTraceModus;
import org.eclipse.chemclipse.model.core.PeakType;
Expand Down Expand Up @@ -70,14 +68,14 @@
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.e4.core.services.translation.TranslationService;

public class PeakDetectorMSD<P extends IPeak, C extends IChromatogram<P>, R> extends BasePeakDetector<P, C, R> implements IPeakDetectorMSD<P, C, R> {
public class PeakDetectorMSD extends BasePeakDetector implements IPeakDetectorMSD {

private static final Logger logger = Logger.getLogger(PeakDetectorMSD.class);

@Override
public IProcessingInfo<R> detect(IChromatogramSelectionMSD chromatogramSelection, IPeakDetectorSettingsMSD detectorSettings, IProgressMonitor monitor) {
public IProcessingInfo<?> detect(IChromatogramSelectionMSD chromatogramSelection, IPeakDetectorSettingsMSD detectorSettings, IProgressMonitor monitor) {

IProcessingInfo<R> processingInfo = validate(chromatogramSelection, detectorSettings, monitor);
IProcessingInfo<?> processingInfo = validate(chromatogramSelection, detectorSettings, monitor);
if(!processingInfo.hasErrorMessages()) {
if(detectorSettings instanceof PeakDetectorSettingsMSD peakDetectorSettings) {
SubMonitor subMonitor = SubMonitor.convert(monitor, 100);
Expand Down Expand Up @@ -115,7 +113,7 @@ public IPeakDetectorSettingsMSD getPeakDetectorSettings() {
}

@Override
public IProcessingInfo<R> detect(IChromatogramSelectionMSD chromatogramSelection, IProgressMonitor monitor) {
public IProcessingInfo<?> detect(IChromatogramSelectionMSD chromatogramSelection, IProgressMonitor monitor) {

if(peakDetectorSettings == null) {
peakDetectorSettings = PreferenceSupplier.getPeakDetectorSettingsMSD();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2021 Lablicate GmbH.
* Copyright (c) 2008, 2025 Lablicate GmbH.
*
* All rights reserved.
* This program and the accompanying materials are made available under the
Expand All @@ -12,11 +12,9 @@
package org.eclipse.chemclipse.chromatogram.msd.peak.detector.core;

import org.eclipse.chemclipse.chromatogram.peak.detector.core.AbstractPeakDetector;
import org.eclipse.chemclipse.model.core.IChromatogram;
import org.eclipse.chemclipse.model.core.IPeak;

/**
* Extend this class to implement a valid peak detector.r
*/
public abstract class AbstractPeakDetectorMSD<P extends IPeak, C extends IChromatogram<P>, R> extends AbstractPeakDetector<P, C, R> implements IPeakDetectorMSD<P, C, R> {
public abstract class AbstractPeakDetectorMSD extends AbstractPeakDetector implements IPeakDetectorMSD {
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2021 Lablicate GmbH.
* Copyright (c) 2008, 2025 Lablicate GmbH.
*
* All rights reserved.
* This program and the accompanying materials are made available under the
Expand All @@ -14,13 +14,11 @@
import org.eclipse.chemclipse.chromatogram.msd.peak.detector.settings.IPeakDetectorSettingsMSD;
import org.eclipse.chemclipse.chromatogram.peak.detector.core.IPeakDetector;
import org.eclipse.chemclipse.chromatogram.peak.detector.exceptions.ValueMustNotBeNullException;
import org.eclipse.chemclipse.model.core.IChromatogram;
import org.eclipse.chemclipse.model.core.IPeak;
import org.eclipse.chemclipse.msd.model.core.selection.IChromatogramSelectionMSD;
import org.eclipse.chemclipse.processing.core.IProcessingInfo;
import org.eclipse.core.runtime.IProgressMonitor;

public interface IPeakDetectorMSD<P extends IPeak, C extends IChromatogram<P>, R> extends IPeakDetector<P, C, R> {
public interface IPeakDetectorMSD extends IPeakDetector {

/**
* All peak detector plugins must implement this class.
Expand All @@ -30,7 +28,7 @@ public interface IPeakDetectorMSD<P extends IPeak, C extends IChromatogram<P>, R
* @param monitor
* @throws ValueMustNotBeNullException
*/
IProcessingInfo<R> detect(IChromatogramSelectionMSD chromatogramSelection, IPeakDetectorSettingsMSD peakDetectorSettings, IProgressMonitor monitor);
IProcessingInfo<?> detect(IChromatogramSelectionMSD chromatogramSelection, IPeakDetectorSettingsMSD peakDetectorSettings, IProgressMonitor monitor);

/**
* The same as the other method but without settings.
Expand All @@ -39,5 +37,5 @@ public interface IPeakDetectorMSD<P extends IPeak, C extends IChromatogram<P>, R
* @param monitor
* @throws ValueMustNotBeNullException
*/
IProcessingInfo<R> detect(IChromatogramSelectionMSD chromatogramSelection, IProgressMonitor monitor);
IProcessingInfo<?> detect(IChromatogramSelectionMSD chromatogramSelection, IProgressMonitor monitor);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2024 Lablicate GmbH.
* Copyright (c) 2008, 2025 Lablicate GmbH.
*
* All rights reserved.
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -75,7 +75,7 @@ private PeakDetectorMSD() {
public static IProcessingInfo<?> detect(IChromatogramSelectionMSD chromatogramSelection, IPeakDetectorSettingsMSD peakDetectorSettings, String peakDetectorId, IProgressMonitor monitor) {

IProcessingInfo<?> processingInfo;
IPeakDetectorMSD<?, ?, ?> peakDetector = getPeakDetector(peakDetectorId);
IPeakDetectorMSD peakDetector = getPeakDetector(peakDetectorId);
if(peakDetector != null) {
processingInfo = peakDetector.detect(chromatogramSelection, peakDetectorSettings, monitor);
chromatogramSelection.getChromatogram().setDirty(true);
Expand All @@ -100,7 +100,7 @@ public static IProcessingInfo<?> detect(IChromatogramSelectionMSD chromatogramSe
return detect(chromatogramSelection, getPeakDetector(peakDetectorId), monitor);
}

public static IProcessingInfo<?> detect(IChromatogramSelectionMSD chromatogramSelection, IPeakDetectorMSD<?, ?, ?> peakDetector, IProgressMonitor monitor) {
public static IProcessingInfo<?> detect(IChromatogramSelectionMSD chromatogramSelection, IPeakDetectorMSD peakDetector, IProgressMonitor monitor) {

IProcessingInfo<?> processingInfo;
if(peakDetector != null) {
Expand Down Expand Up @@ -143,14 +143,14 @@ public static IPeakDetectorMSDSupport getPeakDetectorSupport() {
return peakDetectorSupport;
}

private static IPeakDetectorMSD<?, ?, ?> getPeakDetector(final String peakDetectorId) {
private static IPeakDetectorMSD getPeakDetector(final String peakDetectorId) {

IConfigurationElement element;
element = getConfigurationElement(peakDetectorId);
IPeakDetectorMSD<?, ?, ?> instance = null;
IPeakDetectorMSD instance = null;
if(element != null) {
try {
instance = (IPeakDetectorMSD<?, ?, ?>)element.createExecutableExtension(PEAK_DETECTOR);
instance = (IPeakDetectorMSD)element.createExecutableExtension(PEAK_DETECTOR);
} catch(CoreException e) {
logger.error(e);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2014, 2021 Lablicate GmbH.
* Copyright (c) 2014, 2025 Lablicate GmbH.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
Expand All @@ -8,24 +8,21 @@
*
* Contributors:
* Dr. Philip Wenig - initial API and implementation
* Alexander Kerner - Generics
*******************************************************************************/
package org.eclipse.chemclipse.chromatogram.peak.detector.core;

import org.eclipse.chemclipse.chromatogram.peak.detector.settings.IPeakDetectorSettings;
import org.eclipse.chemclipse.model.core.IChromatogram;
import org.eclipse.chemclipse.model.core.IPeak;
import org.eclipse.chemclipse.model.selection.IChromatogramSelection;
import org.eclipse.chemclipse.processing.core.IProcessingInfo;
import org.eclipse.chemclipse.processing.core.ProcessingInfo;
import org.eclipse.core.runtime.IProgressMonitor;

public abstract class AbstractPeakDetector<P extends IPeak, C extends IChromatogram<P>, R> implements IPeakDetector<P, C, R> {
public abstract class AbstractPeakDetector implements IPeakDetector {

@Override
public IProcessingInfo<R> validate(IChromatogramSelection<?, ?> chromatogramSelection, IPeakDetectorSettings peakDetectorSettings, IProgressMonitor monitor) {
public IProcessingInfo<?> validate(IChromatogramSelection<?, ?> chromatogramSelection, IPeakDetectorSettings peakDetectorSettings, IProgressMonitor monitor) {

IProcessingInfo<R> processingInfo = new ProcessingInfo<>();
IProcessingInfo<?> processingInfo = new ProcessingInfo<>();
if(chromatogramSelection == null) {
processingInfo.addErrorMessage("Peak Detector", "The chromatogram selection must not be null.");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2014, 2021 Lablicate GmbH.
* Copyright (c) 2014, 2025 Lablicate GmbH.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
Expand All @@ -8,18 +8,15 @@
*
* Contributors:
* Dr. Philip Wenig - initial API and implementation
* Alexander Kerner - Generics
*******************************************************************************/
package org.eclipse.chemclipse.chromatogram.peak.detector.core;

import org.eclipse.chemclipse.chromatogram.peak.detector.settings.IPeakDetectorSettings;
import org.eclipse.chemclipse.model.core.IChromatogram;
import org.eclipse.chemclipse.model.core.IPeak;
import org.eclipse.chemclipse.model.selection.IChromatogramSelection;
import org.eclipse.chemclipse.processing.core.IProcessingInfo;
import org.eclipse.core.runtime.IProgressMonitor;

public interface IPeakDetector<P extends IPeak, C extends IChromatogram<P>, R> {
public interface IPeakDetector {

IProcessingInfo<R> validate(IChromatogramSelection<?, ?> chromatogramSelection, IPeakDetectorSettings peakDetectorSettings, IProgressMonitor monitor);
IProcessingInfo<?> validate(IChromatogramSelection<?, ?> chromatogramSelection, IPeakDetectorSettings peakDetectorSettings, IProgressMonitor monitor);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2018, 2024 Lablicate GmbH.
* Copyright (c) 2018, 2025 Lablicate GmbH.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
Expand Down Expand Up @@ -36,8 +36,6 @@
import org.eclipse.chemclipse.chromatogram.xxd.peak.detector.supplier.firstderivative.support.IFirstDerivativeDetectorSlope;
import org.eclipse.chemclipse.chromatogram.xxd.peak.detector.supplier.firstderivative.support.IFirstDerivativeDetectorSlopes;
import org.eclipse.chemclipse.logging.core.Logger;
import org.eclipse.chemclipse.model.core.IChromatogram;
import org.eclipse.chemclipse.model.core.IPeak;
import org.eclipse.chemclipse.model.core.IScan;
import org.eclipse.chemclipse.model.exceptions.ChromatogramIsNullException;
import org.eclipse.chemclipse.model.exceptions.PeakException;
Expand Down Expand Up @@ -67,19 +65,19 @@
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.e4.core.services.translation.TranslationService;

public class PeakDetectorWSD<P extends IPeak, C extends IChromatogram<P>, R> extends BasePeakDetector<P, C, R> implements IPeakDetectorWSD<P, C, R> {
public class PeakDetectorWSD extends BasePeakDetector implements IPeakDetectorWSD {

private static final Logger logger = Logger.getLogger(PeakDetectorWSD.class);
//
private static final float NORMALIZATION_BASE = 100000.0f;

@Override
public IProcessingInfo<R> detect(IChromatogramSelectionWSD chromatogramSelection, IPeakDetectorSettingsWSD detectorSettings, IProgressMonitor monitor) {
public IProcessingInfo<?> detect(IChromatogramSelectionWSD chromatogramSelection, IPeakDetectorSettingsWSD detectorSettings, IProgressMonitor monitor) {

/*
* Check whether the chromatogram selection is null or not.
*/
IProcessingInfo<R> processingInfo = validate(chromatogramSelection, detectorSettings, monitor);
IProcessingInfo<?> processingInfo = validate(chromatogramSelection, detectorSettings, monitor);
if(!processingInfo.hasErrorMessages()) {
if(detectorSettings instanceof PeakDetectorSettingsWSD peakDetectorSettings) {
SubMonitor subMonitor = SubMonitor.convert(monitor, 100);
Expand Down Expand Up @@ -107,7 +105,7 @@ public IProcessingInfo<R> detect(IChromatogramSelectionWSD chromatogramSelection
}

@Override
public IProcessingInfo<R> detect(IChromatogramSelectionWSD chromatogramSelection, IProgressMonitor monitor) {
public IProcessingInfo<?> detect(IChromatogramSelectionWSD chromatogramSelection, IProgressMonitor monitor) {

PeakDetectorSettingsWSD peakDetectorSettings = PreferenceSupplier.getPeakDetectorSettingsWSD();
chromatogramSelection.getChromatogram().setDirty(true);
Expand Down
Loading

0 comments on commit 2d7923f

Please sign in to comment.