• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java XBoolean类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.sun.org.apache.xpath.internal.objects.XBoolean的典型用法代码示例。如果您正苦于以下问题:Java XBoolean类的具体用法?Java XBoolean怎么用?Java XBoolean使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



XBoolean类属于com.sun.org.apache.xpath.internal.objects包,在下文中一共展示了XBoolean类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: leapYear

import com.sun.org.apache.xpath.internal.objects.XBoolean; //导入依赖的package包/类
/**
 * The date:leap-year function returns true if the year given in a date
 * is a leap year. If no argument is given, then the current local
 * date/time, as returned by date:date-time is used as a default argument.
 * The date/time string specified as the first argument must be a
 * right-truncated string in the format defined as the lexical representation
 * of xs:dateTime in one of the formats defined in
 * <a href="http://www.w3.org/TR/xmlschema-2/">[XML Schema Part 2: Datatypes]</a>.
 * The permitted formats are as follows:
 *    xs:dateTime (CCYY-MM-DDThh:mm:ss)
 *    xs:date (CCYY-MM-DD)
 *    xs:gYearMonth (CCYY-MM)
 *    xs:gYear (CCYY)
 * If the date/time string is not in one of these formats, then NaN is returned.
 */
public static XObject leapYear(String datetimeIn)
  throws ParseException
{
  String[] edz = getEraDatetimeZone(datetimeIn);
  String datetime = edz[1];
  if (datetime == null)
    return new XNumber(Double.NaN);

  String[] formats = {dt, d, gym, gy};
  double dbl = getNumber(datetime, formats, Calendar.YEAR);
  if (dbl == Double.NaN)
    return new XNumber(Double.NaN);
  int yr = (int)dbl;
  return new XBoolean(yr % 400 == 0 || (yr % 100 != 0 && yr % 4 == 0));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:31,代码来源:ExsltDatetime.java


示例2: execute

import com.sun.org.apache.xpath.internal.objects.XBoolean; //导入依赖的package包/类
/**
 * OR two expressions and return the boolean result. Override
 * superclass method for optimization purposes.
 *
 * @param xctxt The runtime execution context.
 *
 * @return {@link com.sun.org.apache.xpath.internal.objects.XBoolean#S_TRUE} or
 * {@link com.sun.org.apache.xpath.internal.objects.XBoolean#S_FALSE}.
 *
 * @throws javax.xml.transform.TransformerException
 */
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
{

  XObject expr1 = m_left.execute(xctxt);

  if (!expr1.bool())
  {
    XObject expr2 = m_right.execute(xctxt);

    return expr2.bool() ? XBoolean.S_TRUE : XBoolean.S_FALSE;
  }
  else
    return XBoolean.S_TRUE;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:Or.java


示例3: execute

import com.sun.org.apache.xpath.internal.objects.XBoolean; //导入依赖的package包/类
/**
 * AND two expressions and return the boolean result. Override
 * superclass method for optimization purposes.
 *
 * @param xctxt The runtime execution context.
 *
 * @return {@link com.sun.org.apache.xpath.internal.objects.XBoolean#S_TRUE} or
 * {@link com.sun.org.apache.xpath.internal.objects.XBoolean#S_FALSE}.
 *
 * @throws javax.xml.transform.TransformerException
 */
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
{

  XObject expr1 = m_left.execute(xctxt);

  if (expr1.bool())
  {
    XObject expr2 = m_right.execute(xctxt);

    return expr2.bool() ? XBoolean.S_TRUE : XBoolean.S_FALSE;
  }
  else
    return XBoolean.S_FALSE;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:And.java


示例4: execute

import com.sun.org.apache.xpath.internal.objects.XBoolean; //导入依赖的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
{

  String lang = m_arg0.execute(xctxt).str();
  int parent = xctxt.getCurrentNode();
  boolean isLang = false;
  DTM dtm = xctxt.getDTM(parent);

  while (DTM.NULL != parent)
  {
    if (DTM.ELEMENT_NODE == dtm.getNodeType(parent))
    {
      int langAttr = dtm.getAttributeNode(parent, "http://www.w3.org/XML/1998/namespace", "lang");

      if (DTM.NULL != langAttr)
      {
        String langVal = dtm.getNodeValue(langAttr);
        // %OPT%
        if (langVal.toLowerCase().startsWith(lang.toLowerCase()))
        {
          int valLen = lang.length();

          if ((langVal.length() == valLen)
                  || (langVal.charAt(valLen) == '-'))
          {
            isLang = true;
          }
        }

        break;
      }
    }

    parent = dtm.getParent(parent);
  }

  return isLang ? XBoolean.S_TRUE : XBoolean.S_FALSE;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:47,代码来源:FuncLang.java


示例5: execute

import com.sun.org.apache.xpath.internal.objects.XBoolean; //导入依赖的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
{

  String s1 = m_arg0.execute(xctxt).str();
  String s2 = m_arg1.execute(xctxt).str();

  // Add this check for JDK consistency for empty strings.
  if (s1.length() == 0 && s2.length() == 0)
    return XBoolean.S_TRUE;

  int index = s1.indexOf(s2);

  return (index > -1) ? XBoolean.S_TRUE : XBoolean.S_FALSE;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:FuncContains.java


示例6: nodeset

import com.sun.org.apache.xpath.internal.objects.XBoolean; //导入依赖的package包/类
/**
 * This method is an extension that implements as a Xalan extension
 * the node-set function also found in xt and saxon.
 * If the argument is a Result Tree Fragment, then <code>nodeset</code>
 * returns a node-set consisting of a single root node as described in
 * section 11.1 of the XSLT 1.0 Recommendation.  If the argument is a
 * node-set, <code>nodeset</code> returns a node-set.  If the argument
 * is a string, number, or boolean, then <code>nodeset</code> returns
 * a node-set consisting of a single root node with a single text node
 * child that is the result of calling the XPath string() function on the
 * passed parameter.  If the argument is anything else, then a node-set
 * is returned consisting of a single root node with a single text node
 * child that is the result of calling the java <code>toString()</code>
 * method on the passed argument.
 * Most of the
 * actual work here is done in <code>MethodResolver</code> and
 * <code>XRTreeFrag</code>.
 * @param myProcessor Context passed by the extension processor
 * @param rtf Argument in the stylesheet to the nodeset extension function
 *
 * NEEDSDOC ($objectName$) @return
 */
public static NodeSet nodeset(ExpressionContext myProcessor, Object rtf)
{

  String textNodeValue;

  if (rtf instanceof NodeIterator)
  {
    return new NodeSet((NodeIterator) rtf);
  }
  else
  {
    if (rtf instanceof String)
    {
      textNodeValue = (String) rtf;
    }
    else if (rtf instanceof Boolean)
    {
      textNodeValue = new XBoolean(((Boolean) rtf).booleanValue()).str();
    }
    else if (rtf instanceof Double)
    {
      textNodeValue = new XNumber(((Double) rtf).doubleValue()).str();
    }
    else
    {
      textNodeValue = rtf.toString();
    }

    // This no longer will work right since the DTM.
    // Document myDoc = myProcessor.getContextNode().getOwnerDocument();
    Document myDoc = getDocument();

      Text textNode = myDoc.createTextNode(textNodeValue);
      DocumentFragment docFrag = myDoc.createDocumentFragment();

      docFrag.appendChild(textNode);

    return new NodeSet(docFrag);
  }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:63,代码来源:Extensions.java


示例7: execute

import com.sun.org.apache.xpath.internal.objects.XBoolean; //导入依赖的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
{

  String prefix;
  String namespace;
  String methName;

  String fullName = m_arg0.execute(xctxt).str();
  int indexOfNSSep = fullName.indexOf(':');

  if (indexOfNSSep < 0)
  {
    prefix = "";
    namespace = Constants.S_XSLNAMESPACEURL;
    methName = fullName;
  }
  else
  {
    prefix = fullName.substring(0, indexOfNSSep);
    namespace = xctxt.getNamespaceContext().getNamespaceForPrefix(prefix);
    if (null == namespace)
      return XBoolean.S_FALSE;
    methName= fullName.substring(indexOfNSSep + 1);
  }

  if (namespace.equals(Constants.S_XSLNAMESPACEURL)
  ||  namespace.equals(Constants.S_BUILTIN_EXTENSIONS_URL)) {

      // J2SE does not support Xalan interpretive
      /*
    try {
      TransformerImpl transformer = (TransformerImpl) xctxt.getOwnerObject();
      return transformer.getStylesheet().getAvailableElements().containsKey(
                                                          new QName(namespace, methName))
             ? XBoolean.S_TRUE : XBoolean.S_FALSE;
    } catch (Exception e) {
      return XBoolean.S_FALSE;
    }
    */
      return XBoolean.S_FALSE;
  } else {
    //dml
    ExtensionsProvider extProvider = (ExtensionsProvider)xctxt.getOwnerObject();
    return extProvider.elementAvailable(namespace, methName)
           ? XBoolean.S_TRUE : XBoolean.S_FALSE;
  }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:56,代码来源:FuncExtElementAvailable.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java KeyMaterial类代码示例发布时间:2022-05-23
下一篇:
Java DERGeneralString类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap