Ejemplo n.º 1
0
            public static CodegenExpression Codegen(
                IntervalComputerStartedByThresholdForge forge,
                CodegenExpression leftStart,
                CodegenExpression leftEnd,
                CodegenExpression rightStart,
                CodegenExpression rightEnd,
                CodegenMethodScope codegenMethodScope,
                ExprForgeCodegenSymbol exprSymbol,
                CodegenClassScope codegenClassScope)
            {
                var methodNode = codegenMethodScope.MakeChild(
                    typeof(bool?),
                    typeof(IntervalComputerStartedByThresholdEval),
                    codegenClassScope)
                                 .AddParam(IntervalForgeCodegenNames.PARAMS);

                methodNode.Block
                .DeclareVar <long>(
                    "threshold",
                    forge.thresholdExpr.Codegen(
                        CodegenExpressionBuilder.StaticMethod(
                            typeof(Math),
                            "Min",
                            IntervalForgeCodegenNames.REF_LEFTSTART,
                            IntervalForgeCodegenNames.REF_RIGHTSTART),
                        methodNode,
                        exprSymbol,
                        codegenClassScope))
                .IfCondition(
                    CodegenExpressionBuilder.Relational(
                        CodegenExpressionBuilder.Ref("threshold"),
                        CodegenExpressionRelational.CodegenRelational.LT,
                        CodegenExpressionBuilder.Constant(0)))
                .StaticMethod(
                    typeof(IntervalComputerStartedByThresholdEval),
                    METHOD_LOGWARNINGINTERVALSTARTEDBYTHRESHOLD)
                .BlockReturn(CodegenExpressionBuilder.ConstantNull())
                .DeclareVar <long>(
                    "delta",
                    CodegenExpressionBuilder.StaticMethod(
                        typeof(Math),
                        "Abs",
                        CodegenExpressionBuilder.Op(
                            IntervalForgeCodegenNames.REF_LEFTSTART,
                            "-",
                            IntervalForgeCodegenNames.REF_RIGHTSTART)))
                .MethodReturn(
                    CodegenExpressionBuilder.And(
                        CodegenExpressionBuilder.Relational(
                            CodegenExpressionBuilder.Ref("delta"),
                            CodegenExpressionRelational.CodegenRelational.LE,
                            CodegenExpressionBuilder.Ref("threshold")),
                        CodegenExpressionBuilder.Relational(
                            IntervalForgeCodegenNames.REF_LEFTEND,
                            CodegenExpressionRelational.CodegenRelational.GT,
                            IntervalForgeCodegenNames.REF_RIGHTEND)));
                return(CodegenExpressionBuilder.LocalMethod(methodNode, leftStart, leftEnd, rightStart, rightEnd));
            }
 public CodegenExpression Codegen(
     CodegenExpression leftStart,
     CodegenExpression leftEnd,
     CodegenExpression rightStart,
     CodegenExpression rightEnd,
     CodegenMethodScope codegenMethodScope,
     ExprForgeCodegenSymbol exprSymbol,
     CodegenClassScope codegenClassScope)
 {
     return(CodegenExpressionBuilder.And(
                CodegenExpressionBuilder.EqualsIdentity(leftStart, rightStart),
                CodegenExpressionBuilder.EqualsIdentity(leftEnd, rightEnd)));
 }
 public CodegenExpression Codegen(
     CodegenExpression leftStart,
     CodegenExpression leftEnd,
     CodegenExpression rightStart,
     CodegenExpression rightEnd,
     CodegenMethodScope codegenMethodScope,
     ExprForgeCodegenSymbol exprSymbol,
     CodegenClassScope codegenClassScope)
 {
     return(CodegenExpressionBuilder.And(
                CodegenExpressionBuilder.Relational(
                    leftStart,
                    CodegenExpressionRelational.CodegenRelational.LT,
                    rightStart),
                CodegenExpressionBuilder.Relational(
                    rightEnd,
                    CodegenExpressionRelational.CodegenRelational.LT,
                    leftEnd)));
 }