• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# BooleanExpression类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: ProcessBooleanExpression

        public void ProcessBooleanExpression(BooleanExpression be)
        {
            String beType = GetFragmentType(be);
            switch (beType)
            {
                case "BooleanComparisonExpression":
                    var BoolComp = (BooleanComparisonExpression)be;
                    ProcessScalarExpression(BoolComp.FirstExpression);
                    ProcessScalarExpression(BoolComp.SecondExpression);

                    break;
                case "BooleanBinaryExpression":
                    var BoolExpression = (BooleanBinaryExpression)be;
                    ProcessBooleanExpression(BoolExpression.FirstExpression);
                    ProcessBooleanExpression(BoolExpression.SecondExpression);
                    break;
                default:
                    break;

            }
        }
开发者ID:jigarpateldba,项目名称:ViewDependancy,代码行数:21,代码来源:Program.cs


示例17: For

		public For (Statement init_statement,
			    BooleanExpression test,
			    Statement increment,
			    Statement statement,
			    Location l)
		{
			InitStatement = init_statement;
			Test = test;
			Increment = increment;
			Statement = statement;
			loc = l;
		}
开发者ID:alisci01,项目名称:mono,代码行数:12,代码来源:statement.cs


示例18: ExplicitVisit

 public override void ExplicitVisit(BooleanExpression fragment)
 {
     _fragments.Add(fragment);
 }
开发者ID:trevor-hingley,项目名称:controcc_sql_utilities,代码行数:4,代码来源:oVisitorAll.cs


示例19: yyparse


//.........这里部分代码省略.........
case 669:
  case_669();
  break;
case 670:
#line 4683 "cs-parser.jay"
  {
	  	valid_param_mod = ParameterModifierType.Ref | ParameterModifierType.Out;	  
	  }
  break;
case 671:
  case_671();
  break;
case 672:
  case_672();
  break;
case 678:
#line 4708 "cs-parser.jay"
  {
		yyVal = new ArglistAccess (GetLocation (yyVals[0+yyTop]));
	  }
  break;
case 679:
  case_679();
  break;
case 680:
  case_680();
  break;
case 681:
  case_681();
  break;
case 683:
#line 4737 "cs-parser.jay"
  {
		yyVal = new BooleanExpression ((Expression) yyVals[0+yyTop]);
	  }
  break;
case 684:
#line 4749 "cs-parser.jay"
  {
	  }
  break;
case 685:
  case_685();
  break;
case 686:
  case_686();
  break;
case 687:
  case_687();
  break;
case 688:
  case_688();
  break;
case 689:
#line 4796 "cs-parser.jay"
  { yyVal = null; }
  break;
case 690:
#line 4798 "cs-parser.jay"
  { yyVal = yyVals[0+yyTop]; StoreModifierLocation (Modifiers.PARTIAL, GetLocation (yyVals[0+yyTop])); }
  break;
case 691:
  case_691();
  break;
case 692:
#line 4811 "cs-parser.jay"
开发者ID:segaman,项目名称:NRefactory,代码行数:67,代码来源:cs-parser.cs


示例20: FabricateBodyStatement

            void FabricateBodyStatement()
            {
                var cas = TypeManager.gen_interlocked_compare_exchange;
                if (cas == null) {
                    var t = Module.PredefinedTypes.Interlocked.Resolve (Location);
                    if (t == null)
                        return;

                    var p = new ParametersImported (
                        new[] {
                                new ParameterData (null, Parameter.Modifier.REF),
                                new ParameterData (null, Parameter.Modifier.NONE),
                                new ParameterData (null, Parameter.Modifier.NONE)
                            },
                        new[] {
                                new TypeParameterSpec (0, null, SpecialConstraint.None, Variance.None, null),
                                new TypeParameterSpec (0, null, SpecialConstraint.None, Variance.None, null),
                                new TypeParameterSpec (0, null, SpecialConstraint.None, Variance.None, null),
                            }, false);

                    var filter = new MemberFilter ("CompareExchange", 1, MemberKind.Method, p, null);
                    cas = TypeManager.gen_interlocked_compare_exchange = TypeManager.GetPredefinedMethod (t, filter, Location);
                }

                //
                // Delegate obj1 = backing_field
                // do {
                //   Delegate obj2 = obj1;
                //   obj1 =	Interlocked.CompareExchange (ref backing_field, Delegate.Combine|Remove(obj2, value), obj1);
                // } while (obj1 != obj2)
                //

                var field_info = ((EventField) method).backing_field;
                FieldExpr f_expr = new FieldExpr (field_info, Location);
                if (!IsStatic)
                    f_expr.InstanceExpression = new CompilerGeneratedThis (Parent.CurrentType, Location);

                var obj1 = LocalVariable.CreateCompilerGenerated (field_info.MemberType, block, Location);
                var obj2 = LocalVariable.CreateCompilerGenerated (field_info.MemberType, block, Location);

                block.AddStatement (new StatementExpression (new SimpleAssign (new LocalVariableReference (obj1, Location), f_expr)));

                var cond = new BooleanExpression (new Binary (Binary.Operator.Inequality,
                    new LocalVariableReference (obj1, Location), new LocalVariableReference (obj2, Location), Location));

                var body = new ExplicitBlock (block, Location, Location);
                block.AddStatement (new Do (body, cond, Location));

                body.AddStatement (new StatementExpression (
                    new SimpleAssign (new LocalVariableReference (obj2, Location), new LocalVariableReference (obj1, Location))));

                var args_oper = new Arguments (2);
                args_oper.Add (new Argument (new LocalVariableReference (obj2, Location)));
                args_oper.Add (new Argument (block.GetParameterReference (0, Location)));

                var args = new Arguments (3);
                args.Add (new Argument (f_expr, Argument.AType.Ref));
                args.Add (new Argument (new Cast (
                    new TypeExpression (field_info.MemberType, Location),
                    new Invocation (MethodGroupExpr.CreatePredefined (Operation, Operation.DeclaringType, Location), args_oper),
                    Location)));
                args.Add (new Argument (new LocalVariableReference (obj1, Location)));

                body.AddStatement (new StatementExpression (new SimpleAssign (
                    new LocalVariableReference (obj1, Location),
                    new Invocation (MethodGroupExpr.CreatePredefined (cas, cas.DeclaringType, Location), args))));
            }
开发者ID:RainsSoft,项目名称:MonoCompilerAsAService,代码行数:67,代码来源:property.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# BooleanStream类代码示例发布时间:2022-05-24
下一篇:
C# Boolean类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap