src/Shared/EntityFramework/Core/Common/Utils/Boolean/DomainConstraintConversionContext.cs
// <summary>
// Translates a domain constraint term to an N-ary DD vertex.
// </summary>
Translates a domain constraint term to an N-ary DD vertex.
Translates a domain constraint term to an N - ary DD vertex .
internal override Vertex TranslateTermToVertex(TermExpr<DomainConstraint<T_Variable, T_Element>> term)
        {
            var range = term.Identifier.Range;
            var domainVariable = term.Identifier.Variable;
            var domain = domainVariable.Domain;
            if (range.All(element => !domain.Contains(element)))
            {
                return Vertex.Zero;
            }
            if (domain.All(element => range.Contains(element)))
            {
                return Vertex.One;
            }
            var children = domain.Select(element => range.Contains(element) ? Vertex.One : Vertex.Zero).ToArray();
            int robddVariable;
            if (!_domainVariableToRobddVariableMap.TryGetValue(domainVariable, out robddVariable))
            {
                robddVariable = Solver.CreateVariable();
                _domainVariableToRobddVariableMap[domainVariable] = robddVariable;
            }
            return Solver.CreateLeafVertex(robddVariable, children);
        }
internal override Vertex TranslateTermToVertex ( TermExpr < DomainConstraint < T_Variable , T_Element > > term ) { var range = term . Identifier . Range ; var domainVariable = term . Identifier . Variable ; var domain = domainVariable . Domain ; if ( range . All ( element => ! domain . Contains ( element ) ) ) { return Vertex . Zero ; } if ( domain . All ( element => range . Contains ( element ) ) ) { return Vertex . One ; } var children = domain . Select ( element => range . Contains ( element ) ? Vertex . One : Vertex . Zero ) . ToArray ( ) ; int robddVariable ; if ( ! _domainVariableToRobddVariableMap . TryGetValue ( domainVariable , out robddVariable ) ) { robddVariable = Solver . CreateVariable ( ) ; _domainVariableToRobddVariableMap [ domainVariable ] = robddVariable ; } return Solver . CreateLeafVertex ( robddVariable , children ) ; }
Translates a domain constraint term to an N-ary DD vertex.
Translates a domain constraint term to an N - ary DD vertex .
// trivially false // trivially true // determine assignments for this constraints (if the range contains a value in the domain, '1', else '0') // see if we know this variable // create a new vertex with the given assignments
term
TermExpr<DomainConstraint<T_Variable, T_Element>>