From: Carsten Niehaus Date: Sun, 24 Sep 2006 16:49:15 +0000 (+0000) Subject: remove crappy API X-Git-Tag: v3.80.2~19 X-Git-Url: https://git.rmz.fi/?a=commitdiff_plain;h=67bc4be7af15de23970582c11c5e77d377c8ea83;p=libqmvoc.git remove crappy API svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=588009 --- diff --git a/libscience/spectrum.cpp b/libscience/spectrum.cpp index eedd212..d3c1b0c 100644 --- a/libscience/spectrum.cpp +++ b/libscience/spectrum.cpp @@ -61,37 +61,30 @@ Spectrum* Spectrum::adjustToWavelength( double min, double max ) spec->addPeak( p ); } - spec->adjustMinMax(); - return spec; } void Spectrum::adjustIntensities() { int maxInt = 0; - QList::Iterator it = m_peaklist.begin(); - const QList::Iterator itEnd = m_peaklist.end(); - //find the highest intensity - for ( ; it != itEnd; ++it ) + foreach ( Spectrum::peak * p, m_peaklist) { - if ( ( *it )->intensity > maxInt ) - maxInt = ( *it )->intensity; + if ( p->intensity > maxInt ) + maxInt = p->intensity; } //check if an adjustment is needed or not if ( maxInt == 1000 ) return; - double max = ( double ) maxInt; + const double max = ( double ) maxInt; //now adjust the intensities. - it = m_peaklist.begin(); - for ( ; it != itEnd; ++it ) + foreach ( Spectrum::peak * p, m_peaklist) { - double curInt = ( ( double )( *it )->intensity ); - - double newInt = max*1000/curInt; - ( *it )->intensity = ( int ) round( newInt ); + double newInt = max*1000/p->intensity; + + p->intensity = ( int ) round( newInt ); } } diff --git a/libscience/spectrum.h b/libscience/spectrum.h index a5ecc1f..cf06565 100644 --- a/libscience/spectrum.h +++ b/libscience/spectrum.h @@ -103,35 +103,12 @@ class EDUSCIENCE_EXPORT Spectrum */ QList wavelengths( double min, double max ); - /** - * @return the smallest wavelength - */ - double min() const{ - return m_min; - } - - /** - * @return the highest wavelength - */ - double max() const{ - return m_max; - } - /** * @return the list of peaks of the spectrum */ QList peaklist(){ return m_peaklist; } - - /** - * cache the values of the biggest and - * smallest wavelenght - */ - void adjustMinMax(){ - m_min = minPeak(); - m_max = maxPeak(); - } /** * @return the parent element of this spectrum @@ -140,7 +117,6 @@ class EDUSCIENCE_EXPORT Spectrum return m_parentElement; } - private: /** * @return the smallest wavelength */ @@ -151,16 +127,12 @@ class EDUSCIENCE_EXPORT Spectrum */ double maxPeak(); + private: /** * the internal dataset */ QList m_peaklist; - /** - * the cached values of the highest and lowest wavelength - */ - double m_max, m_min; - Element* m_parentElement; }; #endif // SPECTRUM_H