public ComputableValue minus(ComputableValue other) throws XPathException {
switch(other.getType()) {
case Type.DAY_TIME_DURATION: {
if (getType() != other.getType())
{throw new XPathException(ErrorCodes.XPTY0004, "Tried to substract " +
Type.getTypeName(other.getType()) + "('" + other.getStringValue() + "') from " +
Type.getTypeName(getType()) + "('" + getStringValue() + "')");}
final Duration a = getCanonicalDuration();
final Duration b = ((OrderedDurationValue) other).getCanonicalDuration();
final Duration result = createSameKind(a.subtract(b)).getCanonicalDuration();
return new DayTimeDurationValue(result); }
case Type.YEAR_MONTH_DURATION: {
if (getType() != other.getType())
{throw new XPathException(ErrorCodes.XPTY0004, "Tried to substract " +
Type.getTypeName(other.getType()) + "('" + other.getStringValue() + "') from " +
Type.getTypeName(getType()) + "('" + getStringValue() + "')");}
final Duration a = getCanonicalDuration();
final Duration b = ((OrderedDurationValue) other).getCanonicalDuration();
final Duration result = createSameKind(a.subtract(b)).getCanonicalDuration();
return new YearMonthDurationValue(result); }
/*
case Type.TIME:
case Type.DATE_TIME:
case Type.DATE:
AbstractDateTimeValue date = (AbstractDateTimeValue) other;
XMLGregorianCalendar gc = (XMLGregorianCalendar) date.calendar.clone();
gc.substract(duration);
return date.createSameKind(gc);
*/
default:
throw new XPathException("err:XPTY0004: cannot substract " +
Type.getTypeName(other.getType()) + "('" + other.getStringValue() + "') from " +
Type.getTypeName(getType()) + "('" + getStringValue() + "')");
}
/*
if(other.getType() == getType()) {