com.sun.org.apache.xml.internal.utils.NodeVector Java Examples

The following examples show how to use com.sun.org.apache.xml.internal.utils.NodeVector. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NodeSequence.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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();
              }

      }
}
 
Example #2
Source File: NodeSequence.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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();
              }

      }
}
 
Example #3
Source File: NodeSequence.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @see DTMIterator#getCurrentNode()
 */
public int getCurrentNode()
{
      if(hasCache())
      {
              int currentIndex = m_next-1;
              NodeVector vec = getVector();
              if((currentIndex >= 0) && (currentIndex < vec.size()))
                      return vec.elementAt(currentIndex);
              else
                      return DTM.NULL;
      }

      if(null != m_iter)
      {
      return m_iter.getCurrentNode();
      }
      else
              return DTM.NULL;
}
 
Example #4
Source File: NodeSequence.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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();
              }

      }
}
 
Example #5
Source File: NodeSequence.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * @see DTMIterator#getCurrentNode()
 */
public int getCurrentNode()
{
      if(hasCache())
      {
              int currentIndex = m_next-1;
              NodeVector vec = getVector();
              if((currentIndex >= 0) && (currentIndex < vec.size()))
                      return vec.elementAt(currentIndex);
              else
                      return DTM.NULL;
      }

      if(null != m_iter)
      {
      return m_iter.getCurrentNode();
      }
      else
              return DTM.NULL;
}
 
Example #6
Source File: NodeSequence.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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();
              }

      }
}
 
Example #7
Source File: NodeSequence.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * 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();
              }

      }
}
 
Example #8
Source File: NodeSequence.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @see DTMIterator#getCurrentNode()
 */
public int getCurrentNode()
{
      if(hasCache())
      {
              int currentIndex = m_next-1;
              NodeVector vec = getVector();
              if((currentIndex >= 0) && (currentIndex < vec.size()))
                      return vec.elementAt(currentIndex);
              else
                      return DTM.NULL;
      }

      if(null != m_iter)
      {
      return m_iter.getCurrentNode();
      }
      else
              return DTM.NULL;
}
 
Example #9
Source File: NodeSequence.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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();
              }

      }
}
 
Example #10
Source File: NodeSequence.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @see DTMIterator#getCurrentNode()
 */
public int getCurrentNode()
{
      if(hasCache())
      {
              int currentIndex = m_next-1;
              NodeVector vec = getVector();
              if((currentIndex >= 0) && (currentIndex < vec.size()))
                      return vec.elementAt(currentIndex);
              else
                      return DTM.NULL;
      }

      if(null != m_iter)
      {
      return m_iter.getCurrentNode();
      }
      else
              return DTM.NULL;
}
 
Example #11
Source File: NodeSequence.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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();
              }

      }
}
 
Example #12
Source File: NodeSequence.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @see DTMIterator#getCurrentNode()
 */
public int getCurrentNode()
{
      if(hasCache())
      {
              int currentIndex = m_next-1;
              NodeVector vec = getVector();
              if((currentIndex >= 0) && (currentIndex < vec.size()))
                      return vec.elementAt(currentIndex);
              else
                      return DTM.NULL;
      }

      if(null != m_iter)
      {
      return m_iter.getCurrentNode();
      }
      else
              return DTM.NULL;
}
 
Example #13
Source File: NodeSequence.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
   * @see DTMIterator#setShouldCacheNodes(boolean)
   */
  public void setShouldCacheNodes(boolean b)
  {
    if (b)
    {
      if(!hasCache())
      {
        SetVector(new NodeVector());
      }
//        else
//          getVector().RemoveAllNoClear();  // Is this good?
    }
    else
      SetVector(null);
  }
 
Example #14
Source File: NodeSequence.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * If this NodeSequence has a cache, mark that it is complete.
 * This method should be called after the iterator is exhausted.
 */
private void markCacheComplete() {
    NodeVector nv = getVector();
    if (nv != null) {
        m_cache.setCacheComplete(true);
    }
}
 
Example #15
Source File: NodeSequence.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * @see DTMIterator#getLength()
 */
public int getLength()
{
  IteratorCache cache = getCache();

      if(cache != null)
      {
      // Nodes from the iterator are cached
      if (cache.isComplete()) {
          // All of the nodes from the iterator are cached
          // so just return the number of nodes in the cache
          NodeVector nv = cache.getVector();
          return nv.size();
      }

      // If this NodeSequence wraps a mutable nodeset, then
      // m_last will not reflect the size of the nodeset if
      // it has been mutated...
      if (m_iter instanceof NodeSetDTM)
      {
          return m_iter.getLength();
      }

              if(-1 == m_last)
              {
                      int pos = m_next;
                      runTo(-1);
                      m_next = pos;
              }
          return m_last;
      }
      else
      {
              return (-1 == m_last) ? (m_last = m_iter.getLength()) : m_last;
      }
}
 
Example #16
Source File: NodeSequence.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
   * @see DTMIterator#setShouldCacheNodes(boolean)
   */
  public void setShouldCacheNodes(boolean b)
  {
    if (b)
    {
      if(!hasCache())
      {
        SetVector(new NodeVector());
      }
//        else
//          getVector().RemoveAllNoClear();  // Is this good?
    }
    else
      SetVector(null);
  }
 
Example #17
Source File: NodeSequence.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
   * @see DTMIterator#setShouldCacheNodes(boolean)
   */
  public void setShouldCacheNodes(boolean b)
  {
    if (b)
    {
      if(!hasCache())
      {
        SetVector(new NodeVector());
      }
//        else
//          getVector().RemoveAllNoClear();  // Is this good?
    }
    else
      SetVector(null);
  }
 
Example #18
Source File: NodeSequence.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see DTMIterator#getLength()
 */
public int getLength()
{
  IteratorCache cache = getCache();

      if(cache != null)
      {
      // Nodes from the iterator are cached
      if (cache.isComplete()) {
          // All of the nodes from the iterator are cached
          // so just return the number of nodes in the cache
          NodeVector nv = cache.getVector();
          return nv.size();
      }

      // If this NodeSequence wraps a mutable nodeset, then
      // m_last will not reflect the size of the nodeset if
      // it has been mutated...
      if (m_iter instanceof NodeSetDTM)
      {
          return m_iter.getLength();
      }

              if(-1 == m_last)
              {
                      int pos = m_next;
                      runTo(-1);
                      m_next = pos;
              }
          return m_last;
      }
      else
      {
              return (-1 == m_last) ? (m_last = m_iter.getLength()) : m_last;
      }
}
 
Example #19
Source File: NodeSequence.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Construct an empty XNodeSet object.  This is used to create a mutable
 * nodeset to which random nodes may be added.
 */
private NodeSequence(DTMManager dtmMgr)
{
  super(new NodeVector());
  m_last = 0;
  m_dtmMgr = dtmMgr;
}
 
Example #20
Source File: NodeSequence.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * If this NodeSequence has a cache, mark that it is complete.
 * This method should be called after the iterator is exhausted.
 */
private void markCacheComplete() {
    NodeVector nv = getVector();
    if (nv != null) {
        m_cache.setCacheComplete(true);
    }
}
 
Example #21
Source File: NodeSequence.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
   * @see DTMIterator#setShouldCacheNodes(boolean)
   */
  public void setShouldCacheNodes(boolean b)
  {
    if (b)
    {
      if(!hasCache())
      {
        SetVector(new NodeVector());
      }
//        else
//          getVector().RemoveAllNoClear();  // Is this good?
    }
    else
      SetVector(null);
  }
 
Example #22
Source File: NodeSequence.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Construct an empty XNodeSet object.  This is used to create a mutable
 * nodeset to which random nodes may be added.
 */
private NodeSequence(DTMManager dtmMgr)
{
  super(new NodeVector());
  m_last = 0;
  m_dtmMgr = dtmMgr;
}
 
Example #23
Source File: NodeSetDTM.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Append the nodes to the list.
 *
 * @param nodes The nodes to be appended to this node set.
 * @throws RuntimeException thrown if this NodeSetDTM is not of
 * a mutable type.
 */
public void appendNodes(NodeVector nodes)
{

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

  super.appendNodes(nodes);
}
 
Example #24
Source File: NodeSequence.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Construct an empty XNodeSet object.  This is used to create a mutable
 * nodeset to which random nodes may be added.
 */
private NodeSequence(DTMManager dtmMgr)
{
  super(new NodeVector());
  m_last = 0;
  m_dtmMgr = dtmMgr;
}
 
Example #25
Source File: NodeSequence.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * It used to be that many locations in the code simply
 * did an assignment to this.m_obj directly, rather than
 * calling the setObject(Object) method. The problem is
 * that our super-class would be updated on what the
 * cache associated with this NodeSequence, but
 * we wouldn't know ourselves.
 * <p>
 * All setting of m_obj is done through setObject() now,
 * and this method over-rides the super-class method.
 * So now we are in the loop have an opportunity
 * to update some caching information.
 *
 */
protected void setObject(Object obj) {
    if (obj instanceof NodeVector) {
        // Keep our superclass informed of the current NodeVector
        // ... if we don't the smoketest fails (don't know why).
        super.setObject(obj);

        // A copy of the code of what SetVector() would do.
        NodeVector v = (NodeVector)obj;
        if (m_cache != null) {
            m_cache.setVector(v);
        } else if (v!=null) {
            m_cache = new IteratorCache();
            m_cache.setVector(v);
        }
    } else if (obj instanceof IteratorCache) {
        IteratorCache cache = (IteratorCache) obj;
        m_cache = cache;
        m_cache.increaseUseCount();

        // Keep our superclass informed of the current NodeVector
        super.setObject(cache.getVector());
    } else {
        super.setObject(obj);
    }

}
 
Example #26
Source File: NodeSequence.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * It used to be that many locations in the code simply
 * did an assignment to this.m_obj directly, rather than
 * calling the setObject(Object) method. The problem is
 * that our super-class would be updated on what the
 * cache associated with this NodeSequence, but
 * we wouldn't know ourselves.
 * <p>
 * All setting of m_obj is done through setObject() now,
 * and this method over-rides the super-class method.
 * So now we are in the loop have an opportunity
 * to update some caching information.
 *
 */
protected void setObject(Object obj) {
    if (obj instanceof NodeVector) {
        // Keep our superclass informed of the current NodeVector
        // ... if we don't the smoketest fails (don't know why).
        super.setObject(obj);

        // A copy of the code of what SetVector() would do.
        NodeVector v = (NodeVector)obj;
        if (m_cache != null) {
            m_cache.setVector(v);
        } else if (v!=null) {
            m_cache = new IteratorCache();
            m_cache.setVector(v);
        }
    } else if (obj instanceof IteratorCache) {
        IteratorCache cache = (IteratorCache) obj;
        m_cache = cache;
        m_cache.increaseUseCount();

        // Keep our superclass informed of the current NodeVector
        super.setObject(cache.getVector());
    } else {
        super.setObject(obj);
    }

}
 
Example #27
Source File: NodeSetDTM.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Append the nodes to the list.
 *
 * @param nodes The nodes to be appended to this node set.
 * @throws RuntimeException thrown if this NodeSetDTM is not of
 * a mutable type.
 */
public void appendNodes(NodeVector nodes)
{

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

  super.appendNodes(nodes);
}
 
Example #28
Source File: NodeSequence.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
   * @see DTMIterator#setShouldCacheNodes(boolean)
   */
  public void setShouldCacheNodes(boolean b)
  {
    if (b)
    {
      if(!hasCache())
      {
        SetVector(new NodeVector());
      }
//        else
//          getVector().RemoveAllNoClear();  // Is this good?
    }
    else
      SetVector(null);
  }
 
Example #29
Source File: NodeSequence.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * It used to be that many locations in the code simply
 * did an assignment to this.m_obj directly, rather than
 * calling the setObject(Object) method. The problem is
 * that our super-class would be updated on what the
 * cache associated with this NodeSequence, but
 * we wouldn't know ourselves.
 * <p>
 * All setting of m_obj is done through setObject() now,
 * and this method over-rides the super-class method.
 * So now we are in the loop have an opportunity
 * to update some caching information.
 *
 */
protected void setObject(Object obj) {
    if (obj instanceof NodeVector) {
        // Keep our superclass informed of the current NodeVector
        // ... if we don't the smoketest fails (don't know why).
        super.setObject(obj);

        // A copy of the code of what SetVector() would do.
        NodeVector v = (NodeVector)obj;
        if (m_cache != null) {
            m_cache.setVector(v);
        } else if (v!=null) {
            m_cache = new IteratorCache();
            m_cache.setVector(v);
        }
    } else if (obj instanceof IteratorCache) {
        IteratorCache cache = (IteratorCache) obj;
        m_cache = cache;
        m_cache.increaseUseCount();

        // Keep our superclass informed of the current NodeVector
        super.setObject(cache.getVector());
    } else {
        super.setObject(obj);
    }

}
 
Example #30
Source File: NodeSequence.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If this NodeSequence has a cache, mark that it is complete.
 * This method should be called after the iterator is exhausted.
 */
private void markCacheComplete() {
    NodeVector nv = getVector();
    if (nv != null) {
        m_cache.setCacheComplete(true);
    }
}