/** * Computes length for the current pointer - ignores any exceptions. * @return length */ private int getLength() { int length; try { length = propertyNodePointer.getLength(); // TBD: cache length } catch (Throwable t) { // @todo: should this exception be reported in any way? length = 0; } return length; } }
public NodePointer createPath(JXPathContext context, Object value) { // If neccessary, expand collection if (index != WHOLE_COLLECTION && index >= getLength()) { createPath(context); } setValue(value); return this; }
public boolean setPosition(int position) { if (nameTestExpression == null) { return setPositionStandard(position); } else { if (dynamicPropertyPointer == null && !setupDynamicPropertyPointer()) { return setPositionStandard(position); } if (position < 1 || position > dynamicPropertyPointer.getLength()) { return false; } dynamicPropertyPointer.setIndex(position - 1); return true; } }