Exemplo n.º 1
0
 /*!
 \brief Load promoter energy cost by checking the validity of the given string
 \param value The given energy cost
 \param prom The Promoter reaction
 \return Return true if succed and false if value parameter is invalid.
    */
 private bool loadEnergyCost(string value, Promoter prom)
 {
     if (String.IsNullOrEmpty(value))
       {
     Debug.Log("Error: Empty EnergyCost field. default value = 0");
     prom.setEnergyCost(0f);
       }
     else
       prom.setEnergyCost(float.Parse(value.Replace(",", ".")));
     return true;
 }
Exemplo n.º 2
0
    /*!
    \brief This reaction build a Promoter reaction from a PromoterProprieties class
    \param props The PromoterProprieties wich will serve to create the reaction
    \return Return the new reaction or null if it fail.
       */
    public static IReaction buildPromoterFromProps(PromoterProprieties props)
    {
        if (props == null)
          return null;

        PromoterParser parser = new PromoterParser();
        Promoter reaction = new Promoter();

        reaction.setName(props.name);
        reaction.setBeta(props.beta);
        reaction.setTerminatorFactor(props.terminatorFactor);
        reaction.setEnergyCost(props.energyCost);
        TreeNode<PromoterNodeData> formula = parser.Parse(props.formula);
        reaction.setFormula(formula);
        Product newProd;
        foreach (Product p in props.products)
          {
        newProd = new Product(p);
        reaction.addProduct(newProd);
          }
        return reaction;
    }