"permutation is wrong size: " + perm.length + " elements but should be " + fileSystems.size() } else if (!isPermutation(perm)) { StringBuffer message = new StringBuffer("permutation is not really a permutation:"); // NOI18N
/** Reorders {@link FileSystem}s by given permutation. * For example, if there are three filesystems, <code>new int[] {2, 0, 1}</code> cycles the filesystems forwards. * @param perm an array of integers * @throws IllegalArgumentException if the array is not a permutation, or is not the same length as the current number of filesystems in the pool * @deprecated Please use the <a href="@JAVA/API@/org/netbeans/api/java/classpath/api.html">ClassPath API</a> instead. */ public final void reorder(int[] perm) { synchronized (this) { if (perm == null) { throw new IllegalArgumentException ("null permutation"); // NOI18N } else if (perm.length != fileSystems.size ()) { throw new IllegalArgumentException ("permutation is wrong size: " + perm.length + " elements but should be " + fileSystems.size ()); // NOI18N } else if (! isPermutation (perm)) { StringBuffer message = new StringBuffer ("permutation is not really a permutation:"); // NOI18N for (int i = 0; i < perm.length; i++) { message.append (' '); message.append (perm[i]); } throw new IllegalArgumentException (message.toString ()); } ArrayList newList = new ArrayList (fileSystems.size ()); int len = perm.length; for (int i = 0; i < len; i++) { newList.add (fileSystems.get (perm[i])); } fileSystems = newList; fileSystemsClone = (ArrayList)fileSystems.clone(); } fireFileSystemReordered(perm); }
/** Reorders {@link FileSystem}s by given permutation. * For example, if there are three filesystems, <code>new int[] {2, 0, 1}</code> cycles the filesystems forwards. * @param perm an array of integers * @throws IllegalArgumentException if the array is not a permutation, or is not the same length as the current number of filesystems in the pool * @deprecated Please use the <a href="@JAVA/API@/org/netbeans/api/java/classpath/api.html">ClassPath API</a> instead. */ public final void reorder(int[] perm) { synchronized (this) { if (perm == null) { throw new IllegalArgumentException ("null permutation"); // NOI18N } else if (perm.length != fileSystems.size ()) { throw new IllegalArgumentException ("permutation is wrong size: " + perm.length + " elements but should be " + fileSystems.size ()); // NOI18N } else if (! isPermutation (perm)) { StringBuffer message = new StringBuffer ("permutation is not really a permutation:"); // NOI18N for (int i = 0; i < perm.length; i++) { message.append (' '); message.append (perm[i]); } throw new IllegalArgumentException (message.toString ()); } ArrayList newList = new ArrayList (fileSystems.size ()); int len = perm.length; for (int i = 0; i < len; i++) { newList.add (fileSystems.get (perm[i])); } fileSystems = newList; fileSystemsClone = (ArrayList)fileSystems.clone(); } fireFileSystemReordered(perm); }