You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by sb...@apache.org on 2001/04/17 17:53:41 UTC

cvs commit: xml-xalan/java/src/org/apache/xml/utils IntVector.java

sboag       01/04/17 08:53:41

  Modified:    java/src/org/apache/xml/utils Tag: DTM_EXP IntVector.java
  Log:
  Added addElements(int value, int numberOfElements),
  addElements(int numberOfElements),
  and fixed bug with setElementAt.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.1   +51 -2     xml-xalan/java/src/org/apache/xml/utils/IntVector.java
  
  Index: IntVector.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/utils/IntVector.java,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- IntVector.java	2000/11/30 20:14:02	1.2
  +++ IntVector.java	2001/04/17 15:53:38	1.2.2.1
  @@ -133,6 +133,55 @@
   
       m_firstFree++;
     }
  +  
  +  /**
  +   * Append several int values onto the vector.
  +   *
  +   * @param value Int to add to the list 
  +   */
  +  public final void addElements(int value, int numberOfElements)
  +  {
  +
  +    if ((m_firstFree + numberOfElements) >= m_mapSize)
  +    {
  +      m_mapSize += (m_blocksize+numberOfElements);
  +
  +      int newMap[] = new int[m_mapSize];
  +
  +      System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1);
  +
  +      m_map = newMap;
  +    }
  +
  +    for (int i = 0; i < numberOfElements; i++) 
  +    {
  +      m_map[m_firstFree] = value;
  +      m_firstFree++;
  +    }
  +  }
  +  
  +  /**
  +   * Append several slots onto the vector, but do not set the values.
  +   *
  +   * @param value Int to add to the list 
  +   */
  +  public final void addElements(int numberOfElements)
  +  {
  +
  +    if ((m_firstFree + numberOfElements) >= m_mapSize)
  +    {
  +      m_mapSize += (m_blocksize+numberOfElements);
  +
  +      int newMap[] = new int[m_mapSize];
  +
  +      System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1);
  +
  +      m_map = newMap;
  +    }
  +    
  +    m_firstFree += numberOfElements;
  +  }
  +  
   
     /**
      * Inserts the specified node in this vector at the specified index.
  @@ -245,9 +294,9 @@
      * @param node object to set
      * @param index Index of where to set the object
      */
  -  public final void setElementAt(int node, int index)
  +  public final void setElementAt(int value, int index)
     {
  -    m_map[index] = node;
  +    m_map[index] = value;
     }
   
     /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org