Пример #1
0
        public RandomVariable GetRandomVariable(object owner, IContextLookup globalVars)
        {
            Domain objDomain;

            switch (DomainType)
            {
            case RandomVariableDomainType.Boolean:
                objDomain = new BooleanDomain();
                break;

            case RandomVariableDomainType.FiniteInteger:

                objDomain =
                    new FiniteIntegerDomain(IntValues.ConvertAll <Integer>(intObj => new Integer(intObj)).ToArray());
                break;

            case RandomVariableDomainType.ArbitraryToken:
                var enumerable = ArbitraryValues.EvaluateTyped(owner, globalVars);
                var asList     = new System.Collections.ArrayList();
                foreach (object o in enumerable)
                {
                    asList.Add(o);
                }
                objDomain =
                    new ArbitraryTokenDomain(asList.ToArray());
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            return(new RandVar(Name, objDomain));
        }