Пример #1
0
    private bool storeMolecule(XmlNode node, Molecule.eType type, ArrayList molecules)
    {
        Molecule mol = new Molecule();

        mol.setType(type);
        foreach (XmlNode attr in node)
          {
        switch (attr.Name)
          {
          case "name":
            mol.setName(attr.InnerText);
            break;
          case "description":
            mol.setDescription(attr.InnerText);
            break;
          case "concentration":
            mol.setConcentration(float.Parse(attr.InnerText.Replace(",", ".")));
            break;
          case "degradationRate":
            mol.setDegradationRate(float.Parse(attr.InnerText.Replace(",", ".")));
            break;
          case "size":
            mol.setSize(float.Parse(attr.InnerText.Replace(",", ".")));
            break;
          }
         }
        molecules.Add(mol);
        //FIXME : create a real reaction for degradation with rate and name
        //     _reactions.AddLast(new Degradation(mol.getDegradationRate(), mol.getName()));
        return true;
    }
Пример #2
0
    /*!
    \brief This fonction load a molecule
    \param node The xml node to parse
    \param type The molecule type
    \param molecules The array of molecules where to add new molecules
    \return Return always true
       */
    private bool storeMolecule(XmlNode node, Molecule.eType type, ArrayList molecules)
    {
        Molecule mol = new Molecule();

        mol.setType(type);
        foreach (XmlNode attr in node)
          {
        switch (attr.Name)
          {
          case "name":
            mol.setName(attr.InnerText);
            break;
          case "description":
            mol.setDescription(attr.InnerText);
            break;
          case "concentration":
            mol.setConcentration(float.Parse(attr.InnerText.Replace(",", ".")));
            break;
          case "degradationRate":
            mol.setDegradationRate(float.Parse(attr.InnerText.Replace(",", ".")));
            break;
          case "FickFactor":
            mol.setFickFactor(float.Parse(attr.InnerText.Replace(",", ".")));
            break;
          }
         }
        molecules.Add(mol);
        return true;
    }