author | zecke <zecke> | 2004-09-10 11:11:23 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-09-10 11:11:23 (UTC) |
commit | 532d65f8a45850bfda3c3344a7b165af91e48440 (patch) (side-by-side diff) | |
tree | cbda2467001ed9a5be304fa52cabbb797b56ecfe /noncore/apps/oxygen/kmolelements.cpp | |
parent | e64d9e9682e0afefc4fbebe7ba9737e0f86e3ed7 (diff) | |
download | opie-532d65f8a45850bfda3c3344a7b165af91e48440.zip opie-532d65f8a45850bfda3c3344a7b165af91e48440.tar.gz opie-532d65f8a45850bfda3c3344a7b165af91e48440.tar.bz2 |
Add newlines, remove unused local variables, remove unused parameters,
add newlines at the end of file...
Diffstat (limited to 'noncore/apps/oxygen/kmolelements.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/oxygen/kmolelements.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/noncore/apps/oxygen/kmolelements.cpp b/noncore/apps/oxygen/kmolelements.cpp index ce8f9c1..e76461b 100644 --- a/noncore/apps/oxygen/kmolelements.cpp +++ b/noncore/apps/oxygen/kmolelements.cpp @@ -9,8 +9,8 @@ #include <stdio.h> -#include "kmolelements.h" +#include "kmolelements.h" /** - * A generic chemical entity. Can be an element or a group. + * A generic chemical entity. Can be an element or a group. */ SubUnit::SubUnit () {} @@ -19,5 +19,5 @@ SubUnit::~SubUnit () {} /** - * Construct a subunit and return a pointer to it. The syntax of LINE is + * Construct a subunit and return a pointer to it. The syntax of LINE is * the one used in the element definition file. */ @@ -29,5 +29,5 @@ SubUnit* SubUnit::makeSubUnit(QString line) { str >> weight >> ws; return new Element(name, weight.toDouble()); - } + } else { str >> grpname; @@ -49,10 +49,10 @@ QString SubUnit::getName() const { * Get the molecular weight of THIS, based on the data from ELSTABLE. */ -double SubUnit::getWeight(QDict<SubUnit>* elstable) const { +double SubUnit::getWeight(QDict<SubUnit>* ) const { return -1; } /** - * A group of elements. + * A group of elements. */ ElementList::ElementList () { @@ -66,5 +66,5 @@ ElementList::~ElementList () { /** - * A group of elements. + * A group of elements. */ ElementList::ElementList (QString name) { @@ -81,5 +81,5 @@ void ElementList::writeOut(QString& line) { ElementCoef* current = elements->first(); while (current != 0) { - line += " " + current->name + " " + coef.setNum(current->coef, 'g', 10); + line += " " + current->name + " " + coef.setNum(current->coef, 'g', 10); // precision set to 10 digits current = elements->next(); @@ -104,5 +104,5 @@ double ElementList::getWeight(QDict<SubUnit>* elstable) const { /** - * Return a string representing the elemental composition of THIS, as + * Return a string representing the elemental composition of THIS, as * a tab-separated element - percentage pairs, separated by newlines. */ @@ -115,8 +115,8 @@ QString ElementList::getEA(QDict<SubUnit>* elstable, double mw) const { SubUnit* e = elstable->find(current->name); if (e != 0) { - double current_percent = 100 * (current->coef) * - (e->getWeight(elstable)) + double current_percent = 100 * (current->coef) * + (e->getWeight(elstable)) / mw; - ea += current->name + "\t" + + ea += current->name + "\t" + temp.setNum(current_percent) + "\n"; } else return QString("ERROR!\n"); //ERROR @@ -125,5 +125,5 @@ QString ElementList::getEA(QDict<SubUnit>* elstable, double mw) const { return ea; } - + /** * Return a string representing THIS as an empirical chemical formula. @@ -163,5 +163,5 @@ void ElementList::addTo(ElementList& els, double coef) { /** - * Add an element to THIS, with a coefficient COEF. If THIS already contains + * Add an element to THIS, with a coefficient COEF. If THIS already contains * an element with the same name, adjust its coefficient only; if not, create * a new ElementCoef pair and add to THIS. @@ -185,5 +185,5 @@ bool ElementList::contains(const QString& name) { ElementCoef* current = elements->first(); while (current != 0) { - if (current->name == name) + if (current->name == name) return true; current = elements->next(); @@ -203,5 +203,5 @@ QString ElementList::getName() const { * A chemical element. */ -Element::Element(const QString& n, double w) +Element::Element(const QString& n, double w) : weight(w), name(n) { } @@ -219,5 +219,5 @@ void Element::writeOut(QString& line) { } -double Element::getWeight(QDict<SubUnit>* elstable) const { +double Element::getWeight(QDict<SubUnit>* ) const { return weight; } @@ -232,5 +232,5 @@ QString Element::getName() const { /** - * An element - coefficient pair. Used to represent elements within an + * An element - coefficient pair. Used to represent elements within an * element list. */ |