Package org.exist.xquery.value

Examples of org.exist.xquery.value.DecimalValue


            result = new IntegerValue(duration.getPart(DurationValue.HOUR));
      } else if (isCalledAs("minutes-from-duration")) {
            result = new IntegerValue(duration.getPart(DurationValue.MINUTE));
      } else if (isCalledAs("seconds-from-duration")) {
        if (duration.getCanonicalDuration().getField(DatatypeConstants.SECONDS) == null)
          {result = new DecimalValue(0);}
        else
          {result = new DecimalValue((BigDecimal)duration.getCanonicalDuration().getField(DatatypeConstants.SECONDS));}
        if (duration.getCanonicalDuration().getSign() < 0)
          {result = ((DecimalValue)result).negate();}
      } else if (isCalledAs("months-from-duration")) {
            result = new IntegerValue(duration.getPart(DurationValue.MONTH));
      } else if (isCalledAs("years-from-duration")) {
View Full Code Here


    @Test
    public void roundTripDecimal() throws EXistException {
        BigDecimal dec = new BigDecimal("123456789123456789123456789123456789.123456789123456789123456789");

        byte data[] = ValueIndexFactory.serialize(new DecimalValue(dec), 0);

        Indexable value = ValueIndexFactory.deserialize(data, 0, data.length);
        assertTrue(value instanceof DecimalValue);

        assertEquals(dec, ((DecimalValue)value).getValue());
View Full Code Here

        result = new IntegerValue(date.getPart(DateValue.MINUTE),
            Type.INTEGER);
      } else if (isCalledAs("seconds-from-dateTime") || isCalledAs("seconds-from-time")) {
        result = new IntegerValue(date.calendar.getSecond()).convertTo(Type.DECIMAL);
        if (date.calendar.getFractionalSecond() != null)           
          {result = ((DecimalValue)result).plus(new DecimalValue(date.calendar.getFractionalSecond()));}     
      } else if (isCalledAs("timezone-from-dateTime") || isCalledAs("timezone-from-date") || isCalledAs("timezone-from-time")) {
        result = date.getTimezone();
      } else {
                logger.error("can't handle function " + mySignature.getName().getLocalName());
        throw new Error("can't handle function " + mySignature.getName().getLocalName());
View Full Code Here

TOP

Related Classes of org.exist.xquery.value.DecimalValue

Copyright © 2018 www.massapicom. 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.