Examples of ConditionalBranch


Examples of com.dragome.compiler.ast.ConditionalBranch

        }

      }
      else if (stmt instanceof ConditionalBranch)
      {
        ConditionalBranch cond= (ConditionalBranch) stmt;

        if (bytes.getIndex() == cond.getTargetIndex())
        {

        }
        else
        {
          Node elseNode= graph.getOrCreateNode(bytes.getIndex());

          Node ifNode;
          if (cond.getTargetIndex() <= pc)
          {
            Node[] nodes= graph.getOrSplitNodeAt(cNode, cond.getTargetIndex());
            cNode= nodes[0];
            ifNode= nodes[1];
          }
          else
          {
            ifNode= graph.getOrCreateNode(cond.getTargetIndex());
          }

          BooleanExpression be= new BooleanExpression(cond.getExpression());

          graph.addIfElseEdge(cNode, ifNode, elseNode, be);
          expressionsToVariables(cNode, false);
          cNode= null;

          if (lastJump != null && tryStatements.size() > 0 && (cond.getBeginIndex() - 1 == lastJump.getEndIndex()))
            whileTryProblemDetected= true;

          for (TryStatement tryStatement : tryStatements)
          {
            boolean nextToTryBegining= tryStatement.getBeginIndex() - 1 == cond.getEndIndex();
            boolean sameThanTryBegining= tryStatement.getBeginIndex() == cond.getBeginIndex();
            //      sameThanTryBegining= false; //TODO identificar si es un while!
            if (nextToTryBegining || sameThanTryBegining)
              whileTryProblemDetected= true;
          }

          if (!whileTryProblemDetected)
            for (CodeException codeException : code.getExceptionTable())
            {
              boolean nextToTryBegining= codeException.getEndPC() == cond.getTargetIndex();
              if (nextToTryBegining)
                whileTryProblemDetected= true;
            }

          if (whileTryProblemDetected)
View Full Code Here

Examples of com.dragome.compiler.ast.ConditionalBranch

    return methodBinding.getName() + "#" + methodBinding.getSignature();
  }

  ConditionalBranch createConditional(int currentIndex, InfixExpression.Operator operator) throws IOException
  {
    ConditionalBranch c= new ConditionalBranch(currentIndex + bytes.readShort());
    InfixExpression be= new InfixExpression(operator);
    Expression rightOperand= stack.pop();
    be.setOperands(stack.pop(), rightOperand);
    c.setExpression(be);
    return c;
  }
View Full Code Here

Examples of com.dragome.compiler.ast.ConditionalBranch

    return c;
  }

  ConditionalBranch createConditional(int currentIndex, InfixExpression.Operator operator, Expression rightOperand) throws IOException
  {
    ConditionalBranch c= new ConditionalBranch(currentIndex + bytes.readShort());
    Expression leftOperand= stack.pop();

    if (leftOperand.getTypeBinding() != null && leftOperand.getTypeBinding() == Type.BOOLEAN)
    {
      if (operator == InfixExpression.Operator.EQUALS && NumberLiteral.isZero(rightOperand))
      {
        c.setExpression(Optimizer.negate(leftOperand));
      }
      else
      {
        c.setExpression(leftOperand);
      }
    }
    else
    {
      InfixExpression be= new InfixExpression(operator);
      be.setOperands(leftOperand, rightOperand);
      c.setExpression(be);
    }

    return c;
  }
View Full Code Here

Examples of org.drools.core.rule.ConditionalBranch

import static org.drools.core.reteoo.builder.NamedConsequenceBuilder.buildTerminalNodeForNamedConsequence;

public class ConditionalBranchBuilder implements ReteooComponentBuilder {

    public void build( BuildContext context, BuildUtils utils, RuleConditionElement rce ) {
        ConditionalBranch conditionalBranch = (ConditionalBranch) rce;
        ConditionalBranchEvaluator branchEvaluator = buildConditionalBranchEvaluator( context, conditionalBranch );

        context.pushRuleComponent( rce );

View Full Code Here

Examples of org.drools.core.rule.ConditionalBranch

import static org.drools.core.reteoo.builder.NamedConsequenceBuilder.buildTerminalNodeForNamedConsequence;

public class ConditionalBranchBuilder implements ReteooComponentBuilder {

    public void build( BuildContext context, BuildUtils utils, RuleConditionElement rce ) {
        ConditionalBranch conditionalBranch = (ConditionalBranch) rce;
        ConditionalBranchEvaluator branchEvaluator = buildConditionalBranchEvaluator( context, conditionalBranch );

        context.pushRuleComponent( rce );

        ConditionalBranchNode node = new ConditionalBranchNode( context.getNextId(),
View Full Code Here

Examples of org.drools.core.rule.ConditionalBranch

        NamedConsequenceBuilder namedConsequenceBuilder = (NamedConsequenceBuilder) context.getDialect().getBuilder( NamedConsequenceDescr.class );
        NamedConsequence consequence = namedConsequenceBuilder.build(context, conditionalBranch.getConsequence());

        ConditionalBranchDescr elseBranchDescr = conditionalBranch.getElseBranch();
        return new ConditionalBranch( condition, consequence, elseBranchDescr != null ? build(context, elseBranchDescr, prefixPattern) : null );
    }
View Full Code Here

Examples of org.drools.core.rule.ConditionalBranch

        NamedConsequenceBuilder namedConsequenceBuilder = (NamedConsequenceBuilder) context.getDialect().getBuilder( NamedConsequenceDescr.class );
        NamedConsequence consequence = namedConsequenceBuilder.build(context, conditionalBranch.getConsequence());

        ConditionalBranchDescr elseBranchDescr = conditionalBranch.getElseBranch();
        return new ConditionalBranch( condition, consequence, elseBranchDescr != null ? build(context, elseBranchDescr, prefixPattern) : null );
    }
View Full Code Here

Examples of org.drools.core.rule.ConditionalBranch

        NamedConsequenceBuilder namedConsequenceBuilder = (NamedConsequenceBuilder) context.getDialect().getBuilder( NamedConsequenceDescr.class );
        NamedConsequence consequence = namedConsequenceBuilder.build(context, conditionalBranch.getConsequence());

        ConditionalBranchDescr elseBranchDescr = conditionalBranch.getElseBranch();
        return new ConditionalBranch( condition, consequence, elseBranchDescr != null ? build(context, elseBranchDescr, prefixPattern) : null );
    }
View Full Code Here

Examples of org.drools.rule.ConditionalBranch

import static org.drools.reteoo.builder.NamedConsequenceBuilder.buildTerminalNodeForNamedConsequence;

public class ConditionalBranchBuilder implements ReteooComponentBuilder {

    public void build( BuildContext context, BuildUtils utils, RuleConditionElement rce ) {
        ConditionalBranch conditionalBranch = (ConditionalBranch) rce;
        ConditionalBranchEvaluator branchEvaluator = buildConditionalBranchEvaluator( context, conditionalBranch );

        context.pushRuleComponent( rce );

        ConditionalBranchNode node = new ConditionalBranchNode( context.getNextId(),
View Full Code Here

Examples of org.drools.rule.ConditionalBranch

        NamedConsequenceBuilder namedConsequenceBuilder = (NamedConsequenceBuilder) context.getDialect().getBuilder( NamedConsequenceDescr.class );
        NamedConsequence consequence = namedConsequenceBuilder.build(context, conditionalBranch.getConsequence());

        ConditionalBranchDescr elseBranchDescr = conditionalBranch.getElseBranch();
        return new ConditionalBranch( condition, consequence, elseBranchDescr != null ? build(context, elseBranchDescr, prefixPattern) : null );
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.