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")) {