Search in sources :

Example 6 with WalkingIterator

use of org.apache.xpath.axes.WalkingIterator in project j2objc by google.

the class RedundentExprEliminator method countSteps.

/**
 * Count the steps in a given location path.
 *
 * @param lpi The location path iterator that owns the steps.
 * @return The number of steps in the given location path.
 */
protected int countSteps(LocPathIterator lpi) {
    if (lpi instanceof WalkingIterator) {
        WalkingIterator wi = (WalkingIterator) lpi;
        AxesWalker aw = wi.getFirstWalker();
        int count = 0;
        while (null != aw) {
            count++;
            aw = aw.getNextWalker();
        }
        return count;
    } else
        return 1;
}
Also used : AxesWalker(org.apache.xpath.axes.AxesWalker) WalkingIterator(org.apache.xpath.axes.WalkingIterator)

Aggregations

WalkingIterator (org.apache.xpath.axes.WalkingIterator)6 AxesWalker (org.apache.xpath.axes.AxesWalker)4 WrappedRuntimeException (org.apache.xml.utils.WrappedRuntimeException)2 ExpressionOwner (org.apache.xpath.ExpressionOwner)2 LocPathIterator (org.apache.xpath.axes.LocPathIterator)2