From 868329be6f13628779adb13b06c433147a56e01f Mon Sep 17 00:00:00 2001 From: Carsten Niehaus Date: Sun, 17 Jul 2005 13:36:23 +0000 Subject: [PATCH] * Add some API-docs * change some QString to bool svn path=/trunk/KDE/kdeedu/kalzium/src/element.cpp; revision=435569 --- kalzium/src/element.cpp | 11 ++++++++-- kalzium/src/element.h | 46 +++++++++++++++++++---------------------- 2 files changed, 30 insertions(+), 27 deletions(-) diff --git a/kalzium/src/element.cpp b/kalzium/src/element.cpp index 5f6bb6f..bc41ca5 100644 --- a/kalzium/src/element.cpp +++ b/kalzium/src/element.cpp @@ -612,7 +612,14 @@ EList KalziumDataObject::readData( QDomDocument &dataDocument ) QString spin = iso.attributeNode( "spin" ).value(); double magmoment = iso.attributeNode( "magmoment" ).value().toDouble(); - Isotope *isotope = new Isotope( neutrons, percentage, weight, halflife, format, alphadecay, betaplusdecay, betaminusdecay, ecdecay, decayenergy, spin, magmoment ); + bool alphadecay_ = false, betaminusdecay_ = false, betaplusdecay_ = false, ecdecay_ = false; + if ( betaplusdecay == "true" ) betaplusdecay_ = true; + if ( betaminusdecay == "true" ) betaminusdecay_ = true; + if ( ecdecay == "true" ) ecdecay_ = true; + if ( alphadecay == "true" ) alphadecay_ = true; + + + Isotope *isotope = new Isotope( neutrons, percentage, weight, halflife, format, alphadecay_, betaplusdecay_, betaminusdecay_, ecdecay_, decayenergy, spin, magmoment ); isolist.append( isotope ); } @@ -676,7 +683,7 @@ const int KalziumDataObject::numberOfElements() const return m_numOfElements; } -Isotope::Isotope( int neutrons, double percentage, double weight, double halflife, QString format, QString alphadecay, QString betaplusdecay, QString betaminusdecay, QString ecdecay, double decayenergy, QString spin, double magmoment ) +Isotope::Isotope( int neutrons, double percentage, double weight, double halflife, QString format, bool alphadecay, bool betaplusdecay, bool betaminusdecay, bool ecdecay, double decayenergy, QString spin, double magmoment ) { m_neutrons = neutrons; m_percentage = percentage; diff --git a/kalzium/src/element.h b/kalzium/src/element.h index c843faa..7d919ce 100644 --- a/kalzium/src/element.h +++ b/kalzium/src/element.h @@ -45,7 +45,7 @@ typedef QValueList doubleList; class Isotope { public: - Isotope( int neutrons, double percentage, double weight, double halflife, QString format, QString alphadecay, QString betaplusdecay, QString betaminusdecay, QString ecdecay, double decayenergy, QString spin, double magmoment); + Isotope( int neutrons, double percentage, double weight, double halflife, QString format, bool alphadecay, bool betaplusdecay, bool betaminusdecay, bool ecdecay, double decayenergy, QString spin, double magmoment); bool seconds() const{ if ( m_format == "seconds" ) @@ -54,6 +54,10 @@ class Isotope return false; } + /** + * @return the halflife period of the isotope it if has one. The format + * is defined by seconds() + */ double halflife() const{ return m_halflife; } @@ -62,6 +66,9 @@ class Isotope return m_percentage; } + /** + * @return the number of neutrons the isotope has + */ int neutrons() const{ return m_neutrons; } @@ -71,31 +78,19 @@ class Isotope } bool alphadecay() const{ - if ( m_alphadecay == "true" ) - return true; - else - return false; + return m_alphadecay; } bool betaplusdecay() const{ - if ( m_betaplusdecay == "true" ) - return true; - else - return false; + return m_betaplusdecay; } bool betaminusdecay() const{ - if ( m_betaminusdecay == "true" ) - return true; - else - return false; + return m_betaminusdecay; } bool ecdecay() const{ - if ( m_ecdecay == "true" ) - return true; - else - return false; + return m_ecdecay; } double decayenergy() const{ @@ -142,14 +137,15 @@ class Isotope */ int m_neutrons; - /** - * Theese variables specify the kind of decay - * and the decay-energy - */ - QString m_alphadecay; - QString m_betaplusdecay; - QString m_betaminusdecay; - QString m_ecdecay; + ///Specify if the decay is of this kind + bool m_alphadecay; + ///Specify if the decay is of this kind + bool m_betaplusdecay; + ///Specify if the decay is of this kind + bool m_betaminusdecay; + ///Specify if the decay is of this kind + bool m_ecdecay; + double m_decayenergy; /** -- 2.47.3