AIMA.Probability.Util.ProbUtil.checkValidRandomVariableName C# (CSharp) Method

checkValidRandomVariableName() public static method

public static checkValidRandomVariableName ( String name ) : void
name String
return void
        public static void checkValidRandomVariableName(String name)
        {
            if (null == name || name.Trim().Length == 0
                || name.Trim().Length != name.Length || name.Contains(" "))
            {
                throw new ArgumentException(
                    "Name of RandomVariable must be specified and contain no leading, trailing or embedded spaces.");
            }
            if (name.Substring(0, 1).ToLower().Equals(name.Substring(0, 1)))
            {
                throw new ArgumentException(
                    "Name must start with a leading upper case letter.");
            }
        }

Usage Example

コード例 #1
0
ファイル: RandVar.cs プロジェクト: claudiu04/AIMA.Net
        public RandVar(String name, IDomain domain)
        {
            ProbUtil.checkValidRandomVariableName(name);
            if (null == domain)
            {
                throw new ArgumentException(
                          "Domain of RandomVariable must be specified.");
            }

            this.name   = name;
            this.domain = domain;
            this.scope.add(this);
        }