Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove generics from selected peaks #2076

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
bin/
target/
workspace/
# files generated (temporary) by the tycho maven builds

# Tycho
.polyglot.*
.META-INF_MANIFEST.MF
feature.xml.takari_issue_192
*.tycho
.tycho-consumer-pom.xml

# Tests
/chemclipse/tests/org.eclipse.chemclipse.rcp.app.fragment.test/*.pdf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2012, 2023 Lablicate GmbH.
* Copyright (c) 2012, 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 @@ -18,6 +18,7 @@

import org.eclipse.chemclipse.model.core.IChromatogram;
import org.eclipse.chemclipse.model.core.IChromatogramPeak;
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.numeric.core.Point;
Expand All @@ -30,7 +31,7 @@ public abstract class AbstractChromatogramSelection<T extends IChromatogramPeak,
private float startAbundance;
private float stopAbundance;
//
private List<T> selectedPeaks = new ArrayList<>();
private List<IPeak> selectedPeaks = new ArrayList<>();
private List<IScan> selectedIdentifiedScans = new ArrayList<>();
/*
* UI fields
Expand All @@ -39,7 +40,7 @@ public abstract class AbstractChromatogramSelection<T extends IChromatogramPeak,
private boolean lockOffset;
private Point offset;

public AbstractChromatogramSelection(C chromatogram) throws ChromatogramIsNullException {
protected AbstractChromatogramSelection(C chromatogram) throws ChromatogramIsNullException {

/*
* Check
Expand Down Expand Up @@ -240,7 +241,7 @@ public void update(boolean forceReload) {
}

@Override
public T getSelectedPeak() {
public IPeak getSelectedPeak() {

if(!selectedPeaks.isEmpty()) {
return validatePeak(selectedPeaks.get(0));
Expand All @@ -250,7 +251,7 @@ public T getSelectedPeak() {
}

@Override
public List<T> getSelectedPeaks() {
public List<IPeak> getSelectedPeaks() {

if(chromatogram.getNumberOfPeaks() == 0) {
selectedPeaks.clear();
Expand All @@ -260,7 +261,7 @@ public List<T> getSelectedPeaks() {
}

@Override
public void setSelectedPeak(T selectedPeak) {
public void setSelectedPeak(IPeak selectedPeak) {

selectedPeaks.clear();
if(selectedPeak != null) {
Expand All @@ -269,7 +270,7 @@ public void setSelectedPeak(T selectedPeak) {
}

@Override
public void setSelectedPeaks(List<T> selectedPeaks) {
public void setSelectedPeaks(List<IPeak> selectedPeaks) {

this.selectedPeaks.clear();
this.selectedPeaks.addAll(selectedPeaks);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2013, 2023 Lablicate GmbH.
* Copyright (c) 2013, 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 @@ -15,6 +15,7 @@
import org.eclipse.chemclipse.logging.core.Logger;
import org.eclipse.chemclipse.model.core.IChromatogram;
import org.eclipse.chemclipse.model.core.IChromatogramPeak;
import org.eclipse.chemclipse.model.core.IPeak;
import org.eclipse.chemclipse.model.core.IScan;
import org.eclipse.chemclipse.model.exceptions.ChromatogramIsNullException;

Expand Down Expand Up @@ -85,7 +86,7 @@ public T getSelectedPeak() {
}

@Override
public void setSelectedPeak(T selectedPeak) {
public void setSelectedPeak(IPeak selectedPeak) {

logger.warn("Bad boy - setSelectedPeak(IPeak selectedPeak): don't use the ChromatogramSelection implementation");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2012, 2021 Lablicate GmbH.
* Copyright (c) 2012, 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 @@ -167,13 +167,13 @@ public interface IChromatogramSelection<P extends IPeak, C extends IChromatogram
*
* @return IPeak
*/
P getSelectedPeak();
IPeak getSelectedPeak();

List<P> getSelectedPeaks();
List<IPeak> getSelectedPeaks();

void setSelectedPeak(P selectedPeak);
void setSelectedPeak(IPeak selectedPeak);

void setSelectedPeaks(List<P> selectedPeaks);
void setSelectedPeaks(List<IPeak> selectedPeaks);

IScan getSelectedIdentifiedScan();

Expand Down Expand Up @@ -234,7 +234,7 @@ default int getStopScan() {
* @param peak
* @return P
*/
default P validatePeak(P peak) {
default IPeak validatePeak(IPeak peak) {

if(peak != null) {
if(peak.isMarkedAsDeleted()) {
Expand All @@ -243,7 +243,7 @@ default P validatePeak(P peak) {
return null;
}
}
//

return peak;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private void createListUI(Composite parent) {
//
peakQuantitationListUI.getTable().addSelectionListener(new SelectionAdapter() {

@SuppressWarnings({"rawtypes", "unchecked"})
@SuppressWarnings({"rawtypes"})
@Override
public void widgetSelected(SelectionEvent e) {

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 Down Expand Up @@ -42,7 +42,7 @@ protected void setUp() throws Exception {
peak = EasyMock.createNiceMock(IChromatogramPeakMSD.class);
EasyMock.expect(peak.getIntegratedArea()).andStubReturn(893002.3d);
EasyMock.replay(peak);
List<IChromatogramPeakMSD> peaks = new ArrayList<IChromatogramPeakMSD>();
List<IChromatogramPeakMSD> peaks = new ArrayList<>();
peaks.add(peak);
/*
* When the chromatogram selection will initialized, the first peak will
Expand All @@ -67,7 +67,7 @@ protected void tearDown() throws Exception {

public void testGetSelectedPeak_1() {

IChromatogramPeakMSD selectedPeak = selection.getSelectedPeak();
IChromatogramPeakMSD selectedPeak = (IChromatogramPeakMSD)selection.getSelectedPeak();
assertNotNull(selectedPeak);
assertEquals("IntegratedArea", 893002.3d, selectedPeak.getIntegratedArea());
}
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 @@ -86,7 +86,7 @@ public void testSetSelectedPeak_1() {
public void testSetSelectedPeak_2() {

selection.setSelectedPeak(peak);
peak = selection.getSelectedPeak();
peak = (IChromatogramPeakMSD)selection.getSelectedPeak();
assertNotNull(peak);
assertEquals("IntegratedArea", 893002.3d, peak.getIntegratedArea());
}
Expand Down
Loading