Changeset 4388


Ignore:
Timestamp:
2003-05-28T13:43:27+12:00 (21 years ago)
Author:
jmt12
Message:

A new method remove(File[] files, int index)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/util/ArrayTools.java

    r4364 r4388  
    391391    }
    392392
     393    /** Remove the file at the given index from the array of files. */
     394    static public File[] remove(File[] files, int index) {
     395    if(files.length == 1) {
     396        return new File[0];
     397    }
     398    File[] temp = new File[files.length - 1];
     399    if(index > 0) {
     400        System.arraycopy(files, 0, temp, 0, index);
     401    }
     402    if(index < files.length - 1) {
     403        System.arraycopy(files, index + 1, temp, index, files.length - 1 - index);
     404    }
     405    return temp;
     406    }
     407
    393408    /** Sorts an array of files. */
    394409    static public void sort(File[] files) {
Note: See TracChangeset for help on using the changeset viewer.