KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > matuschek > getopt > GetOpt


1 /* Generated by Together */
2
3 package net.matuschek.getopt;
4
5 public class GetOpt {
6   public GetOpt(String JavaDoc[] options) {
7     this.options=options;
8   }
9   
10   public boolean getOptionBoolean(String JavaDoc name) {
11     for (int i=0; i<options.length; i++) {
12       if (options[i].equals("-"+name)) {
13     return true;
14       }
15     }
16     return false;
17   }
18     
19   public String JavaDoc getOptionString(String JavaDoc name) {
20     for (int i=0; i<options.length-1; i++) {
21       if (options[i].equals("-"+name)) {
22     return options[i+1];
23       }
24     }
25     return null;
26   }
27   
28   private String JavaDoc[] options;
29 }
30
Popular Tags