Examples of ConditionalExpression


Examples of org.apache.commons.el.ConditionalExpression

        {
            replaceSuffixes((ComplexValue) expression);
        }
        else if (expression instanceof ConditionalExpression)
        {
            ConditionalExpression conditionalExpression =
                (ConditionalExpression) expression;
            replaceSuffixes(conditionalExpression.getTrueBranch());
            replaceSuffixes(conditionalExpression.getFalseBranch());
        }
        else if (expression instanceof UnaryOperatorExpression)
        {
            replaceSuffixes(((UnaryOperatorExpression) expression)
                .getExpression());
View Full Code Here

Examples of org.apache.commons.el.ConditionalExpression

            new ELVariableResolver(facesContext);
        Object expression = _expression;

        while (expression instanceof ConditionalExpression)
        {
            ConditionalExpression conditionalExpression =
                ((ConditionalExpression) expression);
            // first, evaluate the condition (and coerce the result to a
            // boolean value)
            boolean condition =
              Coercions.coerceToBoolean(
                  conditionalExpression.getCondition().evaluate(
                      variableResolver, s_functionMapper,
                      ELParserHelper.LOGGER),
                      ELParserHelper.LOGGER)
                  .booleanValue();

            // then, use this boolean to branch appropriately
            expression = condition ? conditionalExpression.getTrueBranch()
                : conditionalExpression.getFalseBranch();
        }

        if (expression instanceof NamedValue)
        {
            return ((NamedValue) expression).getName();
View Full Code Here

Examples of org.apache.commons.el.ConditionalExpression

            new ELVariableResolver(facesContext);
        Object expression = _expression;
       
        while (expression instanceof ConditionalExpression)
        {
            ConditionalExpression conditionalExpression =
                ((ConditionalExpression) expression);
            // first, evaluate the condition (and coerce the result to a
            // boolean value)
            boolean condition =
              Coercions.coerceToBoolean(
                  conditionalExpression.getCondition().evaluate(
                      variableResolver, s_functionMapper,
                      ELParserHelper.LOGGER),
                      ELParserHelper.LOGGER)
                  .booleanValue();

            // then, use this boolean to branch appropriately
            expression = condition ? conditionalExpression.getTrueBranch()
                : conditionalExpression.getFalseBranch();
        }

        if (expression instanceof NamedValue)
        {
            return ((NamedValue) expression).getName();
View Full Code Here

Examples of org.apache.commons.el.ConditionalExpression

        {
            replaceSuffixes((ComplexValue) expression);
        }
        else if (expression instanceof ConditionalExpression)
        {
            ConditionalExpression conditionalExpression =
                (ConditionalExpression) expression;
            replaceSuffixes(conditionalExpression.getTrueBranch());
            replaceSuffixes(conditionalExpression.getFalseBranch());
        }
        else if (expression instanceof UnaryOperatorExpression)
        {
            replaceSuffixes(((UnaryOperatorExpression) expression)
                .getExpression());
View Full Code Here

Examples of org.candle.decompiler.intermediate.expression.ConditionalExpression

 
  protected void mergeConditions(BooleanBranchIntermediate bbo1, BooleanBranchIntermediate bbo2) {
    //check to see if the false of bbo2 and bbo1 go to same location.

    //previous
    ConditionalExpression m1 = bbo2.getExpression();
   
    //current
    ConditionalExpression m2 = bbo1.getExpression();
   
   
    if(igc.getTrueTarget(bbo2) == bbo1) {
      if(igc.getFalseTarget(bbo1) == igc.getFalseTarget(bbo2)) {
        LogicalGateConditionalExpression expression = new LogicalGateConditionalExpression(m1, m2, LogicalGateType.AND);
View Full Code Here

Examples of org.eclipse.jdt.core.dom.ConditionalExpression

  public void testFactorial() throws Exception {
    CompilationUnit simple = EclipseTACSimpleTestDriver.parseCode("Factorial", FACTORIAL);
    MethodDeclaration m = EclipseTACSimpleTestDriver.getFirstMethod(simple);
    EclipseTAC tac = new EclipseTAC(m.resolveBinding());
   
    ConditionalExpression cond = (ConditionalExpression) EclipseTACSimpleTestDriver.getLastStatementReturn(m).getExpression();
    Variable r = tac.variable(cond);
    TACInstruction instr;

    instr = tac.instruction(cond.getExpression());
    Assert.assertTrue(instr != null);
    Assert.assertTrue(instr instanceof BinaryOperation);
   
    instr = tac.instruction(cond.getThenExpression());
    Assert.assertTrue(instr != null);
    Assert.assertTrue(instr instanceof LoadLiteralInstruction);
    Assert.assertEquals(r, ((LoadLiteralInstruction) instr).getTarget());
    Assert.assertEquals("1", ((LoadLiteralInstruction) instr).getLiteral());
   
    instr = tac.instruction(cond.getElseExpression());
    Assert.assertTrue(instr != null);
    Assert.assertTrue(instr instanceof MethodCallInstruction);
    Assert.assertEquals(r, ((MethodCallInstruction) instr).getTarget());

    Assert.assertEquals(r, tac.variable(cond.getThenExpression()));
    Assert.assertEquals(r, tac.variable(cond.getElseExpression()));
  }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.ConditionalExpression

      }
      break;
    }

    case ASTNode.CONDITIONAL_EXPRESSION: {
      final ConditionalExpression ce = (ConditionalExpression) node;
      this.processExpression(ce);
      break;
    }

    case ASTNode.METHOD_DECLARATION: {
View Full Code Here

Examples of org.eclipse.jdt.core.dom.ConditionalExpression

                .getOperator(), node);
      break;
    }

    case ASTNode.CONDITIONAL_EXPRESSION: {
      final ConditionalExpression ce = (ConditionalExpression) node;
      this.processExpression(ce.getThenExpression());
      this.processExpression(ce.getElseExpression());
      break;
    }

    case ASTNode.FIELD_ACCESS: {
      final FieldAccess fieldAccess = (FieldAccess) node;
View Full Code Here

Examples of org.eclipse.jdt.core.dom.ConditionalExpression

        castRet.setExpression(cloneInvoke);
        Type retType = (Type) ASTNode.copySubtree(castRet.getAST(), method.getReturnType2());
        castRet.setType(retType);


        ConditionalExpression conditionalExpression = workingUnit.getAST().newConditionalExpression();
        conditionalExpression.setElseExpression(castRet);
        conditionalExpression.setThenExpression(workingUnit.getAST().newNullLiteral() );

        InfixExpression nullTest = workingUnit.getAST().newInfixExpression();
        nullTest.setOperator(InfixExpression.Operator.EQUALS);
        nullTest.setRightOperand(workingUnit.getAST().newNullLiteral());
        Expression initialLoad = (SimpleName) ASTNode.copySubtree(cloneInvoke.getAST(), original);
        nullTest.setLeftOperand(initialLoad);

        conditionalExpression.setExpression(nullTest);

        rewrite.replace(original, conditionalExpression, null);

    }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.ConditionalExpression

      }
      //we do not go into qualified names
      if (node.getNodeType() == ASTNode.QUALIFIED_NAME)
        return false;
      if (node.getNodeType() == ASTNode.CONDITIONAL_EXPRESSION) {
        ConditionalExpression cond = (ConditionalExpression) node;
        BooleanEvaluationState<DI> bes = bCondEval.evaluateCondition(state, cond.getExpression());
        state = bes.conditionMet;
        cond.getThenExpression().accept(this);
        DI thenResult = state;
        state = bes.conditionNotMet;
        cond.getElseExpression().accept(this);
        DI elseResult = state;
        state = thenResult.join(elseResult);
        return false;
      }
      return true;
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.