acoliver    2003/07/18 10:29:15

  Modified:    src/java/org/apache/poi/util IntList.java
  Added:       src/java/org/apache/poi/util DoubleList.java
  Log:
  DoubleList for new poi-performance changes
  CVS: ----------------------------------------------------------------------
  CVS: PR:
  CVS:   If this change addresses a PR in the problem report tracking
  CVS:   database, then enter the PR number(s) here.
  CVS: Obtained from:
  CVS:   If this change has been taken from another system, such as NCSA,
  CVS:   then name the system in this line, otherwise delete it.
  CVS: Submitted by:
  CVS:   If this code has been contributed to Apache by someone else; i.e.,
  CVS:   they sent us a patch or a new module, then include their name/email
  CVS:   address here. If this is your work then delete this line.
  CVS: Reviewed by:
  CVS:   If we are doing pre-commit code reviews and someone else has
  CVS:   reviewed your changes, include their name(s) here.
  CVS:   If you have not had it reviewed then delete this line.
  
  Revision  Changes    Path
  1.3       +27 -4     jakarta-poi/src/java/org/apache/poi/util/IntList.java
  
  Index: IntList.java
  ===================================================================
  RCS file: /home/cvs/jakarta-poi/src/java/org/apache/poi/util/IntList.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- IntList.java      30 Apr 2003 04:39:09 -0000      1.2
  +++ IntList.java      18 Jul 2003 17:29:15 -0000      1.3
  @@ -88,6 +88,7 @@
   {
       private int[]            _array;
       private int              _limit;
  +    private int              fillval = 0;
       private static final int _default_size = 128;
   
       /**
  @@ -97,8 +98,14 @@
       public IntList()
       {
           this(_default_size);
  -    }
  +    }    
   
  +    public IntList(final int initialCapacity)
  +    {
  +        this(initialCapacity,0);
  +    }
  +    
  +    
       /**
        * create a copy of an existing IntList
        *
  @@ -118,12 +125,22 @@
        * @param initialCapacity the size for the internal array
        */
   
  -    public IntList(final int initialCapacity)
  +    public IntList(final int initialCapacity, int fillvalue)
       {
           _array = new int[ initialCapacity ];
  +        if (fillval != 0) {
  +            fillval = fillvalue;
  +            fillArray(fillval, _array, 0);        
  +        }
           _limit = 0;
       }
   
  +    private void fillArray(int val, int[] array, int index) {
  +      for (int k = index; k < array.length; k++) {
  +        array[k] = val;   
  +      }
  +    }
  +    
       /**
        * add the specfied value at the specified index
        *
  @@ -519,7 +536,9 @@
           {
               if (o == _array[ j ])
               {
  -                System.arraycopy(_array, j + 1, _array, j, _limit - j);
  +                if (j+1 < _limit) {
  +                    System.arraycopy(_array, j + 1, _array, j, _limit - j);
  +                }
                   _limit--;
                   rval = true;
               }
  @@ -670,7 +689,11 @@
           int   size      = (new_size == _array.length) ? new_size + 1
                                                         : new_size;
           int[] new_array = new int[ size ];
  -
  +        
  +        if (fillval != 0) {
  +          fillArray(fillval, new_array, _array.length);                
  +        }
  +        
           System.arraycopy(_array, 0, new_array, 0, _limit);
           _array = new_array;
       }
  
  
  
  1.2       +677 -0    jakarta-poi/src/java/org/apache/poi/util/DoubleList.java
  
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to