]> Git trees. - libqmvoc.git/commitdiff
Qt4-ify the code, remove the soon no longer used data-stuff
authorCarsten Niehaus <cniehaus@gmx.de>
Sat, 6 May 2006 08:14:18 +0000 (08:14 +0000)
committerCarsten Niehaus <cniehaus@gmx.de>
Sat, 6 May 2006 08:14:18 +0000 (08:14 +0000)
svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=537906

libscience/spectrum.cpp
libscience/spectrum.h

index b73c8f062c4ec9f7e8cde614cf02af69b5ac9df2..eedd212b3311c95ef8ffbc8166e657f5bbb098d5 100644 (file)
 
 double Spectrum::minPeak()
 {
-       double value = ( *m_peaklist.begin() )->wavelength;
-       QList<peak*>::const_iterator it = m_peaklist.begin();
-       const QList<peak*>::const_iterator itEnd = m_peaklist.end();
-       for (;it!=itEnd;++it)
+       double value = m_peaklist.first()->wavelength;
+       
+       foreach( peak * p, m_peaklist )
        {
-               if ( value > ( *it )->wavelength )
-                       value = ( *it )->wavelength;
+               if ( value > p->wavelength )
+                       value = p->wavelength;
        }
        return value;
 }
 
 double Spectrum::maxPeak()
 {
-       double value = ( *m_peaklist.begin() )->wavelength;
-       QList<peak*>::const_iterator it = m_peaklist.begin();
-       const QList<peak*>::const_iterator itEnd = m_peaklist.end();
-       for (;it!=itEnd;++it)
+       double value = m_peaklist.first()->wavelength;
+       
+       foreach( peak * p, m_peaklist )
        {
-               if ( value < ( *it )->wavelength )
-                       value = ( *it )->wavelength;
+               if ( value < p->wavelength )
+                       value = p->wavelength;
        }
+       
        return value;
 }
 
@@ -56,15 +55,10 @@ Spectrum* Spectrum::adjustToWavelength( double min, double max )
 {
        Spectrum *spec = new Spectrum();
 
-       QList<peak*>::const_iterator it = m_peaklist.begin();
-       const QList<peak*>::const_iterator itEnd = m_peaklist.end();
-
-       for ( ; it != itEnd; ++it )
+       foreach( peak * p , m_peaklist )
        {
-               if ( ( *it )->wavelength < min || ( *it )->wavelength > max )
-                       continue;
-
-               spec->addPeak( *it );
+               if ( p->wavelength >= min || p->wavelength <= max )
+                       spec->addPeak( p );
        }
 
        spec->adjustMinMax();
@@ -105,15 +99,10 @@ QList<double> Spectrum::wavelengths( double min, double max )
 {
        QList<double> list;
        
-       QList<peak*>::const_iterator it = m_peaklist.begin();
-       const QList<peak*>::const_iterator itEnd = m_peaklist.end();
-
-       for ( ; it != itEnd; ++it )
+       foreach( peak * p , m_peaklist )
        {
-               if ( ( *it )->wavelength < min || ( *it )->wavelength > max )
-                       continue;
-
-               list.append( ( *it )->wavelength );
+               if ( p->wavelength >= min || p->wavelength <= max )
+                       list.append( p->wavelength );
        }
 
        return list;
index bc2bdfc5db5d60798ee25439a8f1254229ac2224..9edb92bd2d1e0b20532e2f135f0fa3c986ed68ff 100644 (file)
@@ -52,34 +52,14 @@ class Spectrum
                        public:
                                peak(){
                                        wavelength = -1.0;
-                                       aki = -1.0;
-                                       energy1 = -1.0;
-                                       energy2 = -1.0;
                                        intensity = -1;
                                }
 
                        ///in nm
                        double wavelength;
 
-                       ///Transition Probabilities
-                       ///10^8s-1  (1000000000 per second)
-                       double aki;
-
-                       ///number of energylevels per centimeter
-                       double energy1;
-
-                       ///number of energylevels per centimeter
-                       double energy2;
-
                        ///relative. The highest is per definition 1000
                        int intensity;
-
-                       QString electronconfig1;
-                       QString electronconfig2;
-                       QString term1;
-                       QString term2;
-                       QString J1;
-                       QString J2;
                };
 
                /**
@@ -92,8 +72,8 @@ class Spectrum
                }
 
                /**
-                * @param min the lowest allowed wavalength in nanometer
-                * @param max the highest allowed wavalength in nanometer
+                * @param min the lowest allowed wavelength in nanometer
+                * @param max the highest allowed wavelength in nanometer
                 * 
                 * @returns a spectrum with the wavelength in the range
                 * of @p min to @p max. The intensities are readjusted