Example usage for org.apache.commons.jxpath.ri.model NodePointer WHOLE_COLLECTION

List of usage examples for org.apache.commons.jxpath.ri.model NodePointer WHOLE_COLLECTION

Introduction

In this page you can find the example usage for org.apache.commons.jxpath.ri.model NodePointer WHOLE_COLLECTION.

Prototype

int WHOLE_COLLECTION

To view the source code for org.apache.commons.jxpath.ri.model NodePointer WHOLE_COLLECTION.

Click Source Link

Document

Whole collection index.

Usage

From source file:org.eclipse.e4.emf.internal.xpath.EStructuralFeatureIterator.java

/**
 * Create a new PropertyIterator./*  w ww .ja  va  2  s. c o  m*/
 * @param pointer owning pointer
 * @param name property name
 * @param reverse iteration order
 * @param startWith beginning pointer
 */
public EStructuralFeatureIterator(EStructuralFeatureOwnerPointer pointer, String name, boolean reverse,
        NodePointer startWith) {
    propertyNodePointer = (EStructuralFeaturePointer) pointer.getPropertyPointer().clone();
    this.name = name;
    this.reverse = reverse;
    this.includeStart = true;
    if (reverse) {
        this.startPropertyIndex = EStructuralFeaturePointer.UNSPECIFIED_PROPERTY;
        this.startIndex = -1;
    }
    if (startWith != null) {
        while (startWith != null && startWith.getImmediateParentPointer() != pointer) {
            startWith = startWith.getImmediateParentPointer();
        }
        if (startWith == null) {
            throw new JXPathException(
                    "PropertyIerator startWith parameter is " + "not a child of the supplied parent");
        }
        this.startPropertyIndex = ((EStructuralFeaturePointer) startWith).getPropertyIndex();
        this.startIndex = startWith.getIndex();
        if (this.startIndex == NodePointer.WHOLE_COLLECTION) {
            this.startIndex = 0;
        }
        this.includeStart = false;
        if (reverse && startIndex == -1) {
            this.includeStart = true;
        }
    }
}

From source file:org.eclipse.e4.emf.internal.xpath.EStructuralFeatureIterator.java

/**
 * Prepare for an individual property.//from   w  w w  .  ja  v a 2  s.c  o  m
 * @param name property name
 */
protected void prepareForIndividualProperty(String name) {
    targetReady = true;
    empty = true;

    String[] names = propertyNodePointer.getPropertyNames();
    if (!reverse) {
        if (startPropertyIndex == EStructuralFeaturePointer.UNSPECIFIED_PROPERTY) {
            startPropertyIndex = 0;
        }
        if (startIndex == NodePointer.WHOLE_COLLECTION) {
            startIndex = 0;
        }
        for (int i = startPropertyIndex; i < names.length; i++) {
            if (names[i].equals(name)) {
                propertyNodePointer.setPropertyIndex(i);
                if (i != startPropertyIndex) {
                    startIndex = 0;
                    includeStart = true;
                }
                empty = false;
                break;
            }
        }
    } else {
        if (startPropertyIndex == EStructuralFeaturePointer.UNSPECIFIED_PROPERTY) {
            startPropertyIndex = names.length - 1;
        }
        if (startIndex == NodePointer.WHOLE_COLLECTION) {
            startIndex = -1;
        }
        for (int i = startPropertyIndex; i >= 0; i--) {
            if (names[i].equals(name)) {
                propertyNodePointer.setPropertyIndex(i);
                if (i != startPropertyIndex) {
                    startIndex = -1;
                    includeStart = true;
                }
                empty = false;
                break;
            }
        }
    }
}