Example usage for org.apache.commons.jxpath.ri EvalContext hasNext

List of usage examples for org.apache.commons.jxpath.ri EvalContext hasNext

Introduction

In this page you can find the example usage for org.apache.commons.jxpath.ri EvalContext hasNext.

Prototype

public boolean hasNext() 

Source Link

Document

Returns true if there are mode nodes matching the context's constraints.

Usage

From source file:org.openvpms.component.system.common.jxpath.OpenVPMSCoreFunction.java

@Override
protected Object functionSum(EvalContext context) {
    Object v = getArg1().compute(context);
    if (v == null) {
        return ZERO;
    } else if (v instanceof EvalContext) {
        BigDecimal sum = new BigDecimal(0.0);
        EvalContext ctx = (EvalContext) v;
        while (ctx.hasNext()) {
            NodePointer ptr = (NodePointer) ctx.next();
            sum = sum.add(TypeConversionUtil.bigDecimalValue(ptr));
        }/*from www  . j  ava  2s.  co m*/
        return sum;
    }
    throw new JXPathException("Invalid argument type for 'sum': " + v.getClass().getName());
}