]> Git trees. - libqmvoc.git/commitdiff
readded spin and magnetic moment and halflife
authorJörg Buchwald <buchwaldj@web.de>
Sat, 18 Feb 2006 18:28:47 +0000 (18:28 +0000)
committerJörg Buchwald <buchwaldj@web.de>
Sat, 18 Feb 2006 18:28:47 +0000 (18:28 +0000)
svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=511056

libscience/chemicaldataobject.cpp
libscience/chemicaldataobject.h
libscience/isotope.cpp
libscience/isotope.h
libscience/isotopeparser.cpp

index 1a79d65a5075c2df506fc044b9cbca484d749eac..0a799d7271d28552ccf7c9fc7030561e66bd27a0 100644 (file)
@@ -155,6 +155,15 @@ QString ChemicalDataObject::dictRef() const
                case exactMass:
                        botype = "exactMass";
                        break;
+               case spin:
+                       botype = "spin";
+                       break;
+               case magneticMoment:
+                       botype = "magneticMoment";
+                       break;
+               case halfLife:
+                       botype = "halfLife";
+                       break;
                case ionization:
                        botype = "ionization";
                        break;
@@ -262,6 +271,10 @@ ChemicalDataObject::BlueObeliskUnit ChemicalDataObject::unit( const QString& uni
                return ChemicalDataObject::nm;
        else if ( unit == "bo:pm" )
                return ChemicalDataObject::pm;
+       else if ( unit == "bo:y" )
+               return ChemicalDataObject::y;   
+       else if ( unit == "bo:s" )
+               return ChemicalDataObject::s;   
        else if ( unit == "bo:noUnit" )
                return ChemicalDataObject::noUnit;
        else
index 09ecb7b2ab260b33143481e0874fc994e93ecd74..70b340de37d0a419ac47717db8b2a494b480bcd8 100644 (file)
@@ -69,14 +69,17 @@ class ChemicalDataObject
                        date/**< date of discovery of the element. When 0, the element has been known in ancient times. */,
                        discoverers/** The name of the discoverers, separated by semicolomns */,
                        relativeAbundance/** The abundance, relative to 100 */,
+                       spin/**< The spin */,
+                       magneticMoment/**< The magnetic dipole moment */,
+                       halfLife/**< The halflife */,
                        alphapercentage/**< The percentage of alphadecay */,
-                       alphadecay/**< The decayenergy of alphadecay in MeV */,
+                       alphaDecay/**< The decayenergy of alphadecay in MeV */,
                        betapluspercentage/**< The percentage of betaplusdecay */,
-                       betaplusdecay/**< The decayenergy of betaplusdecay in MeV */,
+                       betaplusDecay/**< The decayenergy of betaplusdecay in MeV */,
                        betaminuspercentage/**< The percentage of betaminusdecay */,
-                       betaminusdecay/**< The decayenergy of betaminusdecay in MeV */,
+                       betaminusDecay/**< The decayenergy of betaminusdecay in MeV */,
                        ecpercentage/**< The percentage of ecdecay */,
-                       ecdecay/**< The decayenergy of ecminusdecay in MeV */,
+                       ecDecay/**< The decayenergy of ecminusdecay in MeV */,
                };
 
                /**
index 9ee1de9d4f424975ce04b653e98f2f5ade2a1aa0..24b5c6237eb29c3783f8cf11205e403e9423ef9d 100644 (file)
@@ -51,6 +51,12 @@ void Isotope::addData( ChemicalDataObject* o )
                m_identifier = o;
        else if ( o->type() == ChemicalDataObject::symbol )
                m_parentElementSymbol = o;
+       else if ( o->type() == ChemicalDataObject::spin )
+               m_spin = o;
+       else if ( o->type() == ChemicalDataObject::magneticMoment )
+               m_magmoment = o;
+       else if ( o->type() == ChemicalDataObject::halfLife )
+               m_halflife = o;
 }
 
 double Isotope::mass() const
@@ -68,6 +74,21 @@ int Isotope::parentElementNumber() const
        return m_identifier->value().toInt();
 }
 
+QString Isotope::spin() const
+{
+       return m_spin->value().toString();
+}
+
+QString Isotope::magmoment() const
+{
+       return m_magmoment->value().toString();
+}
+
+double Isotope::halflife() const
+{
+       return m_halflife->value().toDouble();
+}
+
 QString Isotope::parentElementSymbol() const
 {
        return m_parentElementSymbol->value().toString();
index fe19d1e8d53b5c4e12ad82aeeda89db2f5ea2138..bb40df31630f7b968933c9eaa99cc1c52fba8215 100644 (file)
@@ -46,6 +46,12 @@ class Isotope
 
                QString parentElementSymbol() const;
 
+               QString spin() const;
+
+               QString magmoment() const;
+
+               double halflife() const;
+               
                void addData( ChemicalDataObject* o );
 
        private:
@@ -63,6 +69,22 @@ class Isotope
                 * stores the atomicNumber of the Isotope
                 */
                ChemicalDataObject* m_identifier;
+               
+               /**
+                * stores the spin of the Isotope
+                */
+               ChemicalDataObject* m_spin;
+               
+               /**
+                * stores the magneticMoment of the Isotope
+                */
+               ChemicalDataObject* m_magmoment;
+               
+               /**
+                * stores the halfLife of the Isotope
+                */
+               ChemicalDataObject* m_halflife;
+               
 };
 
 #endif // ISOTOPE_H
index cff25829c297384e95eee01db880611e8af2cac2..c7eb0863fcab7cdb3523ecf61324fcc7a9fc7172 100644 (file)
@@ -29,13 +29,16 @@ public:
        inIsotope(false),
        inAtomicNumber(false),
        inExactMass(false),
+       inSpin(false),
+       inMagMoment(false),
+       inHalfLife(false),
        inAlphaPercentage(false),
        inAlphaDecay(false),
        inBetaplusPercentage(false),
        inBetaplusDecay(false),
        inBetaminusPercentage(false),
        inBetaminusDecay(false),
-       inECPercentage(false),
+       inECPercentage(false),  
        inECDecay(false),
        inAbundance(false)
        {
@@ -52,6 +55,9 @@ public:
        bool inIsotope;
        bool inAtomicNumber;
        bool inExactMass;
+       bool inSpin;
+       bool inMagMoment;
+       bool inHalfLife;
        bool inAlphaPercentage;
        bool inAlphaDecay;
        bool inBetaplusPercentage;
@@ -86,6 +92,31 @@ bool IsotopeParser::startElement(const QString&, const QString &localName, const
                        if ( attrs.localName( i ) == "elementType" )
                                d->currentElementSymbol = attrs.value( i );
                }
+       } else if (d->inIsotope && localName == "bo:spin") {
+               kDebug() << "bo:spin" << endl;
+               d->inSpin = true;
+       } else if (d->inIsotope && localName == "bo:magneticMoment") {
+               kDebug() << "bo:magneticMoment" << endl;
+               d->inMagMoment = true;
+       } else if (d->inIsotope && localName == "bo:halfLife") {
+               kDebug() << "bo:halfLife" << endl;
+               d->inHalfLife = true;
+               if ( d->currentUnit != ChemicalDataObject::noUnit )
+                       d->currentDataObject->setUnit( d->currentUnit );
+
+               d->currentUnit = ChemicalDataObject::noUnit;
+       } else if (d->inIsotope && localName == "bo:alphaDecay"){
+               kDebug() << "bo:alphaDecay" << endl;
+               d->inAlphaDecay = true;
+       } else if (d->inIsotope && localName == "bo:betaplusDecay"){
+               kDebug() << "bo:betaplusDecay" << endl;
+               d->inBetaplusDecay = true;
+       } else if (d->inIsotope && localName == "bo:betaminusDecay"){
+               kDebug() << "bo:betaminusDecay" << endl;
+               d->inBetaminusDecay = true;
+       } else if (d->inIsotope && localName == "bo:ecDecay"){
+               kDebug() << "bo:ecDecay" << endl;
+               d->inECDecay = true;
        } else if (d->inIsotope && localName == "scalar")
        {
                for (int i = 0; i < attrs.length(); ++i) 
@@ -98,22 +129,6 @@ bool IsotopeParser::startElement(const QString&, const QString &localName, const
                        
                        if (attrs.value(i) == "bo:atomicNumber")
                                d->inAtomicNumber = true;
-                       else if (attrs.value(i) == "bo:alphapercentage")
-                               d->inAlphaPercentage = true;
-                       else if (attrs.value(i) == "bo:alphadecay")
-                               d->inAlphaDecay = true;
-                       else if (attrs.value(i) == "bo:betapluspercentage")
-                               d->inBetaplusPercentage = true;
-                       else if (attrs.value(i) == "bo:betaplusdecay")
-                               d->inBetaplusDecay = true;
-                       else if (attrs.value(i) == "bo:betaminuspercentage")
-                               d->inBetaminusPercentage = true;
-                       else if (attrs.value(i) == "bo:betaminusdecay")
-                               d->inBetaminusDecay = true;
-                       else if (attrs.value(i) == "bo:ecpercentage")
-                               d->inECPercentage = true;
-                       else if (attrs.value(i) == "bo:ecdecay")
-                               d->inECDecay = true;
                        else if (attrs.value(i) == "bo:exactMass")
                                d->inExactMass = true;
                }
@@ -161,45 +176,40 @@ bool IsotopeParser::characters(const QString &ch)
                type = ChemicalDataObject::atomicNumber; 
                d->inAtomicNumber = false;
        }
-       else if (d->inAlphaPercentage) {
-               value = ch.toDouble();
-               type = ChemicalDataObject::alphapercentage
-               d->inAtomicNumber = false;
+       else if (d->inSpin) {
+               value = ch;
+               type = ChemicalDataObject::spin
+               d->inSpin = false;
        }
-       else if (d->inAlphaDecay) {
-               value = ch.toDouble();
-               type = ChemicalDataObject::alphadecay
-               d->inAtomicNumber = false;
+       else if (d->inMagMoment) {
+               value = ch;
+               type = ChemicalDataObject::magneticMoment
+               d->inMagMoment = false;
        }
-       else if (d->inBetaplusPercentage) {
+       else if (d->inHalfLife) {
                value = ch.toDouble();
-               type = ChemicalDataObject::betapluspercentage; 
-               d->inAtomicNumber = false;
+               type = ChemicalDataObject::halfLife; 
+               d->inHalfLife = false;
        }
-       else if (d->inBetaplusDecay) {
+       else if (d->inAlphaDecay) {
                value = ch.toDouble();
-               type = ChemicalDataObject::betaplusdecay; 
-               d->inAtomicNumber = false;
+               type = ChemicalDataObject::alphaDecay; 
+               d->inAlphaDecay = false;
        }
-       else if (d->inBetaminusPercentage) {
+       else if (d->inBetaplusDecay) {
                value = ch.toDouble();
-               type = ChemicalDataObject::betaminuspercentage
-               d->inAtomicNumber = false;
+               type = ChemicalDataObject::betaplusDecay
+               d->inBetaplusDecay = false;
        }
        else if (d->inBetaminusDecay) {
                value = ch.toDouble();
-               type = ChemicalDataObject::betaminusdecay; 
-               d->inAtomicNumber = false;
-       }
-       else if (d->inECPercentage) {
-               value = ch.toDouble();
-               type = ChemicalDataObject::ecpercentage; 
-               d->inAtomicNumber = false;
+               type = ChemicalDataObject::betaminusDecay; 
+               d->inBetaminusDecay = false;
        }
        else if (d->inECDecay) {
                value = ch.toDouble();
-               type = ChemicalDataObject::ecdecay; 
-               d->inAtomicNumber = false;
+               type = ChemicalDataObject::ecDecay; 
+               d->inECDecay = false;
        }
        else if (d->inAbundance){
                value = ch;