Package com.ericsson.otp.erlang

Examples of com.ericsson.otp.erlang.OtpErlangLong.longValue()


    }

    @Override
    public void dump(OtpErlangObject arg, StringBuffer resultHolder) {
      OtpErlangLong longValue = (OtpErlangLong) arg;
      resultHolder.append(longValue.longValue());
    }

    private static enum ParseState {
      PARSE_DOT, PARSE_SECONDNUM, PARSE_E, PARSE_EXP, PARSE_END, PARSE_FINISHED
    }
View Full Code Here


  @Test
  public void testParse5a()
  {
    String text = " 45888888888";
    OtpErlangLong number = (OtpErlangLong)ErlangLabel.parseText(text);
    Assert.assertEquals(45888888888L,number.longValue());
    Assert.assertEquals(text.trim(),ErlangLabel.dumpErlangObject(ErlangRunner.getRunner().evaluateString(text)));
  }
 
  @Test
  public void testParse5b()
View Full Code Here

  @Test
  public void testParse5b()
  {
    String text = " -458";
    OtpErlangLong number = (OtpErlangLong)ErlangLabel.parseText(text);
    Assert.assertEquals(-458L,number.longValue());
    Assert.assertEquals(text.trim(),ErlangLabel.dumpErlangObject(ErlangRunner.getRunner().evaluateString(text)));
  }
 
  @Test
  public void testParse5c()
View Full Code Here

  @Test
  public void testParse5c()
  {
    String text = " +458";
    OtpErlangLong number = (OtpErlangLong)ErlangLabel.parseText(text);
    Assert.assertEquals(458L,number.longValue());
    Assert.assertEquals("458",ErlangLabel.dumpErlangObject(ErlangRunner.getRunner().evaluateString(text)));
  }
 
  @Test
  public void testParse6a()
View Full Code Here

  @Test
  public void testParse5a()
  {
    String text = " 45888888888";
    OtpErlangLong number = (OtpErlangLong)ErlangLabel.parseText(text);
    Assert.assertEquals(45888888888L,number.longValue());
    Assert.assertEquals(text.trim(),ErlangLabel.dumpErlangObject(ErlangRunner.getRunner().evaluateString(text)));
  }
 
  @Test
  public void testParse5b()
View Full Code Here

  @Test
  public void testParse5b()
  {
    String text = " -458";
    OtpErlangLong number = (OtpErlangLong)ErlangLabel.parseText(text);
    Assert.assertEquals(-458L,number.longValue());
    Assert.assertEquals(text.trim(),ErlangLabel.dumpErlangObject(ErlangRunner.getRunner().evaluateString(text)));
  }
 
  @Test
  public void testParse5c()
View Full Code Here

  @Test
  public void testParse5c()
  {
    String text = " +458";
    OtpErlangLong number = (OtpErlangLong)ErlangLabel.parseText(text);
    Assert.assertEquals(458L,number.longValue());
    Assert.assertEquals("458",ErlangLabel.dumpErlangObject(ErlangRunner.getRunner().evaluateString(text)));
  }
 
  @Test
  public void testParse6a()
View Full Code Here

    }

    @Override
    public void dump(OtpErlangObject arg, StringBuffer resultHolder) {
      OtpErlangLong longValue = (OtpErlangLong) arg;
      resultHolder.append(longValue.longValue());
    }

    private static enum ParseState {
      PARSE_DOT, PARSE_SECONDNUM, PARSE_E, PARSE_EXP, PARSE_END, PARSE_FINISHED
    };
View Full Code Here

     *             not supported or the value is too big
     */
    public long longValue() throws ClassCastException {
        final OtpErlangLong longValue = (OtpErlangLong) value;
        if (longValue.isLong()) {
            return longValue.longValue();
        } else {
            throw new ClassCastException("Cannot cast to long - value is too big (use bigIntValue() instead).");
        }
    }

View Full Code Here

            final OtpErlangLong value_int = (OtpErlangLong) value;
            try {
                return value_int.intValue();
            } catch (final OtpErlangRangeException e) {
                if (value_int.isLong()) {
                    return value_int.longValue();
                } else {
                    return value_int.bigIntegerValue();
                }
            }
        } else if (value instanceof OtpErlangDouble) {
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.