/// <summary>
 ///     Requires: <see cref="MemberRestriction.IsComplete" /> is true.
 /// </summary>
 internal override DomainBoolExpr FixRange(Set<Constant> range, MemberDomainMap memberDomainMap)
 {
     Debug.Assert(IsComplete, "Ranges are fixed only for complete type restrictions.");
     var possibleValues = memberDomainMap.GetDomain(RestrictedMemberSlot.MemberPath);
     BoolLiteral newLiteral = new TypeRestriction(RestrictedMemberSlot, new Domain(range, possibleValues));
     return newLiteral.GetDomainBoolExpression(memberDomainMap);
 }
Пример #2
0
        // <summary>
        // Requires: <see cref="MemberRestriction.IsComplete" /> is true.
        // </summary>
        internal override DomainBoolExpr FixRange(Set <Constant> range, MemberDomainMap memberDomainMap)
        {
            Debug.Assert(IsComplete, "Ranges are fixed only for complete type restrictions.");
            var         possibleValues = memberDomainMap.GetDomain(RestrictedMemberSlot.MemberPath);
            BoolLiteral newLiteral     = new TypeRestriction(RestrictedMemberSlot, new Domain(range, possibleValues));

            return(newLiteral.GetDomainBoolExpression(memberDomainMap));
        }
Пример #3
0
        /// <summary>
        ///     Takes in a JoinTreeNode and a Contition Property Map and creates an BoolExpression
        ///     for the Condition Map.
        /// </summary>
        /// <param name="joinTreeNode"> </param>
        /// <param name="conditionMap"> </param>
        /// <returns> </returns>
        private static BoolExpression GetConditionExpression(MemberPath member, StorageConditionPropertyMapping conditionMap)
        {
            //Get the member for which the condition is being specified
            EdmMember conditionMember = (conditionMap.ColumnProperty != null) ? conditionMap.ColumnProperty : conditionMap.EdmProperty;

            var conditionMemberNode = new MemberPath(member, conditionMember);
            //Check if this is a IsNull condition
            MemberRestriction conditionExpression = null;
            if (conditionMap.IsNull.HasValue)
            {
                // for conditions on scalars, create NodeValue nodes, otherwise NodeType
                var conditionConstant = conditionMap.IsNull.Value ? Constant.Null : Constant.NotNull;
                if (MetadataHelper.IsNonRefSimpleMember(conditionMember))
                {
                    conditionExpression = new ScalarRestriction(conditionMemberNode, conditionConstant);
                }
                else
                {
                    conditionExpression = new TypeRestriction(conditionMemberNode, conditionConstant);
                }
            }
            else
            {
                conditionExpression = new ScalarRestriction(conditionMemberNode, new ScalarConstant(conditionMap.Value));
            }

            Debug.Assert(conditionExpression != null);

            return BoolExpression.CreateLiteral(conditionExpression, null);
        }
Пример #4
0
 internal TypeRestriction(MemberPath member, IEnumerable <EdmType> values)
     : base(new MemberProjectedSlot(member), TypeRestriction.CreateTypeConstants(values))
 {
 }