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


Java DTM.isNodeAfter方法代码示例

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


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

示例1: getPreviouslyCounted

import org.apache.xml.dtm.DTM; //导入方法依赖的package包/类
/**
 * Try and find a node that was previously counted. If found,
 * return a positive integer that corresponds to the count.
 *
 * @param support The XPath context to use
 * @param node The node to be counted.
 * 
 * @return The count of the node, or -1 if not found.
 */
int getPreviouslyCounted(XPathContext support, int node)
{

  int n = m_countNodes.size();

  m_countResult = 0;

  for (int i = n - 1; i >= 0; i--)
  {
    int countedNode = m_countNodes.elementAt(i);

    if (node == countedNode)
    {

      // Since the list is in backwards order, the count is 
      // how many are in the rest of the list.
      m_countResult = i + 1 + m_countNodesStartCount;

      break;
    }
    
    DTM dtm = support.getDTM(countedNode);

    // Try to see if the given node falls after the counted node...
    // if it does, don't keep searching backwards.
    if (dtm.isNodeAfter(countedNode, node))
      break;
  }

  return m_countResult;
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:41,代码来源:Counter.java

示例2: addNodeInDocOrder

import org.apache.xml.dtm.DTM; //导入方法依赖的package包/类
/**
* Add the node into a vector of nodes where it should occur in
* document order.
* @param node The node to be added.
* @return insertIndex.
* @throws RuntimeException thrown if this NodeSetDTM is not of 
* a mutable type.
*/
protected int addNodeInDocOrder(int node)
{
   assertion(hasCache(), "addNodeInDocOrder must be done on a mutable sequence!");

   int insertIndex = -1;
   
   NodeVector vec = getVector();

   // This needs to do a binary search, but a binary search 
   // is somewhat tough because the sequence test involves 
   // two nodes.
   int size = vec.size(), i;

   for (i = size - 1; i >= 0; i--)
   {
     int child = vec.elementAt(i);

     if (child == node)
     {
       i = -2; // Duplicate, suppress insert

       break;
     }

     DTM dtm = m_dtmMgr.getDTM(node);
     if (!dtm.isNodeAfter(node, child))
     {
       break;
     }
   }

   if (i != -2)
   {
     insertIndex = i + 1;

     vec.insertElementAt(node, insertIndex);
   }

   // checkDups();
   return insertIndex;
 }
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:50,代码来源:NodeSequence.java

示例3: nextNode

import org.apache.xml.dtm.DTM; //导入方法依赖的package包/类
/**
 *  Returns the next node in the set and advances the position of the
 * iterator in the set. After a DTMIterator is created, the first call
 * to nextNode() returns the first node in the set.
 * @return  The next <code>Node</code> in the set being iterated over, or
 *   <code>null</code> if there are no more members in that set.
 */
public int nextNode()
{
	if(m_foundLast)
		return DTM.NULL;

  // Loop through the iterators getting the current fetched 
  // node, and get the earliest occuring in document order
  int earliestNode = DTM.NULL;

  if (null != m_iterators)
  {
    int n = m_iterators.length;
    int iteratorUsed = -1;

    for (int i = 0; i < n; i++)
    {
      int node = m_iterators[i].getCurrentNode();

      if (DTM.NULL == node)
        continue;
      else if (DTM.NULL == earliestNode)
      {
        iteratorUsed = i;
        earliestNode = node;
      }
      else
      {
        if (node == earliestNode)
        {

          // Found a duplicate, so skip past it.
          m_iterators[i].nextNode();
        }
        else
        {
          DTM dtm = getDTM(node);

          if (dtm.isNodeAfter(node, earliestNode))
          {
            iteratorUsed = i;
            earliestNode = node;
          }
        }
      }
    }

    if (DTM.NULL != earliestNode)
    {
      m_iterators[iteratorUsed].nextNode();

      incrementCurrentPos();
    }
    else
      m_foundLast = true;
  }

  m_lastFetched = earliestNode;

  return earliestNode;
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:68,代码来源:UnionPathIterator.java

示例4: addNodeInDocOrder

import org.apache.xml.dtm.DTM; //导入方法依赖的package包/类
/**
 * Add the node into a vector of nodes where it should occur in
 * document order.
 * @param node The node to be added.
 * @param test true if we should test for doc order
 * @param support The XPath runtime context.
 * @return insertIndex.
 * @throws RuntimeException thrown if this NodeSetDTM is not of 
 * a mutable type.
 */
public int addNodeInDocOrder(int node, boolean test, XPathContext support)
{

  if (!m_mutable)
    throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!");

  int insertIndex = -1;

  if (test)
  {

    // This needs to do a binary search, but a binary search 
    // is somewhat tough because the sequence test involves 
    // two nodes.
    int size = size(), i;

    for (i = size - 1; i >= 0; i--)
    {
      int child = elementAt(i);

      if (child == node)
      {
        i = -2;  // Duplicate, suppress insert

        break;
      }

      DTM dtm = support.getDTM(node);
      if (!dtm.isNodeAfter(node, child))
      {
        break;
      }
    }

    if (i != -2)
    {
      insertIndex = i + 1;

      insertElementAt(node, insertIndex);
    }
  }
  else
  {
    insertIndex = this.size();

    boolean foundit = false;

    for (int i = 0; i < insertIndex; i++)
    {
      if (i == node)
      {
        foundit = true;

        break;
      }
    }

    if (!foundit)
      addElement(node);
  }

  // checkDups();
  return insertIndex;
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:75,代码来源:NodeSetDTM.java


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