@Override public void operateYMDurationDouble(IntegerPointable intp, DoublePointable doublep, DataOutput dOut) throws SystemException, IOException { int value = intp.intValue(); value -= doublep.intValue(); dOut.write(ValueTag.XS_YEAR_MONTH_DURATION_TAG); dOut.writeInt(value); }
@Override public void operateDoubleYMDuration(DoublePointable doublep, IntegerPointable intp, DataOutput dOut) throws SystemException, IOException { int value = doublep.intValue(); value += intp.intValue(); dOut.write(ValueTag.XS_YEAR_MONTH_DURATION_TAG); dOut.writeInt(value); }
@Override public void operateDoubleYMDuration(DoublePointable doublep, IntegerPointable intp, DataOutput dOut) throws SystemException, IOException { int value = doublep.intValue(); value -= intp.intValue(); dOut.write(ValueTag.XS_YEAR_MONTH_DURATION_TAG); dOut.writeInt(value); }
@Override public void operateDoubleYMDuration(DoublePointable doublep, IntegerPointable intp, DataOutput dOut) throws SystemException, IOException { int value = doublep.intValue(); value *= intp.intValue(); dOut.write(ValueTag.XS_YEAR_MONTH_DURATION_TAG); dOut.writeInt(value); }
@Override public void operateDoubleDTDuration(DoublePointable doublep, LongPointable longp, DataOutput dOut) throws SystemException, IOException { long value = doublep.intValue(); value -= longp.intValue(); dOut.write(ValueTag.XS_DAY_TIME_DURATION_TAG); dOut.writeLong(value); }
@Override public void convertDouble(DoublePointable doublep, DataOutput dOut) throws SystemException, IOException { double doubleValue = doublep.getDouble(); if (Double.isInfinite(doubleValue) || Double.isNaN(doubleValue)) { throw new SystemException(ErrorCode.FOCA0002); } if (doubleValue > Integer.MAX_VALUE || doubleValue < Integer.MIN_VALUE) { throw new SystemException(ErrorCode.FOCA0003); } if (doublep.byteValue() < 0 && !negativeAllowed) { throw new SystemException(ErrorCode.FORG0001); } dOut.write(returnTag); dOut.writeInt(doublep.intValue()); }
protected static int getIntParameter(final TaggedValuePointable tvp, final DoublePointable doublep, final LongPointable longp) throws SystemException { switch (tvp.getTag()) { case ValueTag.XS_INTEGER_TAG: tvp.getValue(longp); return longp.intValue(); case ValueTag.XS_DOUBLE_TAG: tvp.getValue(doublep); // TODO Double needs to be rounded return doublep.intValue(); default: throw new SystemException(ErrorCode.FORG0006); } }