當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。