示例#1
0
        /// <summary>
        /// Check if this hook's functionality is equal to that of another.
        /// Used when deciding which hooks can be omitted (optimised out).
        /// Note: Different parameters typically infer different functionalities, here only the parameters in the <see cref="ParameterRegistry"/> are checked.
        ///		  If your custom hook for any reason requires any additional parameters that alter its behaviour you should add your own checks to this method.
        /// </summary>
        /// <param name="other">The hook to check.</param>
        /// <returns>A boolean indicating whether or not the other hook does the same that this one does.</returns>
        public bool FunctionallyEquals(IHook other)
        {
            if (other == null)
            {
                throw new ArgumentNullException(nameof(other));
            }

            BaseHook otherAsBaseHook      = other as BaseHook;
            bool     otherParametersEqual = otherAsBaseHook == null || ParameterRegistry.RegistryContentEquals(otherAsBaseHook.ParameterRegistry);

            return(GetType() == other.GetType() && TimeStep.StepEquals(other.TimeStep) && otherParametersEqual);
        }