Ejemplo n.º 1
0
    /*!
     * \brief Build an Instant reaction with a InstantReactionProperties class
     * \param props The properties
     * \return Return a new reaction or null if it fail.
     */
    public static IReaction       buildInstantReactionFromProps(InstantReactionProperties props)
    {
        if (props == null)
        {
            return(null);
        }

        InstantReaction reaction = new InstantReaction();

        reaction.setName(props.name);
        reaction.setEnergyCost(props.energyCost);
        Product newReactant;

        foreach (Product r in props.reactants)
        {
            newReactant = new Product(r);
            reaction.addReactant(newReactant);
        }
        Product newProd;

        foreach (Product p in props.products)
        {
            newProd = new Product(p);
            reaction.addProduct(newProd);
        }
        return(reaction);
    }
Ejemplo n.º 2
0
  /*!
    \brief Build an Instant reaction with a InstantReactionProperties class
    \param props The properties
    \return Return a new reaction or null if it fail.
   */
  public static IReaction       buildInstantReactionFromProps(InstantReactionProperties props)
  {
    if (props == null)
      return null;

    InstantReaction reaction = new InstantReaction();

    reaction.setName(props.name);
    reaction.setEnergyCost(props.energyCost);
    Product newReactant;
    foreach (Product r in props.reactants)
      {
        newReactant = new Product(r);
        reaction.addReactant(newReactant);
      }
    Product newProd;
    foreach (Product p in props.products)
      {
        newProd = new Product(p);
        reaction.addProduct(newProd);
      }
    return reaction;
  }