/** * This method moves the given image format <code>format</code> in the first position of the * vector. * * @param v the vector if image format * @param format the index of the format to be moved in first position */ private void moveToFirst(List<ImageFormat> v, int format) { for (ImageFormat i : v) if (i.getIndex() == format) { v.remove(i); v.add(0, i); break; } }
/** * This method moves the given image format <code>format</code> in the first position of the * vector. * * @param v the vector if image format * @param format the index of the format to be moved in first position */ private void moveToFirstIfNative(List<ImageFormat> v, int format) { for (ImageFormat i : v) if ((i.getIndex() == format) && (formats.contains(i))) { v.remove(i); v.add(0, i); break; } }
/** * this method returns a format in a list given its index * * @param l the image format list * @param i the index of the format * @return the image format with the given index, or null */ private ImageFormat getFormat(List<ImageFormat> l, int i) { for (ImageFormat f : l) if (f.getIndex() == i) return f; return null; }
/** * this method returns a format in a list given its name * * @param l the image format list * @param n the name of the format * @return the image format with the given name, or null */ private ImageFormat getFormat(List<ImageFormat> l, String n) { for (ImageFormat f : l) if (f.getName().equals(n)) return f; return null; }