Search in sources :

Example 1 with PIType

use of org.eclipse.wst.xml.xpath2.processor.internal.types.PIType in project webtools.sourceediting by eclipse.

the class DefaultEvaluator method visit.

/**
 * visit PI test.
 *
 * @param e
 *            is the PI test.
 * @return a argument
 */
public Object visit(PITest e) {
    ResultSequence arg = (ResultSequence) ((Pair) _param)._two;
    String pit_arg = e.arg();
    // match any pi
    if (pit_arg == null)
        return kind_test(arg, PIType.class);
    ResultBuffer rb = new ResultBuffer();
    for (Iterator i = arg.iterator(); i.hasNext(); ) {
        AnyType item = (AnyType) i.next();
        // match PI
        if (item instanceof PIType) {
            PIType pi = (PIType) item;
            // match target
            if (pit_arg.equals(pi.value().getTarget()))
                rb.add(pi);
        }
    }
    arg = rb.getSequence();
    ((Pair) _param)._two = arg;
    return arg;
}
Also used : PIType(org.eclipse.wst.xml.xpath2.processor.internal.types.PIType) ResultBuffer(org.eclipse.wst.xml.xpath2.api.ResultBuffer) ResultSequence(org.eclipse.wst.xml.xpath2.api.ResultSequence) ListIterator(java.util.ListIterator) Iterator(java.util.Iterator) AnyType(org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType)

Aggregations

Iterator (java.util.Iterator)1 ListIterator (java.util.ListIterator)1 ResultBuffer (org.eclipse.wst.xml.xpath2.api.ResultBuffer)1 ResultSequence (org.eclipse.wst.xml.xpath2.api.ResultSequence)1 AnyType (org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType)1 PIType (org.eclipse.wst.xml.xpath2.processor.internal.types.PIType)1