/** * The number of nodes in the list. The range of valid child node indices * is 0 to <code>length-1</code> inclusive. */ public int getLength() { return (m_iter != null) ? m_iter.getLength() : 0; } }
/** * The number of nodes in the list. The range of valid child node indices * is 0 to <code>length-1</code> inclusive. */ public int getLength() { return (m_iter != null) ? m_iter.getLength() : 0; } }
/** * Create a new NodeSequence from a (already cloned) iterator. * * @param nodeVector */ public NodeSequence(Object nodeVector) { super(nodeVector); if (nodeVector instanceof NodeVector) { SetVector((NodeVector) nodeVector); } if(null != nodeVector) { assertion(nodeVector instanceof NodeVector, "Must have a NodeVector as the object for NodeSequence!"); if(nodeVector instanceof DTMIterator) { setIter((DTMIterator)nodeVector); m_last = ((DTMIterator)nodeVector).getLength(); } } }
int n = v.getLength();
int n = v.getLength();
/** * Create a new NodeSequence from a (already cloned) iterator. * * @param nodeVector */ public NodeSequence(Object nodeVector) { super(nodeVector); if (nodeVector instanceof NodeVector) { SetVector((NodeVector) nodeVector); } if(null != nodeVector) { assertion(nodeVector instanceof NodeVector, "Must have a NodeVector as the object for NodeSequence!"); if(nodeVector instanceof DTMIterator) { setIter((DTMIterator)nodeVector); m_last = ((DTMIterator)nodeVector).getLength(); } } }
/** * Get the position in the current context node list. * * @param xctxt non-null reference to XPath runtime context. * * @return The number of nodes in the list. * * @throws javax.xml.transform.TransformerException */ public int getCountOfContextNodeList(XPathContext xctxt) throws javax.xml.transform.TransformerException { // assert(null != m_contextNodeList, "m_contextNodeList must be non-null"); // If we're in a predicate, then this will return non-null. SubContextList iter = m_isTopLevel ? null : xctxt.getSubContextList(); // System.out.println("iter: "+iter); if (null != iter) return iter.getLastPos(xctxt); DTMIterator cnl = xctxt.getContextNodeList(); int count; if(null != cnl) { count = cnl.getLength(); // System.out.println("count: "+count); } else count = 0; return count; }
/** * Get the position in the current context node list. * * @param xctxt non-null reference to XPath runtime context. * * @return The number of nodes in the list. * * @throws javax.xml.transform.TransformerException */ public int getCountOfContextNodeList(XPathContext xctxt) throws javax.xml.transform.TransformerException { // assert(null != m_contextNodeList, "m_contextNodeList must be non-null"); // If we're in a predicate, then this will return non-null. SubContextList iter = m_isTopLevel ? null : xctxt.getSubContextList(); // System.out.println("iter: "+iter); if (null != iter) return iter.getLastPos(xctxt); DTMIterator cnl = xctxt.getContextNodeList(); int count; if(null != cnl) { count = cnl.getLength(); // System.out.println("count: "+count); } else count = 0; return count; }
/** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { // DTMIterator nl = m_arg0.asIterator(xctxt, xctxt.getCurrentNode()); // // We should probably make a function on the iterator for this, // // as a given implementation could optimize. // int i = 0; // // while (DTM.NULL != nl.nextNode()) // { // i++; // } // nl.detach(); DTMIterator nl = m_arg0.asIterator(xctxt, xctxt.getCurrentNode()); int i = nl.getLength(); nl.detach(); return new XNumber((double) i); } }
/** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { // DTMIterator nl = m_arg0.asIterator(xctxt, xctxt.getCurrentNode()); // // We should probably make a function on the iterator for this, // // as a given implementation could optimize. // int i = 0; // // while (DTM.NULL != nl.nextNode()) // { // i++; // } // nl.detach(); DTMIterator nl = m_arg0.asIterator(xctxt, xctxt.getCurrentNode()); int i = nl.getLength(); nl.detach(); return new XNumber((double) i); } }
/** * The number of nodes in the list. The range of valid child node indices * is 0 to <code>length-1</code> inclusive. */ public int getLength() { return (m_iter != null) ? m_iter.getLength() : 0; } }
/** * The number of nodes in the list. The range of valid child node indices * is 0 to <code>length-1</code> inclusive. */ public int getLength() { return (m_iter != null) ? m_iter.getLength() : 0; } }
/** * The number of nodes in the list. The range of valid child node indices * is 0 to <code>length-1</code> inclusive. */ public int getLength() { return (m_iter != null) ? m_iter.getLength() : 0; } }
/** * The number of nodes in the list. The range of valid child node indices * is 0 to <code>length-1</code> inclusive. */ public int getLength() { return (m_iter != null) ? m_iter.getLength() : 0; } }
/** * The number of nodes in the list. The range of valid child node indices * is 0 to <code>length-1</code> inclusive. */ public int getLength() { return (m_iter != null) ? m_iter.getLength() : 0; } }
/** * The number of nodes in the list. The range of valid child node indices * is 0 to <code>length-1</code> inclusive. */ public int getLength() { return (m_iter != null) ? m_iter.getLength() : 0; } }
@Override protected boolean hasNext() throws JspTagException { DTMIterator iterator = context.getContextNodeList(); return iterator.getCurrentPos() < iterator.getLength(); }
@Override protected boolean hasNext() throws JspTagException { DTMIterator iterator = context.getContextNodeList(); return iterator.getCurrentPos() < iterator.getLength(); }