当前位置: 首页>>代码示例>>Java>>正文


Java XMLString.toDouble方法代码示例

本文整理汇总了Java中com.sun.org.apache.xml.internal.utils.XMLString.toDouble方法的典型用法代码示例。如果您正苦于以下问题:Java XMLString.toDouble方法的具体用法?Java XMLString.toDouble怎么用?Java XMLString.toDouble使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.org.apache.xml.internal.utils.XMLString的用法示例。


在下文中一共展示了XMLString.toDouble方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getArg0AsNumber

import com.sun.org.apache.xml.internal.utils.XMLString; //导入方法依赖的package包/类
/**
 * Execute the first argument expression that is expected to return a
 * number.  If the argument is null, then get the number value from the
 * current context node.
 *
 * @param xctxt Runtime XPath context.
 *
 * @return The number value of the first argument, or the number value of the
 *         current context node if the first argument is null.
 *
 * @throws javax.xml.transform.TransformerException if an error occurs while
 *                                   executing the argument expression.
 */
protected double getArg0AsNumber(XPathContext xctxt)
        throws javax.xml.transform.TransformerException
{

  if(null == m_arg0)
  {
    int currentNode = xctxt.getCurrentNode();
    if(DTM.NULL == currentNode)
      return 0;
    else
    {
      DTM dtm = xctxt.getDTM(currentNode);
      XMLString str = dtm.getStringValue(currentNode);
      return str.toDouble();
    }

  }
  else
    return m_arg0.execute(xctxt).num();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:34,代码来源:FunctionDef1Arg.java

示例2: execute

import com.sun.org.apache.xml.internal.utils.XMLString; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:FuncSum.java

示例3: num

import com.sun.org.apache.xml.internal.utils.XMLString; //导入方法依赖的package包/类
/**
 * 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();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:XRTreeFrag.java

示例4: getNumberFromNode

import com.sun.org.apache.xml.internal.utils.XMLString; //导入方法依赖的package包/类
/**
 * 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();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:XNodeSet.java

示例5: compareStrings

import com.sun.org.apache.xml.internal.utils.XMLString; //导入方法依赖的package包/类
/**
 * Compare two strings for less than.
 *
 *
 * @param s1 First string to compare
 * @param s2 Second String to compare
 *
 * @return True if s1 is less than s2
 */
boolean compareStrings(XMLString s1, XMLString s2)
{
  return (s1.toDouble() < s2.toDouble());
  // return s1.compareTo(s2) < 0;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:XNodeSet.java


注:本文中的com.sun.org.apache.xml.internal.utils.XMLString.toDouble方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。