01: /*
02: * This file or a portion of this file is licensed under the terms of
03: * the Globus Toolkit Public License, found in file GTPL, or at
04: * http://www.globus.org/toolkit/download/license.html. This notice must
05: * appear in redistributions of this file, with or without modification.
06: *
07: * Redistributions of this Software, with or without modification, must
08: * reproduce the GTPL in: (1) the Software, or (2) the Documentation or
09: * some other similar material which is provided with the Software (if
10: * any).
11: *
12: * Copyright 1999-2004 University of Chicago and The University of
13: * Southern California. All rights reserved.
14: */
15:
16: package org.griphyn.common.util;
17:
18: /**
19: * This is the test program for the Separator class.
20: *
21: * @author Jens-S. Vöckler
22: * @author Yong Zhao
23: * @version $Revision: 50 $
24: *
25: * @see org.griphyn.vdl.classes.Definition
26: */
27: public class Separator2Test {
28: public static void x(String what, int len) {
29: String s = (what == null ? "(null)" : ("\"" + what + "\""));
30: System.out.print(s);
31: for (int i = s.length(); i < len; ++i)
32: System.out.print(' ');
33: }
34:
35: public static void show(String what) {
36: x(what, 16);
37: System.out.print(" => [");
38: try {
39: String[] x = Separator.splitFQDI(what);
40: for (int i = 0; i < x.length; ++i) {
41: System.out.print(Integer.toString(i) + ':');
42: x(x[i], 8);
43: if (i < x.length - 1)
44: System.out.print(", ");
45: }
46: } catch (IllegalArgumentException iae) {
47: System.out.print(iae.getMessage());
48: }
49: System.out.println(']');
50: }
51:
52: public static void main(String[] args) {
53: if (args.length > 0) {
54: for (int i = 0; i < args.length; ++i)
55: show(args[i]);
56: } else {
57: show("me");
58: show("::me");
59: show("::me:");
60: show("me:");
61: show("me:too");
62: show("test::me");
63: show("test::me:");
64:
65: show("::me:");
66: show("::me:too");
67: show("test::me:too");
68: show("::me:too");
69:
70: show("::me::");
71: show("::me:too:");
72: show(":::");
73: show("test:::");
74: show(":::too");
75: }
76: }
77: }
|