static class absBI extends BuiltInForNumber {
TemplateModel calculateResult(Number num, TemplateModel model) throws TemplateModelException {
if (num instanceof Integer) {
int n = ((Integer) num).intValue();
if (n < 0) {
return new SimpleNumber(-n);
} else {
return model;
}
} else if (num instanceof BigDecimal) {
BigDecimal n = (BigDecimal) num;
if (n.signum() < 0) {
return new SimpleNumber(n.negate());
} else {
return model;
}
} else if (num instanceof Double) {
double n = ((Double) num).doubleValue();
if (n < 0) {
return new SimpleNumber(-n);
} else {
return model;
}
} else if (num instanceof Float) {
float n = ((Float) num).floatValue();
if (n < 0) {
return new SimpleNumber(-n);
} else {
return model;
}
} else if (num instanceof Long) {
long n = ((Long) num).longValue();
if (n < 0) {
return new SimpleNumber(-n);
} else {
return model;
}
} else if (num instanceof Short) {
short n = ((Short) num).shortValue();
if (n < 0) {
return new SimpleNumber(-n);
} else {
return model;
}
} else if (num instanceof Byte) {
byte n = ((Byte) num).byteValue();
if (n < 0) {
return new SimpleNumber(-n);
} else {
return model;
}
} else if (num instanceof BigInteger) {
BigInteger n = (BigInteger) num;
if (n.signum() < 0) {
return new SimpleNumber(n.negate());
} else {
return model;
}
} else {
throw new _TemplateModelException(new Object[] {