コード例 #1
0
        /// <summary>
        /// Check for a difference
        /// </summary>
        /// <param name="subSet">The parameter subset</param>
        /// <param name="paramDefinition">The parameter definition</param>
        /// <returns>True if there is a difference</returns>
        private bool Differs(ParameterSet subSet, ParameterDefinition paramDefinition)
        {
            bool result;

            if (!paramDefinition.ValueIsDefined())
            {
                result = false;
            }
            else if ((subSet.Parent == null) || (!subSet.Parent.IsDefined(paramDefinition.FullName)))
            {
                result = true;
            }
            else
            {
                switch (paramDefinition.ParamType)
                {
                case TYPEREAL: result = subSet.ParamReal(paramDefinition.FullName) != subSet.Parent.ParamReal(paramDefinition.FullName);
                    break;

                case TYPEINT: result = subSet.ParamInt(paramDefinition.FullName) != subSet.Parent.ParamInt(paramDefinition.FullName);
                    break;

                case TYPEBOOL: result = subSet.ParamBool(paramDefinition.FullName) != subSet.Parent.ParamBool(paramDefinition.FullName);
                    break;

                case TYPETEXT: result = subSet.ParamStr(paramDefinition.FullName) != subSet.Parent.ParamStr(paramDefinition.FullName);
                    break;

                default: result = false;
                    break;
                }
            }
            return(result);
        }
コード例 #2
0
ファイル: grazprmread.cs プロジェクト: BrianCollinss/ApsimNG
        /// <summary>
        /// Check for a difference
        /// </summary>
        /// <param name="subSet">The parameter subset</param>
        /// <param name="paramDefinition">The parameter definition</param>
        /// <returns>True if there is a difference</returns>
        private bool Differs(ParameterSet subSet, ParameterDefinition paramDefinition)
        {
            bool result;

            if (!paramDefinition.ValueIsDefined())
            {
                result = false;
            }
            else if ((subSet.Parent == null) || (!subSet.Parent.IsDefined(paramDefinition.FullName)))
            {
                result = true;
            }
            else
            {
                if (paramDefinition.ParamType == TYPEREAL)
                {
                    result = subSet.ParamReal(paramDefinition.FullName) != subSet.Parent.ParamReal(paramDefinition.FullName);
                }
                else if (paramDefinition.ParamType == TYPEINT)
                {
                    result = subSet.ParamInt(paramDefinition.FullName) != subSet.Parent.ParamInt(paramDefinition.FullName);
                }
                else if (paramDefinition.ParamType == TYPEBOOL)
                {
                    result = subSet.ParamBool(paramDefinition.FullName) != subSet.Parent.ParamBool(paramDefinition.FullName);
                }
                else if (paramDefinition.ParamType == TYPETEXT)
                {
                    result = subSet.ParamStr(paramDefinition.FullName) != subSet.Parent.ParamStr(paramDefinition.FullName);
                }
                else
                {
                    result = false;
                }
            }
            return(result);
        }