Examples of IfExpression


Examples of com.facebook.presto.sql.tree.IfExpression

        throw new SemanticException(NOT_SUPPORTED, node, "USE statement is not supported");
    }

    private static SelectItem aliasedYesNoToBoolean(String column, String alias)
    {
        Expression expression = new IfExpression(
                equal(nameReference(column), new StringLiteral("YES")),
                BooleanLiteral.TRUE_LITERAL,
                BooleanLiteral.FALSE_LITERAL);
        return new SingleColumn(expression, alias);
    }
View Full Code Here

Examples of com.puppetlabs.geppetto.pp.IfExpression

        if(result == null)
          result = defaultCase(theEObject);
        return result;
      }
      case PPPackage.IF_EXPRESSION: {
        IfExpression ifExpression = (IfExpression) theEObject;
        T result = caseIfExpression(ifExpression);
        if(result == null)
          result = caseExpression(ifExpression);
        if(result == null)
          result = defaultCase(theEObject);
View Full Code Here

Examples of org.apache.drill.common.expression.IfExpression

                    .setElse(new ValueExpressions.LongExpression(1L, ExpressionPosition.UNKNOWN)).build()) //
        ) //
        .setElse(new ValueExpressions.LongExpression(1L, ExpressionPosition.UNKNOWN)).build();
    LogicalExpression newExpr = ExpressionTreeMaterializer.materialize(expr, batch, ec);
    assertTrue(newExpr instanceof IfExpression);
    IfExpression newIfExpr = (IfExpression) newExpr;
    assertEquals(1, newIfExpr.conditions.size());
    IfExpression.IfCondition ifCondition = newIfExpr.conditions.get(0);
    assertTrue(ifCondition.expression instanceof IfExpression);
    newIfExpr = (IfExpression) ifCondition.expression;
    assertEquals(1, newIfExpr.conditions.size());
View Full Code Here

Examples of org.apache.drill.common.expression.IfExpression

        .setIfCondition(new IfExpression.IfCondition(new FieldReference("test", ExpressionPosition.UNKNOWN), new ValueExpressions.LongExpression(2L, ExpressionPosition.UNKNOWN)))
        .setElse(elseExpression).build();

    LogicalExpression newExpr = ExpressionTreeMaterializer.materialize(expr, batch, ec, registry);
    assertTrue(newExpr instanceof IfExpression);
    IfExpression newIfExpr = (IfExpression) newExpr;
    //assertEquals(1, newIfExpr.conditions.size());
    IfExpression.IfCondition ifCondition = newIfExpr.ifCondition;
    assertTrue(newIfExpr.elseExpression instanceof IfExpression);
    //assertEquals(1, newIfExpr.conditions.size());
    //ifCondition = newIfExpr.conditions.get(0);
View Full Code Here

Examples of org.apache.drill.common.expression.IfExpression

        .setIfCondition(new IfExpression.IfCondition(new FieldReference("test", ExpressionPosition.UNKNOWN), new ValueExpressions.LongExpression(2L, ExpressionPosition.UNKNOWN)))
        .setElse(elseExpression).build();

    LogicalExpression newExpr = ExpressionTreeMaterializer.materialize(expr, batch, ec, registry);
    assertTrue(newExpr instanceof IfExpression);
    IfExpression newIfExpr = (IfExpression) newExpr;
    //assertEquals(1, newIfExpr.conditions.size());
    IfExpression.IfCondition ifCondition = newIfExpr.ifCondition;
    assertTrue(newIfExpr.elseExpression instanceof IfExpression);
    //assertEquals(1, newIfExpr.conditions.size());
    //ifCondition = newIfExpr.conditions.get(0);
View Full Code Here

Examples of prefuse.data.expression.IfExpression

     * @param p the Predicate condition
     * @param val the associated Object value
     */
    public void add(Predicate p, Object val) {
        if ( m_tail == null ) {
            m_tail = new IfExpression(p, new ObjectLiteral(val), m_head);
            m_head = m_tail;
        } else {
            IfExpression ie = new IfExpression(p, new ObjectLiteral(val),
                                               m_tail.getElseExpression());
            m_tail.setElseExpression(ie);
            m_tail = ie;
        }
    }
View Full Code Here

Examples of prefuse.data.expression.IfExpression

     * @return true if a rule was successfully removed, false otherwise
     */
    public boolean remove(Predicate p) {
        if ( p == null ) return false;
       
        IfExpression prev = null;
        Expression expr = m_head;
        while ( expr instanceof IfExpression ) {
            IfExpression ifex = (IfExpression)expr;
            Predicate test = (Predicate)ifex.getTestPredicate();
            if ( p.equals(test) ) {
                Expression elseex = ifex.getElseExpression();
                ifex.setElseExpression(new ObjectLiteral(null));
                if ( prev != null ) {
                    prev.setElseExpression(elseex);
                    if ( ifex == m_tail )
                        m_tail = prev;
                } else {
                    m_head = elseex;
                    if ( ifex == m_tail )
                        m_tail = null;
                }
                return true;
            } else {
                prev = ifex;
                expr = ifex.getElseExpression();
            }
        }
        return false;
    }
View Full Code Here

Examples of prefuse.data.expression.IfExpression

    t = Expression();
    jj_consume_token(ELSE);
    e = Expression();
      if ( !(p instanceof Predicate) )
          {if (true) throw new ParseException("IF-statement test must be a predicate");}
      {if (true) return new IfExpression((Predicate)p, t, e);}
    throw new Error("Missing return statement in function");
  }
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.