当前位置: 首页>>代码示例>>C#>>正文


C# BooleanExpression类代码示例

本文整理汇总了C#中BooleanExpression的典型用法代码示例。如果您正苦于以下问题:C# BooleanExpression类的具体用法?C# BooleanExpression怎么用?C# BooleanExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BooleanExpression类属于命名空间,在下文中一共展示了BooleanExpression类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProcessWhereBooleanExpression

        private void ProcessWhereBooleanExpression(BooleanExpression BooleanExpression)
        {
            string ExpressionType = FragmentTypeParser.GetFragmentType(BooleanExpression);
            switch (ExpressionType)
            {
                case "BooleanComparisonExpression":
                    var BoolComp = (BooleanComparisonExpression) BooleanExpression;
                    ProcessWhereScalarExpression(BoolComp.FirstExpression);
                    ProcessWhereScalarExpression(BoolComp.SecondExpression);
                    if( (BoolComp.ComparisonType == BooleanComparisonType.Equals) &&
                        (FragmentTypeParser.GetFragmentType(BoolComp.FirstExpression)=="NullLiteral" ||
                        FragmentTypeParser.GetFragmentType(BoolComp.SecondExpression) == "NullLiteral")
                        )
                    {
                        _smells.SendFeedBack(46, BoolComp);
                    }

                    break;
                case "BooleanBinaryExpression":
                    var BoolExpression = (BooleanBinaryExpression) BooleanExpression;
                    ProcessWhereBooleanExpression(BoolExpression.FirstExpression);
                    ProcessWhereBooleanExpression(BoolExpression.SecondExpression);
                    break;
                default:
                    break;
            }
        }
开发者ID:dalehhirt,项目名称:TSQL-Smells,代码行数:27,代码来源:WhereProcessor.cs

示例2: SetTurn

        public SetTurn(BooleanExpression<Missile> eligibility, int _priority, double percentageOfTurn)
            : base(eligibility, _priority)
        {
            if (percentageOfTurn > 100.0d) percentageOfTurn = 100.0d;
            if (percentageOfTurn < -100.0d) percentageOfTurn = -100.0d;

            this.percentageOfTurn = percentageOfTurn;
        }
开发者ID:genveir,项目名称:Genetics-Library,代码行数:8,代码来源:SetTurn.cs

示例3: Search

        private void Search(BooleanExpression search)
        {
            if (search is BooleanBinaryExpression)
            {
                var bbe = search as BooleanBinaryExpression;
                Search(bbe.FirstExpression);
                Search(bbe.SecondExpression);
            }

            if (search is BooleanParenthesisExpression)
            {
                var bpe = search as BooleanParenthesisExpression;
                Search(bpe.Expression);
            }

            if (search is BooleanComparisonExpression)
            {
                CheckRewriteable(search);
            }
        }
开发者ID:japj,项目名称:SSDT-DevPack,代码行数:20,代码来源:NonSargableRewrites.cs

示例4: Do

		public Do (Statement statement, BooleanExpression bool_expr, Location l)
		{
			expr = bool_expr;
			EmbeddedStatement = statement;
			loc = l;
		}
开发者ID:alisci01,项目名称:mono,代码行数:6,代码来源:statement.cs

示例5: yyparse


//.........这里部分代码省略.........
		start_block (lexer.Location);
	  }
  break;
case 620:
  case_620();
  break;
case 622:
  case_622();
  break;
case 623:
  case_623();
  break;
case 624:
  case_624();
  break;
case 625:
  case_625();
  break;
case 626:
  case_626();
  break;
case 627:
  case_627();
  break;
case 633:
#line 4179 "cs-parser.jay"
  {
		yyVal = new ArglistAccess (GetLocation (yyVals[0+yyTop]));
	  }
  break;
case 635:
#line 4190 "cs-parser.jay"
  {
		yyVal = new BooleanExpression ((Expression) yyVals[0+yyTop]);
	  }
  break;
case 636:
#line 4203 "cs-parser.jay"
  {
		lexer.ConstraintsParsing = true;
	  }
  break;
case 637:
  case_637();
  break;
case 638:
  case_638();
  break;
case 639:
  case_639();
  break;
case 640:
  case_640();
  break;
case 641:
#line 4237 "cs-parser.jay"
  { yyVal = null; }
  break;
case 642:
#line 4239 "cs-parser.jay"
  { yyVal = yyVals[0+yyTop]; }
  break;
case 643:
  case_643();
  break;
case 646:
开发者ID:Ein,项目名称:monodevelop,代码行数:67,代码来源:cs-parser.cs

示例6: Where

 public Where(ToplevelBlock block, BooleanExpression expr, Location loc)
     : base(block, expr, loc)
 {
 }
开发者ID:speier,项目名称:shake,代码行数:4,代码来源:linq.cs

示例7: Visit

			public override object Visit (BooleanExpression booleanExpression)
			{
				return booleanExpression.Expr.Accept (this);
			}
开发者ID:pgoron,项目名称:monodevelop,代码行数:4,代码来源:CSharpParser.cs

示例8: ParseBooleanExpression

        private WBooleanExpression ParseBooleanExpression(BooleanExpression bexpr)
        {
            if (bexpr == null)
            {
                return null;
            }

            switch (bexpr.GetType().Name)
            {
                case "BooleanBinaryExpression":
                    {
                        var oexpr = bexpr as BooleanBinaryExpression;
                        var pexpr = new WBooleanBinaryExpression
                        {
                            FirstExpr = ParseBooleanExpression(oexpr.FirstExpression),
                            SecondExpr = ParseBooleanExpression(oexpr.SecondExpression),
                            BooleanExpressionType = oexpr.BinaryExpressionType,
                            FirstTokenIndex = oexpr.FirstTokenIndex,
                            LastTokenIndex = oexpr.LastTokenIndex,
                        };

                        return pexpr;
                    }
                case "BooleanComparisonExpression":
                    {
                        var oexpr = bexpr as BooleanComparisonExpression;
                        var pexpr = new WBooleanComparisonExpression
                        {
                            ComparisonType = oexpr.ComparisonType,
                            FirstExpr = ParseScalarExpression(oexpr.FirstExpression),
                            SecondExpr = ParseScalarExpression(oexpr.SecondExpression),
                            FirstTokenIndex = oexpr.FirstTokenIndex,
                            LastTokenIndex = oexpr.LastTokenIndex,
                        };

                        return pexpr;
                    }
                case "BooleanIsNullExpression":
                    {
                        var oexpr = bexpr as BooleanIsNullExpression;
                        var pexpr = new WBooleanIsNullExpression
                        {
                            IsNot = oexpr.IsNot,
                            Expression = ParseScalarExpression(oexpr.Expression),
                            FirstTokenIndex = oexpr.FirstTokenIndex,
                            LastTokenIndex = oexpr.LastTokenIndex,
                        };

                        return pexpr;
                    }
                case "BooleanNotExpression":
                    {
                        var oexpr = bexpr as BooleanNotExpression;
                        var pexpr = new WBooleanNotExpression
                        {
                            Expression = ParseBooleanExpression(oexpr.Expression),
                            FirstTokenIndex = oexpr.FirstTokenIndex,
                            LastTokenIndex = oexpr.LastTokenIndex,
                        };

                        return pexpr;
                    }
                case "BooleanParenthesisExpression":
                    {
                        var oexpr = bexpr as BooleanParenthesisExpression;
                        var pexpr = new WBooleanParenthesisExpression
                        {
                            Expression = ParseBooleanExpression(oexpr.Expression),
                            FirstTokenIndex = oexpr.FirstTokenIndex,
                            LastTokenIndex = oexpr.LastTokenIndex,
                        };

                        return pexpr;
                    }
                case "BooleanTernaryExpression":
                    {
                        var oexpr = bexpr as BooleanTernaryExpression;
                        var pexpr = new WBetweenExpression
                        {
                            FirstTokenIndex = oexpr.FirstTokenIndex,
                            LastTokenIndex = oexpr.LastTokenIndex,
                        };

                        switch (oexpr.TernaryExpressionType)
                        {
                            case BooleanTernaryExpressionType.Between:
                                pexpr.NotDefined = false;
                                break;
                            case BooleanTernaryExpressionType.NotBetween:
                                pexpr.NotDefined = true;
                                break;
                            default:
                                throw new GraphViewException("Undefined tenary expression type");
                        }

                        pexpr.FirstExpr = ParseScalarExpression(oexpr.FirstExpression);
                        pexpr.SecondExpr = ParseScalarExpression(oexpr.SecondExpression);
                        pexpr.ThirdExpr = ParseScalarExpression(oexpr.ThirdExpression);

                        return pexpr;
//.........这里部分代码省略.........
开发者ID:Coword,项目名称:GraphView,代码行数:101,代码来源:WSqlParser.cs

示例9: Visit

		public virtual object Visit (BooleanExpression booleanExpression)
		{
			return null;
		}
开发者ID:KAW0,项目名称:Alter-Native,代码行数:4,代码来源:visit.cs

示例10: CheckRewriteable

        private void CheckRewriteable(BooleanExpression search)
        {
            var bce = search as BooleanComparisonExpression;
            var haveIsNull = false;
            var haveLiteral = false;

            Literal literal = new BinaryLiteral();
            var isNull = new FunctionCall();

            if (bce.FirstExpression is FunctionCall)
            {
                var func = bce.FirstExpression as FunctionCall;
                if (func.FunctionName.Value.ToLower() == "isnull")
                {
                    haveIsNull = true;
                    isNull = func;
                }
            }

            if (bce.SecondExpression is FunctionCall)
            {
                var func = bce.SecondExpression as FunctionCall;
                if (func.FunctionName.Value.ToLower() == "isnull")
                {
                    haveIsNull = true;
                    isNull = func;
                }
            }

            if (bce.FirstExpression is Literal)
            {
                haveLiteral = true;
                literal = bce.FirstExpression as Literal;
            }

            if (bce.SecondExpression is Literal)
            {
                haveLiteral = true;
                literal = bce.SecondExpression as Literal;
            }

            if (haveLiteral && haveIsNull)
            {
                var firstParam = isNull.Parameters.FirstOrDefault();
                if (!(firstParam is ColumnReferenceExpression))
                {
                    return;
                }

                var secondParam = isNull.Parameters.LastOrDefault();
                if (secondParam is Literal)
                {
                    if (secondParam.GetType() != literal.GetType())
                    {
                        return;
                    }

                    var isSameLiteral = (secondParam as Literal).Value == literal.Value;

                    var isEquals = bce.ComparisonType == BooleanComparisonType.Equals;

                    if (isEquals && isSameLiteral)
                    {
                        BuildEqualsSameLiteral(search, firstParam, literal);

                        return;
                    }

                    if (!isEquals && !isSameLiteral)
                    {
                        BuildNotEqualsNotSameLiteral(search, firstParam, literal);

                        return;
                    }


                    if (!isEquals && isSameLiteral)
                    {
                        BuildNotEqualsIsSameLiteral(search, firstParam, literal);

                        return;
                    }

                    if (isEquals && !isSameLiteral)
                    {
                        BuildIsEqualsIsNotSameLiteral(search, firstParam, literal);
                    }
                }
            }
        }
开发者ID:japj,项目名称:SSDT-DevPack,代码行数:90,代码来源:NonSargableRewrites.cs

示例11: BuildEqualsSameLiteral

        private void BuildEqualsSameLiteral(BooleanExpression search, ScalarExpression firstParam, Literal literal)
        {
            var newExpression = new BooleanParenthesisExpression();
            var expression = new BooleanBinaryExpression();
            newExpression.Expression = expression;

            expression.BinaryExpressionType = BooleanBinaryExpressionType.Or;
            var isnull = new BooleanIsNullExpression();
            isnull.Expression = firstParam;
            expression.FirstExpression = isnull;

            var second = new BooleanComparisonExpression();
            second.FirstExpression = firstParam;
            second.SecondExpression = literal;
            expression.SecondExpression = second;

            var sql = ScriptDom.GenerateTSql(newExpression);

            _replacementsToMake.Add(new Replacements
            {
                Original = _script.Substring(search.StartOffset, search.FragmentLength),
                OriginalLength = search.FragmentLength,
                OriginalOffset = search.StartOffset,
                Replacement = sql,
                OriginalFragment = _currentFragment
            });
        }
开发者ID:japj,项目名称:SSDT-DevPack,代码行数:27,代码来源:NonSargableRewrites.cs

示例12: MissileAction

 public MissileAction(BooleanExpression<Missile> eligibility, int _priority)
 {
     this.eligibility = eligibility;
     this._priority = _priority;
 }
开发者ID:genveir,项目名称:Genetics-Library,代码行数:5,代码来源:MissileAction.cs

示例13: yyparse


//.........这里部分代码省略.........
case 606:
#line 4325 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  {
		yyVal = new Binary (Binary.Operator.BitwiseOr, 
			         (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]));
	  }
  break;
case 608:
#line 4334 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  {
		yyVal = new Binary (Binary.Operator.LogicalAnd, 
			         (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]));
	  }
  break;
case 610:
#line 4343 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  {
		yyVal = new Binary (Binary.Operator.LogicalOr, 
			         (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]));
	  }
  break;
case 612:
#line 4352 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  {
		if (lang_version < LanguageVersion.ISO_2)
			FeatureIsNotAvailable (GetLocation (yyVals[-1+yyTop]), "null coalescing operator");
			
		yyVal = new Nullable.NullCoalescingOperator ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]));
	  }
  break;
case 614:
#line 4363 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  {
		yyVal = new Conditional (new BooleanExpression ((Expression) yyVals[-4+yyTop]), (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-3+yyTop]));
		lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop]));
	  }
  break;
case 615:
#line 4371 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  { 
        var potentialRolePlayer  = yyVals[0+yyTop] as Expression;
	    var memberExpression = yyVals[-2+yyTop] as MemberAccess;
	    var simpleNameForRole = memberExpression != null ? memberExpression.LeftExpression as SimpleName : yyVals[-2+yyTop] as SimpleName;
	    if(simpleNameForRole != null){
	      var role = FindField(simpleNameForRole.Name, GetLocation(yyVals[-2+yyTop]));
          var isRole = role != null && role.IsRole;
	      if(current_method as Constructor != null){
             /*might be assigning to a role*/
	         yyVal = new RoleAssign ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]));
	      } else if(isRole) {
	        report.Error (10000, GetLocation(potentialRolePlayer), "Roles can only be assigned to players in constructor");
	      } else{
             yyVal = new SimpleAssign ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]));
          }
	    } else   {  
	       yyVal = new SimpleAssign ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]));
	    }
	  }
  break;
case 616:
#line 4391 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  {
		yyVal = new CompoundAssign (
			Binary.Operator.Multiply, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]));
	  }
  break;
开发者ID:runefs,项目名称:Marvin,代码行数:67,代码来源:cs-parser.cs

示例14: Coast

 public Coast(BooleanExpression<Missile> eligibility, int priority) : base(eligibility, priority) { }
开发者ID:genveir,项目名称:Genetics-Library,代码行数:1,代码来源:Coast.cs

示例15: While

		public While (BooleanExpression bool_expr, Statement statement, Location l)
		{
			this.expr = bool_expr;
			Statement = statement;
			loc = l;
		}
开发者ID:alisci01,项目名称:mono,代码行数:6,代码来源:statement.cs


注:本文中的BooleanExpression类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。