/** * Compare two strings for less than or equal. * * * @param s1 First string to compare * @param s2 Second String to compare * * @return true if s1 is less than or equal to s2 */ boolean compareStrings(XMLString s1, XMLString s2) { return (s1.toDouble() <= s2.toDouble()); // return s1.compareTo(s2) <= 0; }
/** * Compare two strings for greater than or equal. * * * @param s1 First string to compare * @param s2 Second String to compare * * @return true if s1 is greater than or equal to s2 */ boolean compareStrings(XMLString s1, XMLString s2) { return (s1.toDouble() >= s2.toDouble()); // return s1.compareTo(s2) >= 0; }
/** * Compare two strings for less than or equal. * * * @param s1 First string to compare * @param s2 Second String to compare * * @return true if s1 is less than or equal to s2 */ boolean compareStrings(XMLString s1, XMLString s2) { return (s1.toDouble() <= s2.toDouble()); // return s1.compareTo(s2) <= 0; }
/** * Compare two strings for greater than or equal. * * * @param s1 First string to compare * @param s2 Second String to compare * * @return true if s1 is greater than or equal to s2 */ boolean compareStrings(XMLString s1, XMLString s2) { return (s1.toDouble() >= s2.toDouble()); // return s1.compareTo(s2) >= 0; }
/** * Cast result object to a number. * * @return The result tree fragment as a number or NaN */ public double num() throws javax.xml.transform.TransformerException { XMLString s = xstr(); return s.toDouble(); }
/** * Cast result object to a number. * * @return The result tree fragment as a number or NaN */ public double num() throws javax.xml.transform.TransformerException { XMLString s = xstr(); return s.toDouble(); }
/** * Get numeric value of the string conversion from a single node. * * @param n Node to convert * * @return numeric value of the string conversion from a single node. */ public double getNumberFromNode(int n) { XMLString xstr = m_dtmMgr.getDTM(n).getStringValue(n); return xstr.toDouble(); }
/** * Get numeric value of the string conversion from a single node. * * @param n Node to convert * * @return numeric value of the string conversion from a single node. */ public double getNumberFromNode(int n) { XMLString xstr = m_dtmMgr.getDTM(n).getStringValue(n); return xstr.toDouble(); }
return str.toDouble();
return str.toDouble();
/** * 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 nodes = m_arg0.asIterator(xctxt, xctxt.getCurrentNode()); double sum = 0.0; int pos; while (DTM.NULL != (pos = nodes.nextNode())) { DTM dtm = nodes.getDTM(pos); XMLString s = dtm.getStringValue(pos); if (null != s) sum += s.toDouble(); } nodes.detach(); return new XNumber(sum); } }
/** * 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 nodes = m_arg0.asIterator(xctxt, xctxt.getCurrentNode()); double sum = 0.0; int pos; while (DTM.NULL != (pos = nodes.nextNode())) { DTM dtm = nodes.getDTM(pos); XMLString s = dtm.getStringValue(pos); if (null != s) sum += s.toDouble(); } nodes.detach(); return new XNumber(sum); } }
/** * Cast result object to a number. * * @return The result tree fragment as a number or NaN */ public double num() throws javax.xml.transform.TransformerException { XMLString s = xstr(); return s.toDouble(); }
/** * Cast result object to a number. * * @return The result tree fragment as a number or NaN */ public double num() throws javax.xml.transform.TransformerException { XMLString s = xstr(); return s.toDouble(); }
/** * Get numeric value of the string conversion from a single node. * * @param n Node to convert * * @return numeric value of the string conversion from a single node. */ public double getNumberFromNode(int n) { XMLString xstr = m_dtmMgr.getDTM(n).getStringValue(n); return xstr.toDouble(); }
/** * Get numeric value of the string conversion from a single node. * * @param n Node to convert * * @return numeric value of the string conversion from a single node. */ public double getNumberFromNode(int n) { XMLString xstr = m_dtmMgr.getDTM(n).getStringValue(n); return xstr.toDouble(); }