/// <summary> /// Open the Dictionary OWLReact. /// </summary> /// <param name="nameDict">Name of the Dictionary</param> /// <param name="reaction">The IReactionProcess</param> /// <returns>The entry for this reaction</returns> private EntryReact InitiateDictionary(string nameDict, IReactionProcess reaction) { DictionaryDatabase db = new DictionaryDatabase(); dictionary = db.GetDictionary(nameDict); string entryString = reaction.Specification.SpecificationReference; entryString = entryString.Substring(entryString.IndexOf('#') + 1); return((EntryReact)dictionary[entryString.ToLowerInvariant()]); }
/// <summary> /// Constructor of the ReactionEngine object. /// </summary> public ReactionEngine() { try { IReactionProcess reaction = (IReactionProcess)this; EntryReact entry = InitiateDictionary("reaction-processes", (IReactionProcess)reaction); InitiateParameterMap2(entry); reaction.ParameterList = ParameterList; // extract mechanism dependence, if there is one if (!string.IsNullOrEmpty(entry.Mechanism)) { ExtractMechanism(entry); } } catch (Exception e) { Console.Error.WriteLine(e.StackTrace); } }
public void TestCentreActive() { IReactionProcess type = reaction; IParameterReaction ipr = type.GetParameterClass(typeof(SetReactionCenter)); Assert.IsNotNull(ipr); Assert.IsFalse(ipr.IsSetParameter); var paramList = new List <IParameterReaction>(); var param = new SetReactionCenter(); param.IsSetParameter = true; paramList.Add(param); type.ParameterList = paramList; IParameterReaction ipr2 = type.GetParameterClass(typeof(SetReactionCenter)); Assert.IsTrue(ipr2.IsSetParameter); }
/// <summary> /// Set the IReactionProcess to analyzed /// /// <param name="reactionClass">The IReactionProcess class</param> // @throws Exception /// </summary> public void SetReaction(Type reactionClass) { if (dictionary == null) { dictionary = OpeningDictionary(); } var obj = reactionClass.GetConstructor(Type.EmptyTypes).Invoke(Array.Empty <object>()); if (!(obj is IReactionProcess)) { throw new CDKException("The passed reaction class must be a IReactionProcess"); } else if (reaction == null) { reaction = (IReactionProcess)obj; entryString = reaction.Specification.SpecificationReference; entryString = entryString.Substring(entryString.IndexOf("#") + 1); } }