fuzzyterm.cs

来自「在.net环境下用C#开发的模糊控制函数库」· CS 代码 · 共 67 行

CS
67
字号
/*
 * 
 * fuzzynet: Fuzzy Logic Library for Microsoft .NET
 * Copyright (C) 2008 Dmitry Kaluzhny  (kaluzhny_dmitrie@mail.ru)
 * 
 * */

using System;
using System.Collections.Generic;

namespace AI.Fuzzy.Library
{
    /// <summary>
    /// Linguistic term
    /// </summary>
    public class FuzzyTerm
    {
        string _name;
        IMembershipFunction _mf;

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="name">Term name</param>
        /// <param name="var">Linguistic variable to which the term belongs</param>
        /// <param name="mf">Membership function initially associated with the term</param>
        public FuzzyTerm(string name, IMembershipFunction mf)
        {
            if (RuleParser.IsValidName(name))
            {
                throw new ArgumentException("Invalid term name.");
            }

            _name = name;
            _mf = mf;
        }

        /// <summary>
        /// Membership function initially associated with the term
        /// </summary>
        public IMembershipFunction MembershipFunction
        {
            get { return _mf; }
        }

        /// <summary>
        /// Name of the term
        /// </summary>
        public string Name
        {
            set
            {
                if (RuleParser.IsValidName(value))
                {
                    throw new ArgumentException("Invalid term name.");
                }

                _name = value;
            }
            get
            {
                return _name;
            }
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?