if (currentElement == null || currentElement == root) return null; return previousItem;
Element previous = null; int stackSize; if (stack != null && (stackSize = stack.size()) > 0) { ElementRef ref = (ElementRef) stack.peek(); Element el = ref.element; int index = ref.index; if (index > 0) { previous = deepestLeaf(el.getElement(--index)); } else if (index == 0) { previous = el; } else if (index == -1) { ElementRef top = (ElementRef) stack.pop(); ElementRef item = (ElementRef) stack.peek(); stack.push(top); index = item.index; el = item.element; previous = index == -1 ? el : deepestLeaf(el.getElement(index)); } } return previous;
  public Element previous()  {    if (currentElement == null || currentElement == root)      return null;    return previousItem;  }