1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.bin; |
22 |
|
|
23 |
|
import java.net.URLDecoder; |
24 |
|
import java.util.Vector; |
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
@author |
33 |
|
|
34 |
|
|
|
|
| 0% |
Uncovered Elements: 40 (40) |
Complexity: 14 |
Complexity Density: 0.58 |
|
35 |
|
public class ArgsParser |
36 |
|
{ |
37 |
|
Vector<String> vargs = null; |
38 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 4 |
Complexity Density: 0.67 |
|
39 |
0 |
public ArgsParser(String[] args)... |
40 |
|
{ |
41 |
0 |
vargs = new Vector<String>(); |
42 |
0 |
for (int i = 0; i < args.length; i++) |
43 |
|
{ |
44 |
0 |
String arg = args[i].trim(); |
45 |
0 |
if (arg.length() > 0 && arg.charAt(0) == '-') |
46 |
|
{ |
47 |
0 |
arg = arg.substring(1); |
48 |
|
} |
49 |
0 |
vargs.addElement(arg); |
50 |
|
} |
51 |
|
} |
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
@param |
57 |
|
@return |
58 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
59 |
0 |
public String getValue(String arg)... |
60 |
|
{ |
61 |
0 |
return getValue(arg, false); |
62 |
|
} |
63 |
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 5 |
Complexity Density: 0.45 |
|
64 |
0 |
public String getValue(String arg, boolean utf8decode)... |
65 |
|
{ |
66 |
0 |
int index = vargs.indexOf(arg); |
67 |
0 |
String dc = null, ret = null; |
68 |
0 |
if (index != -1) |
69 |
|
{ |
70 |
0 |
ret = vargs.elementAt(index + 1).toString(); |
71 |
0 |
vargs.removeElementAt(index); |
72 |
0 |
vargs.removeElementAt(index); |
73 |
0 |
if (utf8decode && ret != null) |
74 |
|
{ |
75 |
0 |
try |
76 |
|
{ |
77 |
0 |
dc = URLDecoder.decode(ret, "UTF-8"); |
78 |
0 |
ret = dc; |
79 |
|
} catch (Exception e) |
80 |
|
{ |
81 |
|
|
82 |
|
} |
83 |
|
} |
84 |
|
} |
85 |
0 |
return ret; |
86 |
|
} |
87 |
|
|
88 |
|
|
89 |
|
|
90 |
|
|
91 |
|
@param |
92 |
|
@return |
93 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
94 |
0 |
public boolean contains(String arg)... |
95 |
|
{ |
96 |
0 |
if (vargs.contains(arg)) |
97 |
|
{ |
98 |
0 |
vargs.removeElement(arg); |
99 |
0 |
return true; |
100 |
|
} |
101 |
|
else |
102 |
|
{ |
103 |
0 |
return false; |
104 |
|
} |
105 |
|
} |
106 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
107 |
0 |
public String nextValue()... |
108 |
|
{ |
109 |
0 |
return vargs.remove(0); |
110 |
|
} |
111 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
112 |
0 |
public int getSize()... |
113 |
|
{ |
114 |
0 |
return vargs.size(); |
115 |
|
} |
116 |
|
|
117 |
|
} |