QString symbol = domElement.namedItem( "symbol" ).toElement().text();
QString oxydation = domElement.namedItem( "oxydation" ).toElement().text();
QString acidicbehaviour = domElement.namedItem( "acidicbehaviour" ).toElement().text();
- QString isotopes = domElement.namedItem( "isotopes" ).toElement().text();
QDomNodeList elist = domElement.elementsByTagName( "energy" );
QValueList<double> ionlist;
for( uint i = 0; i < elist.length(); i++ )
{
- ionlist.append( elist.item( i ).toElement().text().toDouble() );
+ ionlist.append( elist.item( i ).toElement().text().toDouble() );
+ }
+
+ //now read in all the date for the isotopes
+ QDomNodeList isotopelist = domElement.elementsByTagName( "isotope" );
+ QValueList<Isotope*> isolist;
+ for( uint i = 0; i < isotopelist.length(); i++ )
+ {
+ QDomElement iso = elist.item( i ).toElement();
+ double halflife = iso.attributeNode( "halflife" ).value().toDouble();
+ double weight = iso.attributeNode( "weight" ).value().toDouble();
+ QString format = iso.attributeNode( "halflifeformat" ).value();
+ int neutrons = iso.attributeNode( "neutron" ).value().toInt();
+ double percentage = iso.attributeNode( "percentage" ).value().toDouble();
+
+ Isotope *isotope = new Isotope( neutrons, percentage, weight, halflife, format );
+ isolist.append( isotope );
}
Element *e = new Element();
e->setSymbol(symbol);
e->setOxydation(oxydation);
e->setAcidicbehaviour(acidicbehaviour);
- e->setIsotopes(isotopes);
e->setIonisationList( ionlist );
+ e->setIsotopeList( isolist );
e->setMass( mass );
e->setEN( en );
{
return m_numOfElements;
}
+
+Isotope::Isotope( int neutrons, double percentage, double weight, double halflife, QString format )
+{
+ m_neutrons = neutrons;
+ m_percentage = percentage;
+ m_halflife = halflife;
+ m_format = format;
+ m_weight = weight;
+}
typedef QValueList<coordinate> CList;
typedef QValueList<double> doubleList;
+class Isotope
+{
+ public:
+ Isotope( int neutrons, double percentage, double weight, double halflife, QString format );
+
+ bool seconds() {
+ if ( m_format == "seconds" )
+ return true;
+ else
+ return false;
+ }
+
+ double halflife() const{
+ return m_halflife;
+ }
+
+ double percentage() const{
+ return m_percentage;
+ }
+
+ int neutrons() const{
+ return m_neutrons;
+ }
+
+ double weight() const{
+ return m_weight;
+ }
+
+ private:
+ /**
+ * it is either "years" or "seconds". Usually we use seconds. But some
+ * isotopes have half-lifes of billion of years. This simply
+ * doesn't fit into a unsigned int or double
+ */
+ QString m_format;
+
+ /**
+ * the weight of the isotope
+ */
+ double m_weight;
+
+ /**
+ * the half-life of an isotope, usually in seconds
+ * @see m_format
+ */
+ double m_halflife;
+
+ /**
+ * If 95.2% of the isotopes are of this type, this
+ * variable will have the value 95.2
+ */
+ double m_percentage;
+
+ /**
+ * the number of neutrons
+ */
+ int m_neutrons;
+};
+
/**
* @short this class contains all Element-objects as
* a QValueList<Element*>
m_ionenergies = l;
}
- QValueList<double> ionisationList() const{
+ QValueList<Isotope*> isotopeList()const{
+ return m_isotopeList;
+ }
+
+ void setIsotopeList( QValueList<Isotope*> list ){
+ m_isotopeList = list;
+ }
+
+ doubleList ionisationList() const{
return m_ionenergies;
}
return m_acidbeh;
}
- /**
- * @return the isotopes of the element
- */
- QString Isotopes() const {
- return m_isotopes;
- }
-
/**
* @return the oxydationstages of the element
*/
-
QString oxstage() const {
return m_oxstage;
}
QColor elementColor() const {
return m_Color;
}
+
+ QValueList<Isotope*> isotopes() const{
+ return m_isotopeList;
+ }
void setupXY();
* the integer num represents the number of the element
*/
int m_ElementNumber;
+
+ QValueList<Isotope*> m_isotopeList;
QColor m_Color;