int result;
if (_value != Integer.MIN_VALUE) {
//See Errata E24
if (_value == 0) return "0";
else if (Double.isNaN(_value)) return "NaN";
else if (_value < 0 && Double.isInfinite(_value)) return "-Infinity";
else if (Double.isInfinite(_value)) return "Infinity";
else return formatNumbers((int)_value);
}
else {
int next = _node;
final int root = _document.getDocument();
result = 0;
while (next >= root && !matchesFrom(next)) {
if (matchesCount(next)) {
++result;
}
next--;
//%HZ%: Is this the best way of finding the root? Is it better to check
//%HZ%: parent(next)?
/*
if (next == root) {
break;
}
else {
--next;
}
*/
}
}
return formatNumbers(result);