private DomainValue Evaluate()
        {
            var theDomainExpression = Context.DomainExpression;

            switch (theDomainExpression.Inner)
            {
            case RangeDomainExpressionNode rangeDomainExpressionNode:
                return(DomainExpressionEvaluator.Evaluate(rangeDomainExpressionNode, Context.Model));

            case ListDomainExpressionNode listDomainExpressionNode:
                return(DomainExpressionEvaluator.Evaluate(listDomainExpressionNode));

            case TableExpressionNode tableRangeNode:
                return(new DomainExpressionEvaluator().Evaluate(tableRangeNode, Context.Workspace));

            default:
                throw new NotImplementedException("Unknown domain expression.");
            }
        }
Ejemplo n.º 2
0
        internal static DomainValue Evaluate(VariableDomainExpressionEvaluatorContext theContext)
        {
            var theDomainExpression = theContext.DomainExpression;

            switch (theDomainExpression.Inner)
            {
            case SharedDomainReferenceNode domainReferenceNode:
                return(DomainExpressionEvaluator.Evaluate(domainReferenceNode, theContext.Workspace));

            case RangeDomainExpressionNode rangeExpressionNode:
                return(DomainExpressionEvaluator.Evaluate(rangeExpressionNode, theContext.Model));

            case ListDomainExpressionNode listDomainExpressionNode:
                return(DomainExpressionEvaluator.Evaluate(listDomainExpressionNode));

            case TableExpressionNode tableRangeNode:
                return(new DomainExpressionEvaluator().Evaluate(tableRangeNode, theContext.Workspace));

            default:
                throw new NotImplementedException("Unknown variable domain expression.");
            }
        }
        /// <summary>
        /// Evaluate a list domain expression.
        /// </summary>
        /// <param name="theExpressionNode">List domain expression node.</param>
        /// <returns>Domain value.</returns>
        internal static DomainValue Evaluate(ListDomainExpressionNode theExpressionNode)
        {
            var evaluator = new DomainExpressionEvaluator();

            return(evaluator.EvaluateNode(theExpressionNode));
        }
        /// <summary>
        /// Evaluate a shared domain reference.
        /// </summary>
        /// <param name="theExpressionNode">Shared domain reference node.</param>
        /// <param name="theWorkspace">The model.</param>
        /// <returns>Domain value.</returns>
        internal static DomainValue Evaluate(SharedDomainReferenceNode theExpressionNode, WorkspaceModel theWorkspace)
        {
            var evaluator = new DomainExpressionEvaluator();

            return(evaluator.EvaluateReference(theExpressionNode, theWorkspace));
        }
        /// <summary>
        /// Evaluate a range domain expression.
        /// </summary>
        /// <param name="theExpressionNode">The range expression node.</param>
        /// <param name="theModel">The model.</param>
        /// <returns>Domain value.</returns>
        internal static DomainValue Evaluate(RangeDomainExpressionNode theExpressionNode, ModelModel theModel)
        {
            var evaluator = new DomainExpressionEvaluator();

            return(evaluator.EvaluateNode(theExpressionNode, theModel));
        }