…lines 1–34 unchanged (34 lines)
35 private List tokens = new ArrayList();
36
37 /** specifies if bursting should continue */
38 private boolean eatTheRest;
39
40 /** holder for the current option */
41 private Option currentOption;
42
43 /** the command line Options */
44 private Options options;
45
46 /**
47 * Resets the members to their original state i.e. remove
…lines 48–110 unchanged (63 lines)
111 {
112 int pos = token.indexOf('=');
113 String opt = pos == -1 ? token : token.substring(0, pos); // --foo
114
115 if (!options.hasOption(opt))
116 {
117 processNonOptionToken(token, stopAtNonOption);
118 }
119 else
120 {
121 currentOption = options.getOption(opt);
122
123 tokens.add(opt);
124 if (pos != -1)
125 {
126 tokens.add(token.substring(pos + 1));
127 }
…lines 128–142 unchanged (15 lines)
143 else
144 {
145 burstToken(token, stopAtNonOption);
146 }
147 }
148 else
149 {
150 processNonOptionToken(token, stopAtNonOption);
151 }
152
153 gobble(iter);
154 }
155
156 return (String[]) tokens.toArray(new String[tokens.size()]);
157 }
158
…lines 159–175 unchanged (17 lines)
176 * Add the special token "<b>--</b>" and the current <code>value</code>
177 * to the processed tokens list. Then add all the remaining
178 * <code>argument</code> values to the processed tokens list.
179 *
180 * @param value The current token
181 */
182 private void processNonOptionToken(String value, boolean stopAtNonOption)
183 {
184 if (stopAtNonOption && (currentOption == null || !currentOption.hasArg()))
185 {
186 eatTheRest = true;
187 tokens.add("--");
188 }
189
190 tokens.add(value);
191 }
192
193 /**
194 * <p>If an {@link Option} exists for <code>token</code> then
…lines 195–205 unchanged (11 lines)
206 {
207 if (stopAtNonOption && !options.hasOption(token))
208 {
209 eatTheRest = true;
210 }
211
212 if (options.hasOption(token))
213 {
214 currentOption = options.getOption(token);
215 }
216
217 tokens.add(token);
218 }
219
220 /**
221 * Breaks <code>token</code> into its constituent parts
…lines 222–241 unchanged (20 lines)
242 * @param token The current token to be <b>burst</b>
243 * @param stopAtNonOption Specifies whether to stop processing
244 * at the first non-Option encountered.
245 */
246 protected void burstToken(String token, boolean stopAtNonOption)
247 {
248 for (int i = 1; i < token.length(); i++)
249 {
250 String ch = String.valueOf(token.charAt(i));
251
252 if (options.hasOption(ch))
253 {
254 tokens.add("-" + ch);
…lines 255–259 unchanged (5 lines)
260
261 break;
262 }
263 }
264 else if (stopAtNonOption)
265 {
266 processNonOptionToken(token.substring(i), true);
267 break;
268 }
269 else
270 {
271 tokens.add(token);
272 break;
…lines 273–277 unchanged (5 lines)