Examples of IntegerLiteral


Examples of org.codehaus.jparsec.examples.java.ast.expression.IntegerLiteral

    assertEquals(new ScientificNumberLiteral("1e2", NumberType.FLOAT), parser.parse("1e2f"));
    assertEquals("foo", parser.parse("\"foo\""));
    assertEquals('a', parser.parse("'a'"));
    assertEquals(Tokens.reserved("import"), parser.parse("import"));
    assertEquals(new DecimalPointNumberLiteral("1.2", NumberType.DOUBLE), parser.parse("1.2"));
    assertEquals(new IntegerLiteral(Radix.DEC, "1", NumberType.INT), parser.parse("1"));
    assertEquals(new IntegerLiteral(Radix.HEX, "1", NumberType.LONG), parser.parse("0X1L"));
    assertEquals(new IntegerLiteral(Radix.OCT, "1", NumberType.DOUBLE), parser.parse("01D"));
  }
View Full Code Here

Examples of org.codehaus.jparsec.examples.java.ast.expression.IntegerLiteral

  private static DecimalPointNumberLiteral decimal(String number, NumberType type) {
    return new DecimalPointNumberLiteral(number, type);
  }
 
  private static IntegerLiteral integer(Radix radix, String number, NumberType type) {
    return new IntegerLiteral(radix, number, type);
  }
View Full Code Here

Examples of org.codehaus.jparsec.examples.java.ast.expression.IntegerLiteral

    assertResult(parser, "{foo,bar}", ArrayInitializer.class, "{foo, bar}");
    assertResult(parser, "{foo,bar,}", ArrayInitializer.class, "{foo, bar}");
  }

  static IntegerLiteral literal(int i) {
    return new IntegerLiteral(Radix.DEC, Integer.toString(i), NumberType.INT);
  }
View Full Code Here

Examples of org.codehaus.jparsec.examples.java.ast.expression.IntegerLiteral

  private static DecimalPointNumberLiteral decimal(String number, NumberType type) {
    return new DecimalPointNumberLiteral(number, type);
  }
 
  private static IntegerLiteral integer(Radix radix, String number, NumberType type) {
    return new IntegerLiteral(radix, number, type);
  }
View Full Code Here

Examples of org.codehaus.jparsec.examples.java.ast.expression.IntegerLiteral

    assertResult(parser, "{foo,bar}", ArrayInitializer.class, "{foo, bar}");
    assertResult(parser, "{foo,bar,}", ArrayInitializer.class, "{foo, bar}");
  }

  static IntegerLiteral literal(int i) {
    return new IntegerLiteral(Radix.DEC, Integer.toString(i), NumberType.INT);
  }
View Full Code Here

Examples of org.codehaus.jparsec.examples.java.ast.expression.IntegerLiteral

    assertEquals(new ScientificNumberLiteral("1e2", NumberType.FLOAT), parser.parse("1e2f"));
    assertEquals("foo", parser.parse("\"foo\""));
    assertEquals('a', parser.parse("'a'"));
    assertEquals(Tokens.reserved("import"), parser.parse("import"));
    assertEquals(new DecimalPointNumberLiteral("1.2", NumberType.DOUBLE), parser.parse("1.2"));
    assertEquals(new IntegerLiteral(Radix.DEC, "1", NumberType.INT), parser.parse("1"));
    assertEquals(new IntegerLiteral(Radix.HEX, "1", NumberType.LONG), parser.parse("0X1L"));
    assertEquals(new IntegerLiteral(Radix.OCT, "1", NumberType.DOUBLE), parser.parse("01D"));
  }
View Full Code Here

Examples of org.datanucleus.store.mapped.expression.IntegerLiteral

    public ScalarExpression newLiteral(QueryExpression qs, Object value)
    {
        if (datastoreJavaType.equals(ClassNameConstants.JAVA_LANG_INTEGER))
        {
            // Return an IntegerLiteral to represent this Enum, but with the original value present just in case
            ScalarExpression expr = new IntegerLiteral(qs, this, BigInteger.valueOf(((Enum)value).ordinal()));
            ((Literal)expr).setRawValue(value);
            return expr;
        }
        else if (datastoreJavaType.equals(ClassNameConstants.JAVA_LANG_STRING))
        {
View Full Code Here

Examples of org.datanucleus.store.rdbms.sql.expression.IntegerLiteral

                if (vermd.getVersionStrategy() == VersionStrategy.VERSION_NUMBER)
                {
                    // Increment the version
                    SQLTable verSqlTbl = stmt.getTable(verTable, stmt.getPrimaryTable().getGroupName());
                    SQLExpression verExpr = new NumericExpression(stmt, verSqlTbl, verMapping);
                    SQLExpression incrExpr = verExpr.add(new IntegerLiteral(stmt,
                        stmt.getSQLExpressionFactory().getMappingForType(Integer.class, false), new Integer(1), null));

                    updateSqlExpr = verExpr.eq(incrExpr);

                    SQLExpression[] oldArray = updateSqlExprs;
View Full Code Here

Examples of org.datanucleus.store.rdbms.sql.expression.IntegerLiteral

                funcArgs.add(strExpr);
                funcArgs.add(substrExpr);
                NumericExpression locateExpr = new NumericExpression(stmt, getMappingForClass(int.class), "STRPOS", funcArgs);

                SQLExpression[] whenExprs = new SQLExpression[1];
                NumericExpression zeroExpr = new IntegerLiteral(stmt, exprFactory.getMappingForType(Integer.class, false), Integer.valueOf(0), null);
                whenExprs[0] = locateExpr.gt(zeroExpr);

                SQLExpression[] actionExprs = new SQLExpression[1];
                SQLExpression oneExpr = ExpressionUtils.getLiteralForOne(stmt);
                NumericExpression posExpr1 = new NumericExpression(locateExpr, Expression.OP_SUB, oneExpr);
                actionExprs[0] = new NumericExpression(posExpr1, Expression.OP_ADD, fromExpr);

                SQLExpression elseExpr = new IntegerLiteral(stmt, exprFactory.getMappingForType(Integer.class, false), Integer.valueOf(-1), null);

                return new CaseExpression(whenExprs, actionExprs, elseExpr);
            }
        }
    }
View Full Code Here

Examples of org.datanucleus.store.rdbms.sql.expression.IntegerLiteral

    {
        if (expr instanceof StringLiteral)
        {
            JavaTypeMapping m = exprFactory.getMappingForType(int.class, false);
            String val = (String)((StringLiteral)expr).getValue();
            return new IntegerLiteral(stmt, m, Integer.valueOf(val.length()), null);
        }
        else if (expr instanceof StringExpression || expr instanceof ParameterLiteral)
        {
            ArrayList funcArgs = new ArrayList();
            funcArgs.add(expr);
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.