Examples of integerValue()


Examples of com.alibaba.fastjson.parser.JSONScanner.integerValue()

    public void ftest_parse_long_1() throws Exception {
        System.out.println(System.currentTimeMillis());
        JSONScanner lexer = new JSONScanner(Long.toString(Long.MAX_VALUE));
        lexer.scanNumber();
        Assert.assertEquals(new Long(Long.MAX_VALUE), (Long) lexer.integerValue());
        Assert.assertEquals(Long.MAX_VALUE, lexer.longValue());
    }

    public void test_parse_long_2() throws Exception {
        System.out.println(System.currentTimeMillis());
View Full Code Here

Examples of com.alibaba.fastjson.parser.JSONScanner.integerValue()

    public void test_parse_long_2() throws Exception {
        System.out.println(System.currentTimeMillis());
        JSONScanner lexer = new JSONScanner(Long.toString(Long.MIN_VALUE));
        lexer.scanNumber();
        Assert.assertEquals(new Long(Long.MIN_VALUE), (Long) lexer.integerValue());
        Assert.assertEquals(Long.MIN_VALUE, lexer.longValue());
    }

    public void test_error_0() {
        Exception error = null;
View Full Code Here

Examples of com.alibaba.fastjson.parser.JSONScanner.integerValue()

    public void ftest_parse_long() throws Exception {
        System.out.println(System.currentTimeMillis());
        JSONScanner lexer = new JSONScanner("1293770846476");
        lexer.scanNumber();
        Assert.assertEquals(new Long(1293770846476L), (Long) lexer.integerValue());
        Assert.assertEquals(1293770846476L, lexer.longValue());
    }

    public void ftest_parse_long_1() throws Exception {
        System.out.println(System.currentTimeMillis());
View Full Code Here

Examples of com.alibaba.fastjson.parser.JSONScanner.integerValue()

    public void test_for_issue() throws Exception {
        JSONScanner lexer = new JSONScanner("-100S");
        lexer.resetStringPosition();
        lexer.scanNumber();
        Assert.assertEquals(Short.class, lexer.integerValue().getClass());
        Assert.assertEquals(-100, lexer.integerValue().shortValue());
        lexer.close();
    }
}
View Full Code Here

Examples of com.alibaba.fastjson.parser.JSONScanner.integerValue()

    public void test_for_issue() throws Exception {
        JSONScanner lexer = new JSONScanner("-100S");
        lexer.resetStringPosition();
        lexer.scanNumber();
        Assert.assertEquals(Short.class, lexer.integerValue().getClass());
        Assert.assertEquals(-100, lexer.integerValue().shortValue());
        lexer.close();
    }
}
View Full Code Here

Examples of com.google.template.soy.data.SoyData.integerValue()

  @Override protected SoyData visitNegativeOpNode(NegativeOpNode node) {

    SoyData operand = visit(node.getChild(0));
    if (operand instanceof IntegerData) {
      return convertResult( - operand.integerValue() );
    } else {
      return convertResult( - operand.floatValue() );
    }
  }
View Full Code Here

Examples of com.google.template.soy.data.SoyData.integerValue()

  @Override protected SoyData visitTimesOpNode(TimesOpNode node) {

    SoyData operand0 = visit(node.getChild(0));
    SoyData operand1 = visit(node.getChild(1));
    if (operand0 instanceof IntegerData && operand1 instanceof IntegerData) {
      return convertResult(operand0.integerValue() * operand1.integerValue());
    } else {
      return convertResult(operand0.numberValue() * operand1.numberValue());
    }
  }

View Full Code Here

Examples of com.google.template.soy.data.SoyData.integerValue()

  @Override protected SoyData visitModOpNode(ModOpNode node) {

    SoyData operand0 = visit(node.getChild(0));
    SoyData operand1 = visit(node.getChild(1));
    return convertResult(operand0.integerValue() % operand1.integerValue());
  }


  @Override protected SoyData visitPlusOpNode(PlusOpNode node) {
View Full Code Here

Examples of com.google.template.soy.data.SoyData.integerValue()

  @Override protected SoyData visitPlusOpNode(PlusOpNode node) {

    SoyData operand0 = visit(node.getChild(0));
    SoyData operand1 = visit(node.getChild(1));
    if (operand0 instanceof IntegerData && operand1 instanceof IntegerData) {
      return convertResult(operand0.integerValue() + operand1.integerValue());
    } else if (operand0 instanceof StringData || operand1 instanceof StringData) {
      // String concatenation. Note we're calling toString() instead of stringValue() in case one
      // of the operands needs to be coerced to a string.
      return convertResult(operand0.toString() + operand1.toString());
    } else {
View Full Code Here

Examples of com.google.template.soy.data.SoyData.integerValue()

  @Override protected SoyData visitMinusOpNode(MinusOpNode node) {

    SoyData operand0 = visit(node.getChild(0));
    SoyData operand1 = visit(node.getChild(1));
    if (operand0 instanceof IntegerData && operand1 instanceof IntegerData) {
      return convertResult(operand0.integerValue() - operand1.integerValue());
    } else {
      return convertResult(operand0.numberValue() - operand1.numberValue());
    }
  }
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.