1 /*
2 * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * - Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 *
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * - Neither the name of Oracle nor the names of its
16 * contributors may be used to endorse or promote products derived
17 * from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
20 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
267 System.out.println("</tr>");
268 }
269 System.out.println("</table><br>\n");
270 }
271
272 System.out.println("</body></html>");
273 }
274
275 private static void printHtmlCell(String s, String color, String align) {
276 System.out.print("<td bgcolor=\"" + color +
277 "\" align=\"" + align + "\">" + s +
278 "</td>");
279 }
280
281 private static String[] toSortedArray(Enumeration e, boolean special) {
282 Vector keylist = new Vector();
283 while (e.hasMoreElements()) {
284 String key = (String)e.nextElement();
285 keylist.add(key);
286 }
287 String keys[] = new String[keylist.size()];
288 keylist.copyInto(keys);
289 if (special) {
290 sort2(keys);
291 } else {
292 sort(keys);
293 }
294 return keys;
295 }
296
297 public static void sort(String strs[]) {
298 for (int i = 1; i < strs.length; i++) {
299 for (int j = i; j > 0; j--) {
300 if (strs[j].compareTo(strs[j-1]) >= 0) {
301 break;
302 }
303 String tmp = strs[j-1];
304 strs[j-1] = strs[j];
305 strs[j] = tmp;
306 }
307 }
308 }
309
310 public static void sort2(String strs[]) {
311 for (int i = 1; i < strs.length; i++) {
312 for (int j = i; j > 0; j--) {
313 if (compare(strs[j-1], strs[j])) {
314 break;
315 }
316 String tmp = strs[j-1];
317 strs[j-1] = strs[j];
318 strs[j] = tmp;
319 }
320 }
321 }
322
323 private static int magic(String s) {
324 if (s.endsWith("random")) {
325 return 3;
326 } else if (s.endsWith("photo")) {
327 return 2;
328 } else if (s.endsWith("vector")) {
329 return 1;
330 } else {
|
1 /*
2 * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * - Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 *
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * - Neither the name of Oracle nor the names of its
16 * contributors may be used to endorse or promote products derived
17 * from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
20 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
267 System.out.println("</tr>");
268 }
269 System.out.println("</table><br>\n");
270 }
271
272 System.out.println("</body></html>");
273 }
274
275 private static void printHtmlCell(String s, String color, String align) {
276 System.out.print("<td bgcolor=\"" + color +
277 "\" align=\"" + align + "\">" + s +
278 "</td>");
279 }
280
281 private static String[] toSortedArray(Enumeration e, boolean special) {
282 Vector keylist = new Vector();
283 while (e.hasMoreElements()) {
284 String key = (String)e.nextElement();
285 keylist.add(key);
286 }
287 String[] keys = new String[keylist.size()];
288 keylist.copyInto(keys);
289 if (special) {
290 sort2(keys);
291 } else {
292 sort(keys);
293 }
294 return keys;
295 }
296
297 public static void sort(String[] strs) {
298 for (int i = 1; i < strs.length; i++) {
299 for (int j = i; j > 0; j--) {
300 if (strs[j].compareTo(strs[j-1]) >= 0) {
301 break;
302 }
303 String tmp = strs[j-1];
304 strs[j-1] = strs[j];
305 strs[j] = tmp;
306 }
307 }
308 }
309
310 public static void sort2(String[] strs) {
311 for (int i = 1; i < strs.length; i++) {
312 for (int j = i; j > 0; j--) {
313 if (compare(strs[j-1], strs[j])) {
314 break;
315 }
316 String tmp = strs[j-1];
317 strs[j-1] = strs[j];
318 strs[j] = tmp;
319 }
320 }
321 }
322
323 private static int magic(String s) {
324 if (s.endsWith("random")) {
325 return 3;
326 } else if (s.endsWith("photo")) {
327 return 2;
328 } else if (s.endsWith("vector")) {
329 return 1;
330 } else {
|