/// <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."); IEnumerable<Constant> possibleValues = memberDomainMap.GetDomain(RestrictedMemberSlot.MemberPath); BoolLiteral newLiteral = new TypeRestriction(RestrictedMemberSlot, new Domain(range, possibleValues)); return newLiteral.GetDomainBoolExpression(memberDomainMap); }
/// <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."); IEnumerable <Constant> possibleValues = memberDomainMap.GetDomain(RestrictedMemberSlot.MemberPath); BoolLiteral newLiteral = new TypeRestriction(RestrictedMemberSlot, new Domain(range, possibleValues)); return(newLiteral.GetDomainBoolExpression(memberDomainMap)); }
/// <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); }