Ejemplo n.º 1
0
        internal static DomainValue GetVariableBand(VariableModel theVariable)
        {
            Debug.Assert(!theVariable.DomainExpression.IsEmpty);

            var variableDomainExpressionRoot = theVariable.DomainExpression.Node;
            var evaluatorContext             = new VariableDomainExpressionEvaluatorContext(variableDomainExpressionRoot, theVariable.Parent.Workspace);

            return(VariableDomainExpressionEvaluator.Evaluate(evaluatorContext));
        }
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.");
            }
        }