//! return a FickReaction reference that correspondond to the two given ids /*! * \param id1 The first id. * \param id2 The second id. * \param list The list of FickReaction where to search in. */ public static FickReaction getFickReactionFromIds(int id1, int id2, LinkedList <FickReaction> list) { foreach (FickReaction react in list) { Medium medium1 = react.getMedium1(); Medium medium2 = react.getMedium2(); if (medium1 != null && medium2 != null) { if ((medium1.getId() == id1 && medium2.getId() == id2) || (medium2.getId() == id1 && medium1.getId() == id2)) { return(react); } } } return(null); }
public override string ToString() { string productString = "(null)"; if (null != _products) { productString = _products.Count.ToString(); } string mediumString = "(null)"; if (null != _medium) { mediumString = "[" + _medium.getName() + ", id#" + _medium.getId() + "]"; } return(string.Format("IReaction[name:{0}, products:{1}, isActive:{2}, medium:{3}, " + "reactionSpeed:{4}, energyCost:{5}, enableSequential:{6}, enableEnergy:{7} ]", _name, //!< The name of the reaction productString, //!< The list of products _isActive, //!< Activation boolean mediumString, //!< The medium where the reaction will be executed _reactionSpeed, //!< Speed coefficient of the reaction _energyCost, //!< Energy consumed by the reaction enableSequential, enableEnergy )); }