本文整理汇总了C#中Constant.HasNotNull方法的典型用法代码示例。如果您正苦于以下问题:C# Constant.HasNotNull方法的具体用法?C# Constant.HasNotNull怎么用?C# Constant.HasNotNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Constant
的用法示例。
在下文中一共展示了Constant.HasNotNull方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddRewritingToCaseStatement
// returns true when the case statement is completed
private bool AddRewritingToCaseStatement(
Tile<FragmentQuery> rewriting, CaseStatement caseStatement, MemberPath currentPath, Constant domainValue)
{
var whenCondition = BoolExpression.True;
// check whether the rewriting is always true or always false
// if it's always true, we don't need any other WHEN clauses in the case statement
// if it's always false, we don't need to add this WHEN clause to the case statement
// given: domainQuery is satisfied. Check (domainQuery -> rewriting)
var isAlwaysTrue = _qp.IsContainedIn(CreateTile(_domainQuery), rewriting);
var isAlwaysFalse = _qp.IsDisjointFrom(CreateTile(_domainQuery), rewriting);
Debug.Assert(!(isAlwaysTrue && isAlwaysFalse));
if (isAlwaysFalse)
{
return false; // don't need an unsatisfiable WHEN clause
}
if (isAlwaysTrue)
{
Debug.Assert(caseStatement.Clauses.Count == 0);
}
ProjectedSlot projectedSlot;
if (domainValue.HasNotNull())
{
projectedSlot = new MemberProjectedSlot(currentPath);
}
else
{
projectedSlot = new ConstantProjectedSlot(domainValue);
}
if (!isAlwaysTrue)
{
whenCondition = TileToBoolExpr(rewriting);
}
else
{
whenCondition = BoolExpression.True;
}
caseStatement.AddWhenThen(whenCondition, projectedSlot);
return isAlwaysTrue;
}